blob: a03fefd3694b856d4cdb9b4986f0c57e70ac39ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import base64url from 'base64url';
import cbor from 'cbor';
import { ATTESTATION_FORMATS } from './constants';
type AttestationObject = {
fmt: ATTESTATION_FORMATS,
attStmt: {
sig?: Buffer,
x5c?: Buffer,
},
authData: Buffer,
};
/**
*
* @param obj
*/
export default function decodeAttestationObject(obj: string): AttestationObject {
const toBuffer = base64url.toBuffer(obj);
const toCBOR = cbor.decodeAllSync(toBuffer)[0];
return toCBOR;
}
|