zone.signAuthorizationToken
Signs a zone authorization token and stores it for the zone HTTP transport. The token is used to authenticate all subsequent zone RPC requests via the X-Authorization-Token header.
Usage
import { client } from './zones.config'
const result = await client.zone.signAuthorizationToken()
console.log('Token:', result.token)
Token: 0x...import { privateKeyToAccount } from 'viem/accounts'
import { createClient, http, Zone } from 'viem/tempo'
export const client = createClient({
account: privateKeyToAccount('0x...'),
chain: Zone.a,
transport: http(),
})Return Type
type ReturnType = {
authentication: Authentication
token: string
}The signed authentication object and the serialized token string.
Parameters
account (optional)
- Type:
Account
Account to sign the authorization token with. Defaults to the client's account.
chain (optional)
- Type:
Chain
Zone chain to sign the token for. Defaults to the client's chain.
expiresAt (optional)
- Type:
number
Unix timestamp when the token expires.
issuedAt (optional)
- Type:
number
Unix timestamp when the token was issued.
store (optional)
- Type:
Store.Store
Store used to persist the signed token. Defaults to
Store.defaultStore.