Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/webpass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ function webpass(config: Partial<Config> = {}): Webpass {
const normalizedOptions = normalizeOptions(options, currentConfig, "attestOptions")
const normalizedResponseOptions = normalizeOptions(response, currentConfig, "attest")

console.debug("Attestation Options Sending", normalizedOptions)

// Retrieve the attestation options from the server
const attestationOptions: ServerPublicKeyCredentialCreationOptions | undefined = await wfetch<ServerPublicKeyCredentialCreationOptions | undefined>(normalizedOptions)

Expand All @@ -105,8 +107,12 @@ function webpass(config: Partial<Config> = {}): Webpass {

console.debug("Attestation Credentials Created", credentials);

console.debug("Attestation Response Sending", normalizedResponseOptions)

const result = await wfetch<Record<string, any>>(normalizedResponseOptions, credentials)

console.debug("Attestation Response Received", result)

console.debug("Attestation benchmark", bench.stop())

return result
Expand Down Expand Up @@ -160,6 +166,8 @@ function webpass(config: Partial<Config> = {}): Webpass {
const normalizedOptions = normalizeOptions(options, currentConfig, "assertOptions")
const normalizedResponseOptions = normalizeOptions(response, currentConfig, "assert")

console.debug("Assertion Options Sending", normalizedOptions)

// Get the assertion challenge from the server
const assertionOptions: ServerPublicKeyCredentialRequestOptions | undefined = await wfetch<ServerPublicKeyCredentialRequestOptions | undefined>(normalizedOptions)

Expand All @@ -183,9 +191,13 @@ function webpass(config: Partial<Config> = {}): Webpass {

console.debug("Assertion Credentials Retrieved", credentials)

console.debug("Assertion Response Sending", normalizedResponseOptions)

// Expect an authentication response from the server with the user, credentials, or anything.
const result = await wfetch<Record<string, string>>(normalizedResponseOptions, credentials)

console.debug("Assertion Response Received", result)

console.debug("Assertion benchmark", bench.stop())

return result
Expand Down