Skip to content

FrameSignature.validate

Returns whether a FrameSignature.FrameSignature is structurally valid.

Performs the same checks as FrameSignature.assert, returning false instead of throwing. Does not verify that the signature authorizes a payload.

Imports

Named
import { FrameSignature } from 'ox'

Examples

Basic Usage

Require a signature when checking a protocol entry.

import { FrameSignature } from 'ox'
 
const entry = FrameSignature.from({ scheme: 'secp256k1' })
const valid = FrameSignature.validate(entry, {
  signed: true
})
false

Definition

function validate(
  entry: FrameSignature,
  options?: assert.Options,
): boolean

Source: src/core/FrameSignature.ts

Parameters

entry

  • Type: FrameSignature

The signature entry to validate.

entry.payload

  • Type: 0x${string}
  • Optional

Explicit nonzero digest. Omit or use empty bytes for the transaction signing hash.

entry.publicKey

  • Type: { prefix: number; x: bigint; y: bigint; }
  • Optional

Public key, if already known. Empty wire signatures do not retain it.

entry.scheme

  • Type: 2 | "p256"

P-256 verification scheme.

entry.signature

  • Type: 0x${string} | { r: bigint; s: bigint; yParity?: number; }

P-256 signature or Signature.toHex bytes.

entry.signer

  • Type: Address.Address | undefined
  • Optional

Signer address. Omit to use the transaction sender.

options

  • Type: assert.Options
  • Optional

Validation options.

options.signed

  • Type: boolean
  • Optional

Require a protocol signature. Does not perform cryptographic verification.

Return Type

Whether the entry is structurally valid.

boolean