summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeClientDataJSON.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-08-17 10:31:48 -0700
committerMatthew Miller <matthew@millerti.me>2023-08-17 10:31:48 -0700
commit82f7b8ae6d9dd47a93c5fd802fac2a3df526f782 (patch)
tree0e9946c5da75b9bb95f2b41fd6d4bfa48c1f24fd /packages/server/src/helpers/decodeClientDataJSON.ts
parent429a42c9d12332b9723caafcff7d2424c97e3d5e (diff)
Update verifyAuthenticationResponse tests
Diffstat (limited to 'packages/server/src/helpers/decodeClientDataJSON.ts')
-rw-r--r--packages/server/src/helpers/decodeClientDataJSON.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/server/src/helpers/decodeClientDataJSON.ts b/packages/server/src/helpers/decodeClientDataJSON.ts
index bb878dc..fa09181 100644
--- a/packages/server/src/helpers/decodeClientDataJSON.ts
+++ b/packages/server/src/helpers/decodeClientDataJSON.ts
@@ -7,7 +7,7 @@ export function decodeClientDataJSON(data: string): ClientDataJSON {
const toString = isoBase64URL.toString(data);
const clientData: ClientDataJSON = JSON.parse(toString);
- return clientData;
+ return _decodeClientDataJSONInternals.stubThis(clientData);
}
export type ClientDataJSON = {
@@ -20,3 +20,8 @@ export type ClientDataJSON = {
status: "present" | "supported" | "not-supported";
};
};
+
+// Make it possible to stub the return value during testing
+export const _decodeClientDataJSONInternals = {
+ stubThis: (value: ClientDataJSON) => value,
+};