Skip to content

SignatureEnvelope.serialize

Serializes a signature envelope to a hex-encoded string.

Wire format: - secp256k1: 65 bytes (no type prefix, for backward compatibility) - P256: 0x01 + r (32) + s (32) + pubKeyX (32) + pubKeyY (32) + prehash (1) = 130 bytes - WebAuthn: 0x02 + webauthnData (variable) + r (32) + s (32) + pubKeyX (32) + pubKeyY (32) - Keychain: 0x03 + userAddress (20) + inner signature (recursive)

Signature Types

Imports

Named
import { SignatureEnvelope } from 'ox/tempo'

Examples

import { SignatureEnvelope } from 'ox/tempo'
 
const serialized = SignatureEnvelope.serialize({
  signature: { r: 0n, s: 0n, yParity: 0 },
  type: 'secp256k1',
})

Definition

function serialize(
  envelope: UnionPartialBy<SignatureEnvelope, 'prehash'>,
): Serialized

Source: src/tempo/SignatureEnvelope.ts

Parameters

envelope

  • Type: UnionPartialBy<SignatureEnvelope, 'prehash'>

The signature envelope to serialize.

Return Type

The hex-encoded serialized signature.

Serialized