blob: 8b69c90dd5d0f6953e7acc35439c42d72905ff0e (
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 cbor from 'cbor';
/**
* Convert an AttestationObject buffer to a proper object
*
* @param base64AttestationObject Attestation Object buffer
*/
export default function decodeAttestationObject(attestationObject: Buffer): AttestationObject {
const toCBOR: AttestationObject = cbor.decodeAllSync(attestationObject)[0];
return toCBOR;
}
export enum ATTESTATION_FORMAT {
FIDO_U2F = 'fido-u2f',
PACKED = 'packed',
ANDROID_SAFETYNET = 'android-safetynet',
ANDROID_KEY = 'android-key',
TPM = 'tpm',
APPLE = 'apple',
NONE = 'none',
}
export type AttestationObject = {
fmt: ATTESTATION_FORMAT;
attStmt: AttestationStatement;
authData: Buffer;
};
export type AttestationStatement = {
sig?: Buffer;
x5c?: Buffer[];
response?: Buffer;
alg?: number;
ver?: string;
certInfo?: Buffer;
pubArea?: Buffer;
};
|