Laravel Auth

PHP MIT

Laravel Auth by GhostCompiler adds advanced authentication for Laravel with TOTP 2FA, passkeys via WebAuthn, OTP channels (email, SMS, WhatsApp), trusted devices, and tenant-aware social login.

Stars
2
Forks
0
Downloads
N/A
Open Issues
0
Files main

Repository Files

Loading file structure...
stubs/App/LaravelAuth/WhatsAppOtpTransport.php
<?php

namespace App\LaravelAuth;

use GhostCompiler\LaravelAuth\Contracts\OtpTransport;
use GhostCompiler\LaravelAuth\Models\OtpChallenge;
use Illuminate\Contracts\Auth\Authenticatable;

class WhatsAppOtpTransport implements OtpTransport
{
    /**
     * Add your manual WhatsApp OTP provider API call here.
     *
     * @param  array<string, mixed>  $context
     */
    public function sendCode(Authenticatable $user, OtpChallenge $challenge, string $message, array $context = []): void
    {
        // Example:
        // Http::withToken(config('services.whatsapp.token'))->post('https://provider.example/send', [
        //     'to' => $context['destination'],
        //     'message' => $message,
        //     'code' => $context['code'],
        // ]);
    }

    /**
     * Add your manual WhatsApp OTP verification API call here.
     * Return true when the provider confirms the code is valid.
     *
     * @param  array<string, mixed>  $context
     */
    public function verifyCode(Authenticatable $user, OtpChallenge $challenge, string $code, array $context = []): bool
    {
        // Example:
        // return Http::withToken(config('services.whatsapp.token'))
        //     ->post('https://provider.example/verify', [
        //         'to' => $context['destination'] ?? $challenge->destination,
        //         'code' => $code,
        //     ])->successful();

        return true;
    }
}