summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeAttestationObject.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/helpers/decodeAttestationObject.ts')
-rw-r--r--packages/server/src/helpers/decodeAttestationObject.ts22
1 files changed, 19 insertions, 3 deletions
diff --git a/packages/server/src/helpers/decodeAttestationObject.ts b/packages/server/src/helpers/decodeAttestationObject.ts
index 3e66e67..2eb9997 100644
--- a/packages/server/src/helpers/decodeAttestationObject.ts
+++ b/packages/server/src/helpers/decodeAttestationObject.ts
@@ -1,11 +1,10 @@
import base64url from 'base64url';
import cbor from 'cbor';
-import { AttestationObject } from '@simplewebauthn/typescript-types';
/**
- * Convert an AttestationObject from base64 string to a proper object
+ * Convert an AttestationObject from base64url string to a proper object
*
- * @param base64AttestationObject Base64-encoded Attestation Object
+ * @param base64AttestationObject Base64URL-encoded Attestation Object
*/
export default function decodeAttestationObject(
base64AttestationObject: string,
@@ -14,3 +13,20 @@ export default function decodeAttestationObject(
const toCBOR: AttestationObject = cbor.decodeAllSync(toBuffer)[0];
return toCBOR;
}
+
+export enum ATTESTATION_FORMATS {
+ FIDO_U2F = 'fido-u2f',
+ PACKED = 'packed',
+ ANDROID_SAFETYNET = 'android-safetynet',
+ NONE = 'none',
+}
+
+export type AttestationObject = {
+ fmt: ATTESTATION_FORMATS;
+ attStmt: {
+ sig?: Buffer;
+ x5c?: Buffer[];
+ response?: Buffer;
+ };
+ authData: Buffer;
+};