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§
- IAccount
Keychain - Account Keychain interface for managing authorized keys
- __
packing_ authorized_ key - dispatch
- ABI dispatch for the
AccountKeychainprecompile. - slots
Structs§
- Account
Keychain - Authorized
Key - Key information stored in the precompile
- Authorized
KeyHandler - Type-safe handler for accessing
#struct_namein storage. - KeyInfo
- Key information structure
- Token
Limit - Token spending limit structure
- authorize
KeyCall - 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 selector0x54063a55. - getKey
Call - Get key information
@param account The account address
@param publicKey The public key
@return Key information
Function with signature
getKey(address,address)and selector0xbc298553. - getRemaining
Limit Call - 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 selector0x63b4290d. - getTransaction
KeyCall - Get the key used in the current transaction
@return The keyId used in the current transaction
Function with signature
getTransactionKey()and selector0xb07fbc1a. - revoke
KeyCall - Revoke an authorized key
@param publicKey The public key to revoke
Function with signature
revokeKey(address)and selector0x5ae7ab32. - update
Spending Limit Call - 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 selector0xcbbb4480.