Introduction
Session keys are cryptographically signed keys generated by a user’s master key (passkey, ECDSA, or multisig). Smart Sessions enables session keys to be created and used with all major smart account implementations (via ERC-7579) and is fully compatible with Rhinestone’s Warp transaction infrastructure. Examples of the onchain permissions that can be tailored with Smart Sessions include:- Interacting only with a specific DeFi protocol (Aave or Uniswap)
- Spending limits on ERC20s or ETH
- Timeframes for expiry after a pre-determined period
- Combining permissions (e.g., Uniswap-only, 1000 USDC limit, 3-day expiry)
- Skipping confirmations: Store a session key locally for “one-click trading,” allowing seamless decentralized application (dapp) interactions without repeated signing prompts.
- Automating transactions: Users share a scoped key for server-side execution, enabling:
- Subscription payments
- Limit orders or stop orders
- Auto-repaying loans to prevent liquidation
- This granular control enhances security, streamlines dapp interactions, and makes Web3 more user-friendly.
How it works
Smart Sessions is built around three concepts: owners (who can sign), permissions (what they can do), and policies (under what conditions).Owners
Smart Sessions support a wide range of signing mechanisms out of the box:- Single ECDSA key
- Multiple ECDSA keys (i.e. multisig)
- Passkeys
Permissions
Permissions define what calls a session is allowed to make. A permission is defined by an ABI and a target address, and lists the functions on that contract the session can call. The SDK derives selectors and parameter offsets from the ABI and checks parameter value types against ABI input types. When defining multiple permissions within a session, a transaction that matches any specified permission is considered valid. If no permissions are specified, any transaction will pass.When using smart contracts directly, you need to explicitly provide a list of valid permissions.
Policies
Policies let you restrict the session to hit specific conditions. You can define policies at the session (affects the entire session) or function (affects a single function within a permission) level. Supported policies include:- Sudo: allows any transaction
- Call: allows transactions with the specified calldata
- Spending limit: allows a limited value of ERC20 tokens to be transferred and approved
- Timeframe: allows transactions within the specified time frame
- Usage limit: allows a limited number of transactions
- Value limit: allows a limited ETH value transferred
Policies work like a logical AND. If a function has two policies, the transaction must pass both policies to be valid.
Usage
Installing the validation
You can install the validator during account deployment:Creating Sessions
To create a session, useRhinestoneSDK.createSession:
Configuring session signing
Smart Sessions control ERC-1271 signatures separately from transaction permissions. Setsigning on createSession to choose a mode:
- Disabled (
{ mode: 'disabled' }): The session cannot sign messages or typed data. - Unrestricted (
{ mode: 'unrestricted' }): The session can sign any message or typed data. - Scoped (
{ mode: 'scoped', allowedContents: [...] }): The session can sign only EIP-712 typed data matching an allowed domain and primary-type schema. Plain messages and arbitrary hashes are not allowed.
signing, the SDK uses unrestricted signing with no validity window. This is identical to explicitly setting { mode: 'unrestricted' }, preserving existing session identities and behavior. Disable signing unless your session needs ERC-1271 signatures.
Both unrestricted and scoped signing accept optional validAfter and validUntil dates. One window applies to the entire signing capability. With neither bound, the SDK selects the unrestricted policy. If you provide either bound, it selects the time-frame policy.
Unrestricted, time-boxed signing
This session can sign any message or typed data for one hour:Scoped Permit2 typed data
This session allows the Permit2PermitSingle domain and schema. Provide the human-readable EIP-712 domain, types, and primaryType; the SDK derives the domain separator and canonical type encoding.
Cross-chain permits
UsecrossChainPermits to scope which routes, tokens, amounts, and recipients it may bridge:
Installing sessions
To enable a session:Checking session status
To check if a session is enabled:Using sessions
To authorize a transaction with a session key you’ve enabled before:You can also enable and use the smart session in one transaction using the “enable mode”.
Disabling a session
To disable a single enabled session, usedisableSession. This only removes a single session: to uninstall the validator entirely (and every session with it), use disable instead.
Security
Smart Sessions is a powerful tool that unlocks a bunch of new opportunities and use cases. To keep your users secure when using sessions, follow these guidelines:- Store the session key securely. Depending on the use case, you can opt to store it in the browser or on your backend. Consider key management solutions like KMS or Lit Protocol.
- Stick to the principle of least privilege: do not request more actions than you need.
- Guard your smart session with granular policies (e.g., restrict the amount of ETH that can be transacted through the session)
- If possible, timebox your session (e.g., make it valid for only 1 week)