Skip to content

SignatureEnvelope

Signature envelope utilities for secp256k1, P256, WebAuthn, and keychain signatures.

Tempo transactions support multiple signature types: secp256k1 (65 bytes), P256 for passkeys (type 0x01), WebAuthn (type 0x02), and Keychain for access keys (type 0x03).

Signature Types Specification

Examples

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

Functions

NameDescription
SignatureEnvelope.assertAsserts that a SignatureEnvelope.SignatureEnvelope is valid.
SignatureEnvelope.deserializeDeserializes a hex-encoded signature envelope into a typed signature object.
SignatureEnvelope.fromCoerces a value to a signature envelope.
SignatureEnvelope.fromRpcConverts an RPC-formatted signature envelope to a typed signature envelope.
SignatureEnvelope.getTypeDetermines the signature type of an envelope.
SignatureEnvelope.serializeSerializes a signature envelope to a hex-encoded string.
SignatureEnvelope.toRpcConverts a signature envelope to RPC format.
SignatureEnvelope.validateValidates a signature envelope. Returns true if the envelope is valid, false otherwise.

Errors

NameDescription
SignatureEnvelope.CoercionErrorError thrown when a signature envelope cannot be coerced to a valid type.
SignatureEnvelope.InvalidSerializedErrorError thrown when a serialized signature envelope cannot be deserialized.
SignatureEnvelope.MissingPropertiesErrorError thrown when a signature envelope is missing required properties.

Types

NameDescription
SignatureEnvelope.GetTypeStatically determines the signature type of an envelope at compile time.
SignatureEnvelope.Keychain
SignatureEnvelope.KeychainRpc
SignatureEnvelope.P256
SignatureEnvelope.P256Rpc
SignatureEnvelope.Secp256k1
SignatureEnvelope.Secp256k1Flat
SignatureEnvelope.Secp256k1Rpc
SignatureEnvelope.SerializedHex-encoded serialized signature envelope.
SignatureEnvelope.SignatureEnvelopeRepresents a signature envelope that can contain different signature types.
SignatureEnvelope.SignatureEnvelopeRpcRPC-formatted signature envelope.
SignatureEnvelope.TypeUnion type of supported signature types.
SignatureEnvelope.WebAuthn
SignatureEnvelope.WebAuthnRpc