From 461e8d63a8660dfd4aca816081f2be5c17ffe9e5 Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Tue, 17 Jan 2023 13:34:29 -0800 Subject: [PATCH] Commit test fixes that were missing from the published version commit. --- src/webauthn-json/extended.spec.ts | 7 +++++++ src/webauthn-json/extended/api.ts | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/webauthn-json/extended.spec.ts b/src/webauthn-json/extended.spec.ts index 0cac9328..dc8520dc 100644 --- a/src/webauthn-json/extended.spec.ts +++ b/src/webauthn-json/extended.spec.ts @@ -13,6 +13,10 @@ import { import { convert } from "./convert"; import "./arraybuffer.jest"; +const unimplemented: any = () => { + throw new Error("unimplemented"); +}; + describe("extended schema", () => { test("converts CredentialCreationOptionsExtendedJSON", () => { const cco: CredentialCreationOptionsExtendedJSON = { @@ -63,6 +67,9 @@ describe("extended schema", () => { response: { clientDataJSON: new Uint8Array([9, 10, 11, 12]), attestationObject: new Uint8Array([13, 14, 15, 16]), + getAuthenticatorData: unimplemented, + getPublicKey: unimplemented, + getPublicKeyAlgorithm: unimplemented, getTransports: () => ["usb"], } as AuthenticatorAttestationResponse, getClientExtensionResults: () => diff --git a/src/webauthn-json/extended/api.ts b/src/webauthn-json/extended/api.ts index 6081766c..3616774a 100644 --- a/src/webauthn-json/extended/api.ts +++ b/src/webauthn-json/extended/api.ts @@ -4,7 +4,10 @@ import { Base64urlString, } from "../base64url"; import { convert } from "../convert"; -import { AuthenticatorAttestationResponseJSON } from "../basic/json"; +import { + AuthenticatorAttestationResponseJSON, + PublicKeyCredentialWithClientExtensionResults, +} from "../basic/json"; import { CredentialCreationOptionsExtendedJSON, CredentialRequestOptionsExtendedJSON, @@ -33,7 +36,7 @@ export function createExtendedRequestFromJSON( } export function createExtendedResponseToJSON( - credential: PublicKeyCredential, + credential: PublicKeyCredentialWithClientExtensionResults, ): PublicKeyCredentialWithAttestationExtendedResultsJSON { return convert( bufferToBase64url, @@ -113,7 +116,7 @@ export function getExtendedRequestFromJSON( } export function getExtendedResponseToJSON( - credential: PublicKeyCredential, + credential: PublicKeyCredentialWithClientExtensionResults, ): PublicKeyCredentialWithAssertionExtendedResultsJSON { return convert( bufferToBase64url,