blob: c54a69a69c263469ad73e45d774c4561e2537972 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import base64url from 'base64url';
import cbor from 'cbor';
import { AttestationObject } from '@types';
/**
* Convert an AttestationObject from base64 string to a proper object
*
* @param base64AttestationObject Base64-encoded Attestation Object
*/
export default function decodeAttestationObject(
base64AttestationObject: string,
): AttestationObject {
const toBuffer = base64url.toBuffer(base64AttestationObject);
const toCBOR: AttestationObject = cbor.decodeAllSync(toBuffer)[0];
return toCBOR;
}
|