summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeClientDataJSON.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/helpers/decodeClientDataJSON.ts')
-rw-r--r--packages/server/src/helpers/decodeClientDataJSON.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/packages/server/src/helpers/decodeClientDataJSON.ts b/packages/server/src/helpers/decodeClientDataJSON.ts
index e0de0a0..645a09f 100644
--- a/packages/server/src/helpers/decodeClientDataJSON.ts
+++ b/packages/server/src/helpers/decodeClientDataJSON.ts
@@ -1,4 +1,4 @@
-import { isoBase64URL } from './iso';
+import { isoBase64URL } from './iso/index.ts';
/**
* Decode an authenticator's base64url-encoded clientDataJSON to JSON
@@ -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,
+};