Skip to content

Signature.assert

Asserts that a Signature is valid.

Imports

Named
import { Signature } from 'ox'

Examples

import { Signature } from 'ox'
 
Signature.assert({
  r: -49782753348462494199823712700004552394425719014458918871452329774910450607807n,
  s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
  yParity: 1,
})
InvalidSignatureRError:
Value `-549...n` is an invalid r value.
r must be a positive integer less than 2^256.

Definition

function assert(
  signature: ExactPartial<Signature>,
  options?: assert.Options,
): asserts signature is Signature

Source: src/core/Signature.ts

Parameters

signature

  • Type: ExactPartial<Signature>

The signature object to assert.

options

  • Type: assert.Options
  • Optional

options.recovered

  • Type: boolean
  • Optional

Whether or not the signature should be recovered (contain yParity).