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 } from 'viem/tempo'
import { http, zoneModerato } from 'viem/tempo/zones'
export const client = createClient({
account: privateKeyToAccount('0x...'),
chain: zoneModerato(7),
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.
storage (optional)
- Type:
Storage
Storage instance to persist the signed token. Defaults to Storage.defaultStorage().