| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Webauthn\AuthenticationExtensions; |
| 6 |
|
| 7 |
use function assert; |
| 8 |
use function in_array; |
| 9 |
|
| 10 |
final class LargeBlobInputExtension extends AuthenticationExtension |
| 11 |
{ |
| 12 |
public const REQUIRED = 'required'; |
| 13 |
|
| 14 |
public const PREFERRED = 'preferred'; |
| 15 |
|
| 16 |
public static function support(string $support): AuthenticationExtension |
| 17 |
{ |
| 18 |
assert(in_array($support, [self::REQUIRED, self::PREFERRED], true), 'Invalid support value.'); |
| 19 |
|
| 20 |
return self::create('largeBlob', [ |
| 21 |
'support' => $support, |
| 22 |
]); |
| 23 |
} |
| 24 |
|
| 25 |
public static function read(): AuthenticationExtension |
| 26 |
{ |
| 27 |
return self::create('largeBlob', [ |
| 28 |
'read' => true, |
| 29 |
]); |
| 30 |
} |
| 31 |
|
| 32 |
public static function write(string $value): AuthenticationExtension |
| 33 |
{ |
| 34 |
return self::create('largeBlob', [ |
| 35 |
'write' => $value, |
| 36 |
]); |
| 37 |
} |
| 38 |
} |