MPP.Methods.Tempo.KeyAuthorization (mpp v0.15.0)

Copy Markdown View Source

Tempo subscription key-authorization wire codec and verifier.

The RLP layout and primitive signature envelopes match ox/tempo's KeyAuthorization; subscription scope checks follow the normative Tempo subscription draft.

Summary

Functions

Deserialize and cryptographically verify a signed primitive key authorization.

Decode the object returned by wallet_authorizeAccessKey.

Map a shared subscription period to Tempo's fixed elapsed seconds.

Serialize a key authorization as canonical RLP hex.

Return the decoded RLP field inserted into a Tempo transaction.

Verify that a signed authorization is exactly scoped to a subscription request.

Build the normative wallet_authorizeAccessKey parameter object.

Types

key_type()

@type key_type() :: :secp256k1 | :p256 | :web_authn

t()

@type t() :: %MPP.Methods.Tempo.KeyAuthorization{
  chain_id: non_neg_integer(),
  expiry: pos_integer(),
  field: list(),
  key_id: String.t(),
  key_type: key_type(),
  limits: [map()],
  scopes: [map()],
  signature: binary(),
  source: String.t()
}

Functions

deserialize(serialized)

@spec deserialize(String.t()) :: {:ok, t()} | {:error, String.t()}

Deserialize and cryptographically verify a signed primitive key authorization.

from_rpc(rpc)

@spec from_rpc(map()) :: {:ok, t()} | {:error, String.t()}

Decode the object returned by wallet_authorizeAccessKey.

period_seconds(subscription)

@spec period_seconds(MPP.Intents.Subscription.t()) ::
  {:ok, pos_integer()} | {:error, String.t()}

Map a shared subscription period to Tempo's fixed elapsed seconds.

serialize(key_authorization)

@spec serialize(t()) :: String.t()

Serialize a key authorization as canonical RLP hex.

transaction_field(key_authorization)

@spec transaction_field(t()) :: list()

Return the decoded RLP field inserted into a Tempo transaction.

verify(authorization, subscription, opts)

@spec verify(t(), MPP.Intents.Subscription.t(), keyword()) ::
  :ok | {:error, String.t()}

Verify that a signed authorization is exactly scoped to a subscription request.

wallet_params(subscription, opts)

@spec wallet_params(
  MPP.Intents.Subscription.t(),
  keyword()
) :: {:ok, map()} | {:error, String.t()}

Build the normative wallet_authorizeAccessKey parameter object.