clusev/app/Services/WebauthnService.php

24 lines
637 B
PHP

<?php
namespace App\Services;
class WebauthnService
{
public function __construct(private DeploymentService $deployment) {}
/**
* WebAuthn needs a secure context AND a domain-based Relying-Party ID — a bare IP
* literal is not a valid rpId, so the feature is unavailable on bare-IP/HTTP.
*/
public function available(): bool
{
return $this->deployment->domain() !== null && request()->isSecure();
}
/** The Relying-Party ID = the active domain (asserted present by available()). */
public function rpId(): string
{
return (string) $this->deployment->domain();
}
}