Skip to content

KeyAuthorization.fromRpc

Converts an AuthorizationTempo.Rpc to an AuthorizationTempo.AuthorizationTempo.

Imports

Named
import { KeyAuthorization } from 'ox/tempo'

Examples

import { KeyAuthorization } from 'ox/tempo'
 
const keyAuthorization = KeyAuthorization.fromRpc({
  chainId: '0x1079',
  expiry: '0x174876e800',
  keyId: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
  keyType: 'secp256k1',
  limits: [{ token: '0x20c0000000000000000000000000000000000001', limit: '0xf4240' }],
  signature: {
    type: 'secp256k1',
    r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
    s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
    yParity: '0x0'
  },
})

Definition

function fromRpc(
  authorization: Rpc,
): Signed

Source: src/tempo/KeyAuthorization.ts

Parameters

authorization

  • Type: Rpc

The RPC-formatted Key Authorization.

authorization.allowedCalls

  • Type: readonly RpcCallScope[]
  • Optional

Allowed call scopes (node field: allowedCalls).

authorization.chainId

  • Type: 0x${string}

Chain ID (hex quantity).

authorization.expiry

  • Type: 0x${string}

Expiry timestamp (hex quantity or null).

authorization.keyId

  • Type: abitype_Address

Key identifier.

authorization.keyType

  • Type: "secp256k1" | "p256" | "webAuthn"

Key type.

authorization.limits

  • Type: readonly RpcTokenLimit[]
  • Optional

Token spending limits.

authorization.signature

  • Type: SignatureEnvelopeRpc

Signature envelope.

Return Type

A signed AuthorizationTempo.AuthorizationTempo.

Signed