ZoneRpcAuthentication
Zone RPC authentication token utilities for private zone RPC access.
Zone RPC authentication tokens are short-lived, read-only credentials used in
the X-Authorization-Token header when talking to private zone RPC endpoints.
They reuse Tempo's multi-signature model, so secp256k1, P256, WebAuthn, and
keychain access-key signatures all share the same wire format as Tempo
transaction signatures.
Examples
import { Secp256k1 } from 'ox'
import { ZoneRpcAuthentication } from 'ox/tempo'
const authentication = ZoneRpcAuthentication.from({
chainId: 4217000026,
expiresAt: 1711235160,
issuedAt: 1711234560,
zoneId: 26,
zonePortal: 'tempox0x0f1b0cedd7e8226e39ecb161f522c8b1ac45e9c8',
})
const signature = Secp256k1.sign({
payload: ZoneRpcAuthentication.getSignPayload(authentication),
privateKey: '0x...',
})
const token = ZoneRpcAuthentication.serialize(authentication, { signature })Functions
| Name | Description |
|---|---|
ZoneRpcAuthentication.deserialize | Parses a serialized Zone RPC authentication token. |
ZoneRpcAuthentication.from | Instantiates a typed Zone RPC authentication token. |
ZoneRpcAuthentication.getFields | Returns the 29-byte fixed field suffix for a Zone RPC authentication token. |
ZoneRpcAuthentication.getSignPayload | Computes the sign payload for a Zone RPC authentication token. |
ZoneRpcAuthentication.hash | Computes the raw authorization hash for a Zone RPC authentication token. |
ZoneRpcAuthentication.serialize | Serializes a Zone RPC authentication token to hex. |
Errors
| Name | Description |
|---|---|
ZoneRpcAuthentication.InvalidSerializedError | Error thrown when a serialized authentication token cannot be deserialized. |
ZoneRpcAuthentication.MissingSignatureError | Error thrown when serializing an authentication token without a signature. |
Types
| Name | Description |
|---|---|
ZoneRpcAuthentication.Fields | 29-byte fixed Zone RPC authentication field suffix. |
ZoneRpcAuthentication.Input | Input type for a Zone RPC authentication token. |
ZoneRpcAuthentication.Serialized | Hex-encoded serialized Zone RPC authentication token. |
ZoneRpcAuthentication.Signed | Signed Zone RPC authentication token. |
ZoneRpcAuthentication.Version | Current Zone RPC authentication version. |
ZoneRpcAuthentication.ZoneRpcAuthentication | Root type for a Tempo Zone RPC authentication token. |

