WebAuthnP256.getClientDataJSON
Constructs the Client Data in stringified JSON format which represents client data that was passed to credentials.get()
in WebAuthnP256.sign
.
Imports
Named
import { WebAuthnP256 } from 'ox'
Examples
import { WebAuthnP256 } from 'ox'
const clientDataJSON = WebAuthnP256.getClientDataJSON({
challenge: '0xdeadbeef',
origin: 'https://example.com',
})
"{"type":"webauthn.get","challenge":"3q2-7w","origin":"https://example.com","crossOrigin":false}"
Definition
function getClientDataJSON(
options: getClientDataJSON.Options,
): string
Source: src/core/WebAuthnP256.ts
Parameters
options
- Type:
getClientDataJSON.Options
Options to construct the client data.
options.challenge
- Type:
0x${string}
The challenge to sign.
options.crossOrigin
- Type:
boolean
- Optional
If set to true
, it means that the calling context is an <iframe>
that is not same origin with its ancestor frames.
options.extraClientData
- Type:
Record
- Optional
Additional client data to include in the client data JSON.
options.origin
- Type:
string
- Optional
The fully qualified origin of the relying party which has been given by the client/browser to the authenticator.
Return Type
The client data.
string