blob: 224734eb0bce03cc43e5fe3289ce9b31d73df598 (
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 '@libTypes';
/**
* 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;
}
|