Revoke a session
The key lives in sessionStorage so a refresh is free. Any script on the page can read it.
The key and its grant are stored together in sessionStorage, keyed by app, chain and granter. That is why a refresh is free. It is also why any script on the page can read a real key. An XSS hole means an attacker can call play as your user until the grant expires.
withSession is not payable, so a stolen key cannot move value, and it only reaches the selectors the grant named. That bounds the damage. It does not remove it. Scope tightly. Expire sooner if the action is expensive even without value.
Kill every grant this user has signed
import { createInterludeClient, memoryStore } from "@interludelayer-sdk/sdk";
export const interlude = createInterludeClient({ app, abi, node, base, store: memoryStore() });
// Every grant this user has ever signed, for every Interlude app, dead.
await interlude.revokeAll(wallet);revokeAll is a Monad transaction, so the wallet needs a little MON, and it moves the epoch for every Interlude app at once: every node already running, the public demos included, refuses this address’s new grants until that app is delegated again. Try it with a throwaway key, not the wallet you play with.
revokeAll bumps the hub epoch on Monad. Every existing grant names the old one, so the next call on Monad reverts with SessionEpochStaleError. A node that is already serving read the epoch at its pinned block, so on the node a revoked key keeps working until the partition is delegated again (a new epoch). Until then the grant’s expiry is what bounds a stolen key. On Monad the user can sign again at once. On a running node they cannot open a new session until the partition is re-delegated: the node checks new grants against the epoch it pinned. memoryStore() keeps the key in RAM for that tab only: a refresh now prompts, and a script in another tab sees nothing.
There is no localStorage option. A key that outlives the tab is a key nobody remembers granting. Sessions expire in an hour unless you pass a shorter expirySeconds to openSession.
