▸ EIP-7702 Integration

What is EIP-7702 EIP-7702 enables temporary delegation for EOAs using signed session keys. It allows users to grant limited execution power to another key (usually browser-generated) without giving away full control.

Session payload format:

{
  "delegateKey": "0x123...",
  "validUntil": 1718000000,
  "scope": {
    "contracts": ["0xExecutor"],
    "methods": ["0x095ea7b3"]
  }
}

Session keys are used to:

  • Sign tasks

  • Execute condition checks

  • Trigger on-chain strategies without wallet prompts

mapping(address => Session) public sessions;

struct Session {
    uint256 validUntil;
    mapping(bytes4 => bool) allowedMethods;
}

function isSessionValid(address sessionKey, bytes4 method) public view returns (bool) {
    return sessions[sessionKey].validUntil > block.timestamp &&
           sessions[sessionKey].allowedMethods[method];
}

Security Model: Temporary Auth & Revocation

  • Sessions are revocable: users can invalidate any key

  • Time-bound to avoid risk of misuse

  • Restricted to specific methods/contracts

Revocation function:

function revokeSession(address key) external onlyOwner {
    delete sessions[key];
}

Last updated