feat: Add destination address scoping to Access Keys
Summary
Add the ability to restrict Access Keys to specific destination addresses, enabling more granular permission scoping.
Context
Currently, Access Keys support two configuration options:
- Spending limits - per-TIP20 token spending amounts
- Expiry - Block timestamp when the key becomes invalid
Users have requested the ability to bind Access Keys to specific destinations (e.g., "only allow transactions to Uniswap"). This would bring Access Keys closer to Solana's delegate primitive while offering more flexibility.
Proposal
Phase 1: Address Scoping (target: next hardfork)
Add an allowed addresses list to authorizeKey() - restrict the key to only call specific contract addresses.
This is relatively straightforward to implement and provides significant value for common use cases.
Phase 2: Function Selector Scoping (future consideration)
Allow restricting keys to specific function selectors (4-byte selectors). This adds more complexity and should be deferred until we have stronger user validation for the use case.
Use Cases
- DeFi integrations: Allow a trading bot key to only interact with specific DEX contracts
- Gaming: Scope a session key to only interact with a game contract
- Subscription services: Allow a key to only call a specific payment contract
Current Workaround
Deploy a proxy contract that enforces the destination restrictions. This adds gas overhead and complexity.
References
- AccountKeychain docs
-
IAccountKeychain.sol