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.sortMultisigApprovalsOrders native multisig owner approvals into the strictly-ascending recovered-owner order the Tempo node requires for the multisig signatures array (the node enforces "recovered owners must be strictly ascending").
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.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.GetTypeStatically determines the signature type of an envelope at compile time.
SignatureEnvelope.Keychain
SignatureEnvelope.KeychainRpc
SignatureEnvelope.KeychainVersionKeychain signature version.
SignatureEnvelope.MultisigNative multisig signature (type 0x05).
SignatureEnvelope.MultisigRpc
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