diff options
Diffstat (limited to 'packages/server/src')
-rw-r--r-- | packages/server/src/attestation/verifyAttestationResponse.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/server/src/attestation/verifyAttestationResponse.ts b/packages/server/src/attestation/verifyAttestationResponse.ts index ed4ac5c..07eeae6 100644 --- a/packages/server/src/attestation/verifyAttestationResponse.ts +++ b/packages/server/src/attestation/verifyAttestationResponse.ts @@ -29,6 +29,11 @@ export default function verifyAttestationResponse( const { type, origin, challenge } = clientDataJSON; + // Make sure we're handling an attestation + if (type !== 'webauthn.create') { + throw new Error(`Unexpected attestation type: ${type}`); + } + if (challenge !== expectedChallenge) { throw new Error( `Unexpected attestation challenge "${challenge}", expected "${expectedChallenge}"`, @@ -40,11 +45,6 @@ export default function verifyAttestationResponse( throw new Error(`Unexpected attestation origin "${origin}", expected "${expectedOrigin}"`); } - // Make sure we're handling an attestation - if (type !== 'webauthn.create') { - throw new Error(`Unexpected attestation type: ${type}`); - } - const { fmt } = attestationObject; /** |