Skip to content

SignatureEnvelope.extractPublicKey

Extracts the public key of the signer from a SignatureEnvelope.SignatureEnvelope.

  • secp256k1: Recovers the public key from the payload via ecrecover. - p256 / webAuthn: Returns the embedded public key. - keychain: Extracts from the inner signature.

Imports

Named
import { SignatureEnvelope } from 'ox/tempo'

Examples

import { Secp256k1 } from 'ox'
import { SignatureEnvelope } from 'ox/tempo'
 
const payload = '0xdeadbeef'
const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
const envelope = SignatureEnvelope.from(signature)
 
const publicKey = SignatureEnvelope.extractPublicKey({ 
  payload, 
  signature: envelope, 
})

Definition

function extractPublicKey(
  options: extractPublicKey.Options,
): extractPublicKey.ReturnType

Source: src/tempo/SignatureEnvelope.ts

Parameters

options

  • Type: extractPublicKey.Options

The extraction options.

options.payload

  • Type: 0x${string} | Uint8Array

The sign payload that was signed (only required for secp256k1 signatures).

options.signature

  • Type: SignatureEnvelope

The signature envelope.

Return Type

The signer's public key.

extractPublicKey.ReturnType