diff options
author | Matthew Miller <matthew@millerti.me> | 2022-11-06 09:06:02 -0800 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2022-11-06 09:06:02 -0800 |
commit | dc523d81bff8793ee4dc36b1273e08941fc7abaa (patch) | |
tree | d44b7e3ef48f79e3c532f313c4139cf6fa500645 /packages/server/src/authentication/verifyAuthenticationResponse.ts | |
parent | 6ca32c507f99c456c999234c546f8712f88e0ee5 (diff) |
Switch to uint8array helpers
Diffstat (limited to 'packages/server/src/authentication/verifyAuthenticationResponse.ts')
-rw-r--r-- | packages/server/src/authentication/verifyAuthenticationResponse.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/server/src/authentication/verifyAuthenticationResponse.ts b/packages/server/src/authentication/verifyAuthenticationResponse.ts index 7ae002e..9200758 100644 --- a/packages/server/src/authentication/verifyAuthenticationResponse.ts +++ b/packages/server/src/authentication/verifyAuthenticationResponse.ts @@ -12,6 +12,7 @@ import { parseAuthenticatorData } from '../helpers/parseAuthenticatorData'; import { isBase64URLString } from '../helpers/isBase64URLString'; import { parseBackupFlags } from '../helpers/parseBackupFlags'; import { AuthenticationExtensionsAuthenticatorOutputs } from '../helpers/decodeAuthenticatorExtensions'; +import uint8Array from '../helpers/uint8Array'; import base64url from '../helpers/base64url'; export type VerifyAuthenticationResponseOpts = { @@ -149,14 +150,14 @@ export async function verifyAuthenticationResponse( // Make sure the response's RP ID is ours if (typeof expectedRPID === 'string') { const expectedRPIDHash = toHash(Buffer.from(expectedRPID, 'ascii')); - if (!rpIdHash.equals(expectedRPIDHash)) { + if (!uint8Array.areEqual(rpIdHash, expectedRPIDHash)) { throw new Error(`Unexpected RP ID hash`); } } else { // Go through each expected RP ID and try to find one that matches const foundMatch = expectedRPID.some(expected => { const expectedRPIDHash = toHash(Buffer.from(expected, 'ascii')); - return rpIdHash.equals(expectedRPIDHash); + return uint8Array.areEqual(rpIdHash, expectedRPIDHash); }); if (!foundMatch) { |