blob: b34fdc3d05b5237bfb19b49791a60673527650f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import { decodeCborFirst } from './decodeCbor';
/**
* Convert authenticator extension data buffer to a proper object
*
* @param extensionData Authenticator Extension Data buffer
*/
export function decodeAuthenticatorExtensions(
extensionData: Uint8Array,
): AuthenticationExtensionsAuthenticatorOutputs | undefined {
let toCBOR: AuthenticationExtensionsAuthenticatorOutputs | undefined;
try {
toCBOR = decodeCborFirst(extensionData);
} catch (err) {
const _err = err as Error;
throw new Error(`Error decoding authenticator extensions: ${_err.message}`);
}
return toCBOR;
}
export type AuthenticationExtensionsAuthenticatorOutputs = {
devicePubKey?: DevicePublicKeyAuthenticatorOutput;
uvm?: UVMAuthenticatorOutput;
};
export type DevicePublicKeyAuthenticatorOutput = {
dpk?: Uint8Array;
scp?: Uint8Array;
sig?: string;
aaguid?: Uint8Array;
};
// TODO: Need to verify this format
// https://w3c.github.io/webauthn/#sctn-uvm-extension.
export type UVMAuthenticatorOutput = {
uvm?: Uint8Array[];
};
|