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.extractAddressExtracts the address of the signer from a SignatureEnvelope.SignatureEnvelope.
SignatureEnvelope.extractPublicKeyExtracts the public key of the signer from a SignatureEnvelope.SignatureEnvelope.
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.sortApprovalsSorts primitive owner approvals by recovered address.
SignatureEnvelope.toRpcConverts a signature envelope to RPC format.
SignatureEnvelope.validateValidates a signature envelope. Returns true if the envelope is valid, false otherwise.
SignatureEnvelope.verifyVerifies a signature envelope against a digest/payload.

Errors

NameDescription
SignatureEnvelope.CoercionErrorError thrown when a signature envelope cannot be coerced to a valid type.
SignatureEnvelope.InvalidApprovalErrorError thrown when a configurable account owner approval is invalid.
SignatureEnvelope.InvalidSerializedErrorError thrown when a serialized signature envelope cannot be deserialized.
SignatureEnvelope.MissingPropertiesErrorError thrown when a signature envelope is missing required properties.
SignatureEnvelope.VerificationErrorError thrown when a signature envelope fails to verify.

Types

NameDescription
SignatureEnvelope.ConfigurableConfigurable account signature (type 0x05).
SignatureEnvelope.ConfigurableRpcRLP-encoded [account, config, signatures], without the 0x05 type byte.
SignatureEnvelope.GetTypeStatically determines the signature type of an envelope at compile time.
SignatureEnvelope.Keychain
SignatureEnvelope.KeychainRpc
SignatureEnvelope.KeychainVersionKeychain signature version.
SignatureEnvelope.P256
SignatureEnvelope.P256Rpc
SignatureEnvelope.PrimitivePrimitive signature envelope accepted by protocol sidecars.
SignatureEnvelope.PrimitiveRpcRPC-formatted primitive signature envelope.
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