Skip to content

Secp256k1.recoverPublicKey

Recovers the signing public key from the signed payload and signature.

Imports

Named
import { Secp256k1 } from 'ox'

Examples

import { Secp256k1 } from 'ox'
 
const signature = Secp256k1.sign({ payload: '0xdeadbeef', privateKey: '0x...' })
 
const publicKey = Secp256k1.recoverPublicKey({ 
  payload: '0xdeadbeef', 
  signature, 
})

Definition

function recoverPublicKey(
  options: recoverPublicKey.Options,
): PublicKey.PublicKey

Source: src/core/Secp256k1.ts

Parameters

options

  • Type: recoverPublicKey.Options

The recovery options.

options.payload

  • Type: 0x${string} | Uint8Array

Payload that was signed.

options.signature

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

Signature of the payload.

Return Type

The recovered public key.

PublicKey.PublicKey