WebAuthnP256.verify
Verifies a signature using the Credential's public key and the challenge which was signed.
Imports
Named
import { WebAuthnP256 } from 'ox'
Examples
import { WebAuthnP256 } from 'ox'
const credential = await WebAuthnP256.createCredential({
name: 'Example',
})
const { metadata, signature } = await WebAuthnP256.sign({
credentialId: credential.id,
challenge: '0xdeadbeef',
})
const result = await WebAuthnP256.verify({
metadata,
challenge: '0xdeadbeef',
publicKey: credential.publicKey,
signature,
})
true
Definition
function verify(
options: verify.Options,
): boolean
Source: src/core/WebAuthnP256.ts
Parameters
options
- Type:
verify.Options
Options.
options.challenge
- Type:
0x${string}
The challenge to verify.
options.hash
- Type:
boolean
- Optional
If set to true
, the payload will be hashed (sha256) before being verified.
options.metadata
- Type:
{ authenticatorData: 0x${string}; challengeIndex: number; clientDataJSON: string; typeIndex: number; userVerificationRequired: boolean; }
The metadata to verify the signature with.
options.publicKey
- Type:
{ prefix: number; x: bigint; y: bigint; }
The public key to verify the signature with.
options.signature
- Type:
{ r: bigint; s: bigint; yParity?: number; }
The signature to verify.
Return Type
Whether the signature is valid.
boolean