summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/authentication/verifyAuthenticationResponse.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2022-11-11 15:46:06 -0800
committerMatthew Miller <matthew@millerti.me>2022-11-11 15:46:06 -0800
commit0c0c09687b3308dd1c680bb18f37393a6f6d616c (patch)
treefd26d8c9428b41427352b5bdb95c1b8d430cec63 /packages/server/src/authentication/verifyAuthenticationResponse.ts
parent248bd4c205d873bcf31d6374034d8d04f94496e5 (diff)
Replace some more references to Buffer
Diffstat (limited to 'packages/server/src/authentication/verifyAuthenticationResponse.ts')
-rw-r--r--packages/server/src/authentication/verifyAuthenticationResponse.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/server/src/authentication/verifyAuthenticationResponse.ts b/packages/server/src/authentication/verifyAuthenticationResponse.ts
index c89d39b..9f52d70 100644
--- a/packages/server/src/authentication/verifyAuthenticationResponse.ts
+++ b/packages/server/src/authentication/verifyAuthenticationResponse.ts
@@ -149,14 +149,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'));
+ const expectedRPIDHash = toHash(uint8Array.fromASCIIString(expectedRPID));
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'));
+ const expectedRPIDHash = toHash(uint8Array.fromASCIIString(expected));
return uint8Array.areEqual(rpIdHash, expectedRPIDHash);
});
@@ -195,7 +195,7 @@ export async function verifyAuthenticationResponse(
}
const clientDataHash = toHash(base64url.toBuffer(response.clientDataJSON));
- const signatureBase = Buffer.concat([authDataBuffer, clientDataHash]);
+ const signatureBase = uint8Array.concat([authDataBuffer, clientDataHash]);
const signature = base64url.toBuffer(response.signature);
@@ -251,7 +251,7 @@ export async function verifyAuthenticationResponse(
export type VerifiedAuthenticationResponse = {
verified: boolean;
authenticationInfo: {
- credentialID: Buffer;
+ credentialID: Uint8Array;
newCounter: number;
userVerified: boolean;
credentialDeviceType: CredentialDeviceType;