diff options
author | Matthew Miller <matthew@millerti.me> | 2020-06-02 15:50:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-02 15:50:11 -0700 |
commit | ed960d81a9667d5cca2d444839f5ce63e2f38911 (patch) | |
tree | 2d9f2f8e7ce60a83e5409d073f74422bcc2df60e /packages/server/src/helpers/decodeAttestationObject.ts | |
parent | 743de54fa9b0cbef261cdbedf1c567c2202737cd (diff) | |
parent | bb5e3e99f7e50b9cec607b4fda34dcbd1e04aae9 (diff) |
Merge pull request #21 from MasterKale/feature/improve-browser
Refactor Megamix 1
Diffstat (limited to 'packages/server/src/helpers/decodeAttestationObject.ts')
-rw-r--r-- | packages/server/src/helpers/decodeAttestationObject.ts | 22 |
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; +}; |