Skip to main content

Module account_keychain

Module account_keychain 

Source
Expand description

Account keychain precompile for managing session keys and spending limits.

Each account can authorize secondary keys (session keys) with per-token spending caps, signature type constraints, and expiry. The main key (address zero) retains full control and is the only key allowed to authorize, revoke, or update other keys.

Modules§

IAccountKeychain
Account Keychain interface for managing authorized keys
__packing_authorized_key
dispatch
ABI dispatch for the AccountKeychain precompile.
slots

Structs§

AccountKeychain
AuthorizedKey
Key information stored in the precompile
AuthorizedKeyHandler
Type-safe handler for accessing #struct_name in storage.
KeyInfo
Key information structure
TokenLimit
Token spending limit structure
authorizeKeyCall
Authorize a new key for the caller’s account @param keyId The key identifier (address derived from public key) @param signatureType 0: secp256k1, 1: P256, 2: WebAuthn @param expiry Block timestamp when the key expires (u64::MAX for never expires) @param enforceLimits Whether to enforce spending limits for this key @param limits Initial spending limits for tokens (only used if enforceLimits is true) Function with signature authorizeKey(address,uint8,uint64,bool,(address,uint256)[]) and selector 0x54063a55.
getKeyCall
Get key information @param account The account address @param publicKey The public key @return Key information Function with signature getKey(address,address) and selector 0xbc298553.
getRemainingLimitCall
Get remaining spending limit @param account The account address @param publicKey The public key @param token The token address @return Remaining spending amount Function with signature getRemainingLimit(address,address,address) and selector 0x63b4290d.
getTransactionKeyCall
Get the key used in the current transaction @return The keyId used in the current transaction Function with signature getTransactionKey() and selector 0xb07fbc1a.
revokeKeyCall
Revoke an authorized key @param publicKey The public key to revoke Function with signature revokeKey(address) and selector 0x5ae7ab32.
updateSpendingLimitCall
Update spending limit for a key-token pair @param publicKey The public key @param token The token address @param newLimit The new spending limit Function with signature updateSpendingLimit(address,address,uint256) and selector 0xcbbb4480.

Enums§

SignatureType