From f5110c85b527c25f4d9c426d9efd1f1be4843744 Mon Sep 17 00:00:00 2001 From: Italo Date: Fri, 15 Mar 2024 00:41:12 -0300 Subject: [PATCH] [1.x] Should fix empty credentials detection from authenticator --- src/webpass.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/webpass.ts b/src/webpass.ts index 950ce1d..b9cab7b 100644 --- a/src/webpass.ts +++ b/src/webpass.ts @@ -154,7 +154,7 @@ function webpass(config: Partial = {}): Webpass { // Retrieve the attestation options from the server const attestationOptions: ServerPublicKeyCredentialCreationOptions | undefined = await wfetch(normalizedOptions) - console.debug('Attestation Options Received', attestationOptions) + console.debug("Attestation Options Received", attestationOptions) // If the response is empty, bail out if (!attestationOptions || isObjectEmpty(attestationOptions)) { @@ -165,10 +165,10 @@ function webpass(config: Partial = {}): Webpass { publicKey: parseServerCreationOptions(attestationOptions) }) - console.debug('Attestation Credentials Created', credentials); + console.debug("Attestation Credentials Created", credentials); // If the user denied the permission, throw an error. - if (!credentials || isObjectEmpty(credentials)) { + if (!credentials) { throw newError("AttestationCancelled", "The credentials creation was cancelled by the user or a timeout.") } @@ -176,7 +176,7 @@ function webpass(config: Partial = {}): Webpass { normalizedResponseOptions, parseOutgoingCredentials(credentials) ) - console.debug('Attestation benchmark', bench.stop()) + console.debug("Attestation benchmark", bench.stop()) return result } @@ -232,7 +232,7 @@ function webpass(config: Partial = {}): Webpass { // Get the assertion challenge from the server const assertionOptions: ServerPublicKeyCredentialRequestOptions | undefined = await wfetch(normalizedOptions) - console.debug('Assertion Options Received', assertionOptions) + console.debug("Assertion Options Received", assertionOptions) // If we didn't receive anything, return it as an invalid server message. if (!assertionOptions || isObjectEmpty(assertionOptions)) { @@ -244,7 +244,7 @@ function webpass(config: Partial = {}): Webpass { publicKey: parseServerRequestOptions(assertionOptions) }) - console.debug('Assertion Credentials Retrieved', assertionOptions) + console.debug("Assertion Credentials Retrieved", assertionOptions) // If the user denied the permission, return null if (!credentials) { @@ -256,7 +256,7 @@ function webpass(config: Partial = {}): Webpass { normalizedResponseOptions, parseOutgoingCredentials(credentials) ) - console.debug('Assertion benchmark', bench.stop()) + console.debug("Assertion benchmark", bench.stop()) return result }