blob: 3e66e6736667d619d0b584c255cdd53c5b072d2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import base64url from 'base64url';
import cbor from 'cbor';
import { AttestationObject } from '@simplewebauthn/typescript-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;
}
|