Debian Codegraph @

lib/3rdParty/composer/web-auth/webauthn-lib/src/AuthenticationExtensions/AuthenticationExtensionLoader.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Webauthn\AuthenticationExtensions;
6
7 use CBOR\CBORObject;
8 use CBOR\MapObject;
9 use Webauthn\Exception\AuthenticationExtensionException;
10
11 abstract class AuthenticationExtensionLoader
12 {
13 public static function load(CBORObject $object): AuthenticationExtensions
14 {
15 $object instanceof MapObject || throw AuthenticationExtensionException::create('Invalid extension object');
16 /** @var array<string, mixed> $data */
17 $data = $object->normalize();
18 return AuthenticationExtensions::create(
19 array_map(
20 fn (mixed $value, string $key) => AuthenticationExtension::create($key, $value),
21 $data,
22 array_keys($data)
23 )
24 );
25 }
26 }