webauthn-framework icon indicating copy to clipboard operation
webauthn-framework copied to clipboard

Better Authentication Extensions

Open Spomky opened this issue 2 years ago • 0 comments

Description

At the moment, the Webauthn\AuthenticationExtension is kind of generic extension object that carries the input and output data. It could be great to create dedicated objects for known extensions and enhance the way they are loaded.

Example

Example for uvm

final class UvmExtensionInput extends AuthenticationExtension
{
    private function __construct(bool $requested) {
        parent::__construct('uvm', $requested);
    }

    public static function requested(): self
    {
        return new self(true);
    }

    public static function notRequested(): self
    {
        return new self(false);
    }
}

//Usage:

UvmExtensionInput::requested();
final class UvmExtensionOutput extends AuthenticationExtension
{
    /**
     * @return array<string, positive-int>
     */
    public static function entries(): array
    {
        return ...
    }

}

Spomky avatar Jun 22 '23 09:06 Spomky