Skip to content

SignatureEnvelope.extractAddress

Extracts the address of the signer from a SignatureEnvelope.SignatureEnvelope.

  • secp256k1: Recovers the address from the payload via ecrecover. - p256 / webAuthn: Derives the address from the embedded public key. - keychain: Extracts from the inner signature (or returns userAddress if user is true).

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 address = SignatureEnvelope.extractAddress({ 
  payload, 
  signature: envelope, 
})

Definition

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

Source: src/tempo/SignatureEnvelope.ts

Parameters

options

  • Type: extractAddress.Options

The extraction options.

options.payload

  • Type: 0x${string} | Uint8Array

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

options.root

  • Type: boolean
  • Optional

Whether to return the root userAddress for keychain signatures instead of extracting from the inner signature.

options.signature

  • Type: SignatureEnvelope

The signature envelope.

Return Type

The signer address.

extractAddress.ReturnType