summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/decodeAttestationObject.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-08-17 12:16:28 -0700
committerMatthew Miller <matthew@millerti.me>2023-08-17 12:16:28 -0700
commit1ad27adf827e0dea095748d35740daa9e70ffe10 (patch)
treebfa17fbb9ee0596cfe58b58c076fbb8f1f075c43 /packages/server/src/helpers/decodeAttestationObject.ts
parent82f7b8ae6d9dd47a93c5fd802fac2a3df526f782 (diff)
Refactor verifyRegistrationResponse tests
Diffstat (limited to 'packages/server/src/helpers/decodeAttestationObject.ts')
-rw-r--r--packages/server/src/helpers/decodeAttestationObject.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/server/src/helpers/decodeAttestationObject.ts b/packages/server/src/helpers/decodeAttestationObject.ts
index 8cf036d..ebfe42b 100644
--- a/packages/server/src/helpers/decodeAttestationObject.ts
+++ b/packages/server/src/helpers/decodeAttestationObject.ts
@@ -8,7 +8,9 @@ import { isoCBOR } from "./iso/index.ts";
export function decodeAttestationObject(
attestationObject: Uint8Array,
): AttestationObject {
- return isoCBOR.decodeFirst<AttestationObject>(attestationObject);
+ return _decodeAttestationObjectInternals.stubThis(
+ isoCBOR.decodeFirst<AttestationObject>(attestationObject),
+ );
}
export type AttestationFormat =
@@ -41,3 +43,8 @@ export type AttestationStatement = {
// `Map` properties
readonly size: number;
};
+
+// Make it possible to stub the return value during testing
+export const _decodeAttestationObjectInternals = {
+ stubThis: (value: AttestationObject) => value,
+};