You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(evm-wallet-experiment): drop SES-lockdown workarounds (#938)
Closes#938. Now that vats can request `crypto`, `SubtleCrypto`, and
`Math` via their `globals` allowlist (via #937), drop the workarounds
that existed because `crypto.getRandomValues` and `Math.random` were
unreachable inside vat compartments:
- Drop `entropy?: Hex` from the throwaway `KeyringInitOptions` and its
plumbing through both coordinators, setup scripts, docs, and the
docker e2e helper. The keyring vat now generates the throwaway key
itself via `crypto.getRandomValues`.
- Collapse `makeSaltGenerator` in `lib/delegation.ts` to a crypto-only
implementation; drop the counter fallback and its `entropy` param.
- Endow `crypto` + `SubtleCrypto` in the keyring and delegator vat
globals (delegator imports `delegation.ts`, which evaluates
`generateSalt = makeSaltGenerator()` at load).
- Drop stale "Math.random is blocked under SES lockdown" JSDoc from
`bundler-client.ts` and `provider.ts`; the raw-fetch implementations
are left in place per the issue's speculative/lower-priority note.
- Simplify the `initializeKeyring` option unwrapping in both
coordinators now that the throwaway branch carries no payload.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/evm-wallet-experiment/README.md
+10-13Lines changed: 10 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,6 @@ For a deeper explanation of the components and data flow, see [How It Works](./d
9
9
-**Peer signing has no interactive approval for message/typed-data requests.** Transaction signing over peer requests is now disabled and peer-connected wallets must use delegation redemption for sends, but message and typed-data peer signing still execute immediately without an approval prompt.
10
10
-**`revokeDelegation()` and hybrid redemption require a bundler or peer relay.** Hybrid accounts submit on-chain `disableDelegation` / redemption via ERC-4337 UserOps; configure a bundler (and optional paymaster). **Stateless 7702** accounts use a direct EIP-1559 transaction instead; only the JSON-RPC provider must be configured. **Away wallets without a bundler** relay delegation redemptions to the home wallet via CapTP (requires the home wallet to be online). If the on-chain transaction fails, the local delegation status is not changed.
11
11
-**Mnemonic encryption is optional.** The keyring vat can encrypt the mnemonic at rest using AES-256-GCM with a PBKDF2-derived key. Pass a `password` and `salt` to `initializeKeyring()` to enable encryption. Without a password, the mnemonic is stored in plaintext. When encrypted, the keyring starts in a locked state on daemon restart and must be unlocked with `unlockKeyring(password)` before signing operations work.
12
-
-**Throwaway keyring needs secure entropy.**`initializeKeyring({ type: 'throwaway' })` requires either `crypto.getRandomValues` in the runtime or caller-provided entropy via `{ type: 'throwaway', entropy: '0x...' }`. Under SES lockdown (where `crypto` is unavailable inside vat compartments), the caller must generate 32 bytes of entropy externally and pass it in.
13
12
14
13
## Architecture
15
14
@@ -126,9 +125,7 @@ import { makeWalletClusterConfig } from '@ocap/evm-wallet-experiment';
126
125
// 1. Launch the wallet subcluster with a throwaway keyring
|`bootstrap(vats, services)`| Called by the kernel during subcluster launch. Wires up vat references. |
321
-
|`initializeKeyring(options)`| Initialize the keyring vat. Options: `{ type: 'srp', mnemonic, password?, salt? }` or `{ type: 'throwaway', entropy? }`. Under SES lockdown, pass `entropy` (32-byte hex) for throwaway keys. When `password` is provided for SRP, the mnemonic is encrypted at rest (requires a random `salt` hex string). |
322
-
|`unlockKeyring(password)`| Unlock an encrypted keyring after daemon restart. Required before any signing operations when the mnemonic was encrypted with a password. |
323
-
|`isKeyringLocked()`| Returns `true` if the keyring is encrypted and has not been unlocked yet. |
324
-
|`configureProvider(chainConfig)`| Configure the provider vat with an RPC URL and chain ID. |
325
-
|`connectExternalSigner(signer)`| Connect an external signing backend (e.g., MetaMask). |
|`bootstrap(vats, services)`| Called by the kernel during subcluster launch. Wires up vat references. |
318
+
|`initializeKeyring(options)`| Initialize the keyring vat. Options: `{ type: 'srp', mnemonic, password?, salt? }` or `{ type: 'throwaway' }`. When `password` is provided for SRP, the mnemonic is encrypted at rest (requires a random `salt` hex string). |
319
+
|`unlockKeyring(password)`| Unlock an encrypted keyring after daemon restart. Required before any signing operations when the mnemonic was encrypted with a password. |
320
+
|`isKeyringLocked()`| Returns `true` if the keyring is encrypted and has not been unlocked yet. |
321
+
|`configureProvider(chainConfig)`| Configure the provider vat with an RPC URL and chain ID. |
322
+
|`connectExternalSigner(signer)`| Connect an external signing backend (e.g., MetaMask). |
The away wallet gets a throwaway key (for signing UserOps within delegations). Under SES lockdown, `crypto.getRandomValues` is unavailable in vat compartments, so you must generate entropy externally:
564
+
The away wallet gets a throwaway key (for signing UserOps within delegations):
0 commit comments