summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeClientDataJSON.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-06-05 17:56:47 -0700
committerMatthew Miller <matthew@millerti.me>2020-06-05 17:58:26 -0700
commit328dc36408c2d3d1eac4829bd4cee6a6b573af99 (patch)
tree1a84ff11b1186ce6c788f2979740adf36dd5c172 /packages/server/src/helpers/decodeClientDataJSON.ts
parent506d1a5beb91ad5e65b30e10cb056d74bc49298c (diff)
Use base64url to decode clientDataJSON
Diffstat (limited to 'packages/server/src/helpers/decodeClientDataJSON.ts')
-rw-r--r--packages/server/src/helpers/decodeClientDataJSON.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/server/src/helpers/decodeClientDataJSON.ts b/packages/server/src/helpers/decodeClientDataJSON.ts
index 7c09b0d..52bbf4c 100644
--- a/packages/server/src/helpers/decodeClientDataJSON.ts
+++ b/packages/server/src/helpers/decodeClientDataJSON.ts
@@ -7,9 +7,9 @@ export default function decodeClientDataJSON(data: string): ClientDataJSON {
const toString = base64url.decode(data);
const clientData: ClientDataJSON = JSON.parse(toString);
- // `challenge` will be Base64URL-encoded here. Decode it for easier comparisons with what is provided
- // as the expected value
- clientData.challenge = Buffer.from(clientData.challenge, 'base64').toString('ascii');
+ // `challenge` will be Base64URL-encoded here. Decode it for easier comparisons with what is
+ // provided as the expected value
+ clientData.challenge = base64url.decode(clientData.challenge);
return clientData;
}