Skip to content

WebCryptoP256.verify

Verifies a payload was signed by the provided public key.

Imports

Named
import { WebCryptoP256 } from 'ox'

Examples

import { WebCryptoP256 } from 'ox'
 
const { privateKey, publicKey } = await WebCryptoP256.createKeyPair()
const signature = await WebCryptoP256.sign({ payload: '0xdeadbeef', privateKey })
 
const verified = await WebCryptoP256.verify({ 
  payload: '0xdeadbeef', 
  publicKey, 
  signature, 
})
true

Definition

function verify(
  options: verify.Options,
): Promise<boolean>

Source: src/core/WebCryptoP256.ts

Parameters

options

  • Type: verify.Options

The verification options.

options.payload

  • Type: 0x${string} | Uint8Array

Payload that was signed.

options.publicKey

  • Type: { prefix: number; x: bigint; y: bigint; } | { prefix: number; x: bigint; y?: undefined; }

Public key that signed the payload.

options.signature

  • Type: { r: bigint; s: bigint; yParity?: number; }

Signature of the payload.

Return Type

Whether the payload was signed by the provided public key.

Promise<boolean>