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)
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'>,
options?: serialize.Options,
): SerializedSource: src/tempo/SignatureEnvelope.ts
Parameters
envelope
- Type:
UnionPartialBy<SignatureEnvelope, 'prehash'>
The signature envelope to serialize.
options
- Type:
serialize.Options - Optional
options.magic
- Type:
boolean - Optional
Whether to serialize the signature envelope with the Tempo magic identifier. This is useful for being able to distinguish between Tempo and non-Tempo (e.g. ERC-1271) signatures.
Return Type
The hex-encoded serialized signature.
Serialized

