@aztec-labs/wallet-sdk 6.0.0-nightly.20260829

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +478 -0
  2. package/dest/base-wallet/base_wallet.d.ts +179 -0
  3. package/dest/base-wallet/base_wallet.d.ts.map +1 -0
  4. package/dest/base-wallet/base_wallet.js +503 -0
  5. package/dest/base-wallet/get_gas_limits.d.ts +36 -0
  6. package/dest/base-wallet/get_gas_limits.d.ts.map +1 -0
  7. package/dest/base-wallet/get_gas_limits.js +55 -0
  8. package/dest/base-wallet/index.d.ts +4 -0
  9. package/dest/base-wallet/index.d.ts.map +1 -0
  10. package/dest/base-wallet/index.js +3 -0
  11. package/dest/base-wallet/utils.d.ts +52 -0
  12. package/dest/base-wallet/utils.d.ts.map +1 -0
  13. package/dest/base-wallet/utils.js +137 -0
  14. package/dest/crypto.d.ts +230 -0
  15. package/dest/crypto.d.ts.map +1 -0
  16. package/dest/crypto.js +482 -0
  17. package/dest/emoji_alphabet.d.ts +35 -0
  18. package/dest/emoji_alphabet.d.ts.map +1 -0
  19. package/dest/emoji_alphabet.js +299 -0
  20. package/dest/extension/handlers/background_connection_handler.d.ts +168 -0
  21. package/dest/extension/handlers/background_connection_handler.d.ts.map +1 -0
  22. package/dest/extension/handlers/background_connection_handler.js +294 -0
  23. package/dest/extension/handlers/content_script_connection_handler.d.ts +57 -0
  24. package/dest/extension/handlers/content_script_connection_handler.d.ts.map +1 -0
  25. package/dest/extension/handlers/content_script_connection_handler.js +193 -0
  26. package/dest/extension/handlers/index.d.ts +12 -0
  27. package/dest/extension/handlers/index.d.ts.map +1 -0
  28. package/dest/extension/handlers/index.js +10 -0
  29. package/dest/extension/handlers/internal_message_types.d.ts +65 -0
  30. package/dest/extension/handlers/internal_message_types.d.ts.map +1 -0
  31. package/dest/extension/handlers/internal_message_types.js +24 -0
  32. package/dest/extension/provider/extension_provider.d.ts +107 -0
  33. package/dest/extension/provider/extension_provider.d.ts.map +1 -0
  34. package/dest/extension/provider/extension_provider.js +160 -0
  35. package/dest/extension/provider/extension_wallet.d.ts +152 -0
  36. package/dest/extension/provider/extension_wallet.d.ts.map +1 -0
  37. package/dest/extension/provider/extension_wallet.js +349 -0
  38. package/dest/extension/provider/index.d.ts +3 -0
  39. package/dest/extension/provider/index.d.ts.map +1 -0
  40. package/dest/extension/provider/index.js +2 -0
  41. package/dest/iframe/handlers/iframe_connection_handler.d.ts +122 -0
  42. package/dest/iframe/handlers/iframe_connection_handler.d.ts.map +1 -0
  43. package/dest/iframe/handlers/iframe_connection_handler.js +239 -0
  44. package/dest/iframe/handlers/index.d.ts +2 -0
  45. package/dest/iframe/handlers/index.d.ts.map +1 -0
  46. package/dest/iframe/handlers/index.js +1 -0
  47. package/dest/iframe/provider/iframe_discovery.d.ts +25 -0
  48. package/dest/iframe/provider/iframe_discovery.d.ts.map +1 -0
  49. package/dest/iframe/provider/iframe_discovery.js +167 -0
  50. package/dest/iframe/provider/iframe_provider.d.ts +65 -0
  51. package/dest/iframe/provider/iframe_provider.d.ts.map +1 -0
  52. package/dest/iframe/provider/iframe_provider.js +257 -0
  53. package/dest/iframe/provider/iframe_wallet.d.ts +85 -0
  54. package/dest/iframe/provider/iframe_wallet.d.ts.map +1 -0
  55. package/dest/iframe/provider/iframe_wallet.js +269 -0
  56. package/dest/iframe/provider/index.d.ts +4 -0
  57. package/dest/iframe/provider/index.d.ts.map +1 -0
  58. package/dest/iframe/provider/index.js +3 -0
  59. package/dest/manager/index.d.ts +3 -0
  60. package/dest/manager/index.d.ts.map +1 -0
  61. package/dest/manager/index.js +1 -0
  62. package/dest/manager/types.d.ts +168 -0
  63. package/dest/manager/types.d.ts.map +1 -0
  64. package/dest/manager/types.js +19 -0
  65. package/dest/manager/wallet_manager.d.ts +70 -0
  66. package/dest/manager/wallet_manager.d.ts.map +1 -0
  67. package/dest/manager/wallet_manager.js +256 -0
  68. package/dest/types.d.ts +185 -0
  69. package/dest/types.d.ts.map +1 -0
  70. package/dest/types.js +40 -0
  71. package/package.json +109 -0
  72. package/src/base-wallet/base_wallet.ts +665 -0
  73. package/src/base-wallet/get_gas_limits.ts +88 -0
  74. package/src/base-wallet/index.ts +8 -0
  75. package/src/base-wallet/utils.ts +248 -0
  76. package/src/crypto.ts +603 -0
  77. package/src/emoji_alphabet.ts +317 -0
  78. package/src/extension/handlers/background_connection_handler.ts +456 -0
  79. package/src/extension/handlers/content_script_connection_handler.ts +264 -0
  80. package/src/extension/handlers/index.ts +25 -0
  81. package/src/extension/handlers/internal_message_types.ts +71 -0
  82. package/src/extension/provider/extension_provider.ts +233 -0
  83. package/src/extension/provider/extension_wallet.ts +410 -0
  84. package/src/extension/provider/index.ts +7 -0
  85. package/src/iframe/handlers/iframe_connection_handler.ts +341 -0
  86. package/src/iframe/handlers/index.ts +7 -0
  87. package/src/iframe/provider/iframe_discovery.ts +185 -0
  88. package/src/iframe/provider/iframe_provider.ts +331 -0
  89. package/src/iframe/provider/iframe_wallet.ts +323 -0
  90. package/src/iframe/provider/index.ts +3 -0
  91. package/src/manager/index.ts +12 -0
  92. package/src/manager/types.ts +178 -0
  93. package/src/manager/wallet_manager.ts +291 -0
  94. package/src/types.ts +204 -0
package/README.md ADDED
@@ -0,0 +1,478 @@
1
+ # Wallet SDK Integration Guide for Third-Party Wallet Developers
2
+
3
+ This guide explains how to integrate your wallet with the Aztec Wallet SDK, enabling dApps to discover and interact with your wallet implementation.
4
+
5
+ ## Available Types
6
+
7
+ All types and utilities needed for wallet integration are exported from `@aztec-labs/wallet-sdk/types`:
8
+
9
+ ```typescript
10
+ import type {
11
+ DiscoveryRequest,
12
+ DiscoveryResponse,
13
+ KeyExchangeRequest,
14
+ KeyExchangeResponse,
15
+ WalletInfo,
16
+ WalletMessage,
17
+ WalletResponse,
18
+ } from '@aztec-labs/wallet-sdk/types';
19
+ ```
20
+
21
+ Cryptographic utilities for secure channel establishment are exported from `@aztec-labs/wallet-sdk/crypto`:
22
+
23
+ ```typescript
24
+ import type { EncryptedPayload, ExportedPublicKey } from '@aztec-labs/wallet-sdk/crypto';
25
+ import {
26
+ decrypt,
27
+ deriveSessionKeys,
28
+ encrypt,
29
+ exportPublicKey,
30
+ generateKeyPair,
31
+ hashToEmoji,
32
+ importPublicKey,
33
+ } from '@aztec-labs/wallet-sdk/crypto';
34
+ ```
35
+
36
+ **For extension wallets**, pre-built connection handlers are available:
37
+
38
+ ```typescript
39
+ import {
40
+ BackgroundConnectionHandler,
41
+ ContentScriptConnectionHandler,
42
+ } from '@aztec-labs/wallet-sdk/extension/handlers';
43
+ ```
44
+
45
+ ## Overview
46
+
47
+ The Wallet SDK uses a **two-phase connection model** with **end-to-end encryption**:
48
+
49
+ ### Phase 1: Discovery
50
+
51
+ 1. **dApp broadcasts** a discovery request with chain information (NO public keys)
52
+ 2. **Your wallet shows** a pending connection request to the user
53
+ 3. **User approves** the connection request
54
+ 4. **Your wallet responds** with basic wallet info and a MessagePort
55
+
56
+ ### Phase 2: Secure Channel Establishment
57
+
58
+ 5. **dApp initiates key exchange** by sending its ECDH public key over the MessagePort
59
+ 6. **Wallet generates** ephemeral key pair and derives session keys using HKDF
60
+ 7. **Both parties compute** the same verification hash independently
61
+ 8. **User verifies** the has matches on both sides. A util for conversion to an emoji grid is provided
62
+ 9. **User confirms** the connection in the dApp
63
+ 10. **All subsequent communication** is encrypted using AES-256-GCM
64
+
65
+ ### Key Security Features
66
+
67
+ - **User approval required**: Wallet never reveals itself without explicit user consent
68
+ - **Ephemeral keys**: New key pairs generated for each session
69
+ - **Anti-MITM verification**: 3x3 emoji grid (72 bits of security) for visual confirmation
70
+
71
+ ## Architecture for Extension Wallets
72
+
73
+ ```
74
+ ┌─────────────┐ window.postMessage ┌─────────────────┐ browser.runtime ┌──────────────────┐
75
+ │ dApp │◄──(discovery + port)────►│ Content Script │◄────────────────────►│ Background Script│
76
+ │ (web page) │ │ (message relay)│ │ (crypto+state) │
77
+ └─────────────┘ └─────────────────┘ └──────────────────┘
78
+ │ │
79
+ │ MessagePort │
80
+ └──────────(key exchange + encrypted)──────┘
81
+ ```
82
+
83
+ **Security model:**
84
+
85
+ - The MessagePort is transferred via `window.postMessage` - other scripts on the page could intercept it
86
+ - **Security comes from encryption**: After key exchange, all communication is AES-256-GCM encrypted
87
+ - Content script never has access to private keys or session secrets
88
+ - All cryptographic operations happen in the background script (service worker)
89
+ - Anti-MITM verification (emoji grid) ensures both parties derived the same keys
90
+
91
+ ## Using Pre-built Connection Handlers
92
+
93
+ The SDK provides `BackgroundConnectionHandler` and `ContentScriptConnectionHandler` to handle the connection flow. These are the recommended way to build extension wallets.
94
+
95
+ ### Background Script Setup
96
+
97
+ ```typescript
98
+ import {
99
+ BackgroundConnectionHandler,
100
+ type BackgroundConnectionConfig,
101
+ type BackgroundConnectionCallbacks,
102
+ type BackgroundTransport,
103
+ } from '@aztec-labs/wallet-sdk/extension/handlers';
104
+ import { hashToEmoji } from '@aztec-labs/wallet-sdk/crypto';
105
+
106
+ // Configuration for your wallet
107
+ const config: BackgroundConnectionConfig = {
108
+ walletId: 'my-aztec-wallet',
109
+ walletName: 'My Aztec Wallet',
110
+ walletVersion: '1.0.0',
111
+ walletIcon: 'https://example.com/icon.png',
112
+ };
113
+
114
+ // Transport for browser extension APIs
115
+ const transport: BackgroundTransport = {
116
+ sendToTab: (tabId, message) => browser.tabs.sendMessage(tabId, message),
117
+ addContentListener: (handler) => browser.runtime.onMessage.addListener(handler),
118
+ };
119
+
120
+ // Event callbacks (all optional)
121
+ const callbacks: BackgroundConnectionCallbacks = {
122
+ // Called when a new discovery request is received
123
+ onPendingDiscovery: (discovery) => {
124
+ // Show pending connection in wallet UI
125
+ // Check if wallet supports this network (chainId AND version)
126
+ const supported = supportedNetworks.some(
127
+ n => n.chainId === discovery.chainInfo.chainId.toString() &&
128
+ n.version === discovery.chainInfo.version.toString()
129
+ );
130
+ if (supported) {
131
+ // Show the user so they can approve or reject
132
+ }
133
+ },
134
+
135
+ // Called when key exchange completes and session is ready
136
+ onSessionEstablished: (session) => {
137
+ // Display verification emojis for user reference
138
+ console.log('Session emojis:', hashToEmoji(session.verificationHash));
139
+ },
140
+
141
+ // Called when a session is terminated
142
+ onSessionTerminated: (requestId) => {
143
+ console.log('Session terminated:', requestId);
144
+ },
145
+
146
+ // Called when a decrypted wallet message is received
147
+ onWalletMessage: (session, message) => {
148
+ // Forward to your wallet backend
149
+ wallet.postMessage(message);
150
+ },
151
+ };
152
+
153
+ const handler = new BackgroundConnectionHandler(config, transport, callbacks);
154
+
155
+ // Initialize the handler to start listening
156
+ handler.initialize();
157
+
158
+ // User approves connection from wallet UI
159
+ function approveConnection(requestId: string) {
160
+ handler.approveDiscovery(requestId);
161
+ }
162
+
163
+ // User denies connection
164
+ function denyConnection(requestId: string) {
165
+ handler.rejectDiscovery(requestId);
166
+ }
167
+
168
+ // Send response back to dApp
169
+ async function sendWalletResponse(requestId: string, response: WalletResponse) {
170
+ await handler.sendResponse(requestId, response);
171
+ }
172
+
173
+ // Clean up on tab close/navigate
174
+ browser.tabs.onRemoved.addListener((tabId) => {
175
+ handler.terminateForTab(tabId);
176
+ });
177
+ ```
178
+
179
+ ### Content Script Setup
180
+
181
+ ```typescript
182
+ import {
183
+ ContentScriptConnectionHandler,
184
+ type ContentScriptTransport,
185
+ } from '@aztec-labs/wallet-sdk/extension/handlers';
186
+
187
+ const transport: ContentScriptTransport = {
188
+ sendToBackground: (message) => browser.runtime.sendMessage(message),
189
+ addBackgroundListener: (handler) => browser.runtime.onMessage.addListener(handler),
190
+ };
191
+
192
+ const handler = new ContentScriptConnectionHandler(transport);
193
+
194
+ // Start listening for discovery requests and background messages
195
+ handler.start();
196
+ ```
197
+
198
+ ## Testing Your Integration (dApp Side)
199
+
200
+ The `WalletManager` supports two patterns for consuming discovered wallets.
201
+
202
+ ### Async Iterator Pattern
203
+
204
+ ```typescript
205
+ import { Fr } from '@aztec-labs/foundation/fields';
206
+ import { WalletManager } from '@aztec-labs/wallet-sdk/manager';
207
+ import { hashToEmoji } from '@aztec-labs/wallet-sdk/crypto';
208
+
209
+ const discovery = WalletManager.configure({
210
+ extensions: { enabled: true },
211
+ }).getAvailableWallets({
212
+ chainInfo: {
213
+ chainId: new Fr(31337),
214
+ version: new Fr(1),
215
+ },
216
+ appId: 'my-dapp',
217
+ timeout: 60000,
218
+ });
219
+
220
+ // Iterate over discovered wallets as they're approved
221
+ for await (const provider of discovery.wallets) {
222
+ console.log(`Found: ${provider.name}`);
223
+
224
+ // Establish secure channel (key exchange)
225
+ const pending = await provider.establishSecureChannel('my-dapp');
226
+
227
+ // Display verification emojis to user
228
+ const emojis = hashToEmoji(pending.verificationHash);
229
+ console.log('Verify this matches your wallet:', emojis);
230
+
231
+ // User confirms emojis match
232
+ const wallet = await pending.confirm();
233
+
234
+ // All calls are now encrypted
235
+ const accounts = await wallet.getAccounts();
236
+ console.log('Accounts:', accounts);
237
+ }
238
+
239
+ // Cancel discovery when done or on cleanup
240
+ discovery.cancel();
241
+ ```
242
+
243
+ ### Callback Pattern
244
+
245
+ ```typescript
246
+ import { Fr } from '@aztec-labs/foundation/fields';
247
+ import { WalletManager, type WalletProvider } from '@aztec-labs/wallet-sdk/manager';
248
+ import { hashToEmoji } from '@aztec-labs/wallet-sdk/crypto';
249
+
250
+ const discoveredProviders: WalletProvider[] = [];
251
+
252
+ const discovery = WalletManager.configure({
253
+ extensions: { enabled: true },
254
+ }).getAvailableWallets({
255
+ chainInfo: {
256
+ chainId: new Fr(31337),
257
+ version: new Fr(1),
258
+ },
259
+ appId: 'my-dapp',
260
+ timeout: 60000,
261
+ // Callback fires as each wallet is discovered
262
+ onWalletDiscovered: (provider) => {
263
+ discoveredProviders.push(provider);
264
+ updateUI(); // Your UI update function
265
+ },
266
+ });
267
+
268
+ // Wait for discovery to complete (or cancel early with discovery.cancel())
269
+ await discovery.done;
270
+ console.log('Discovery complete, found:', discoveredProviders.length);
271
+
272
+ // Connect to a selected provider
273
+ async function connectToWallet(provider: WalletProvider) {
274
+ const pending = await provider.establishSecureChannel('my-dapp');
275
+
276
+ // Show verification UI
277
+ const emojis = hashToEmoji(pending.verificationHash);
278
+ showVerificationDialog(emojis);
279
+
280
+ // User confirms
281
+ const wallet = await pending.confirm();
282
+ return wallet;
283
+ }
284
+ ```
285
+
286
+ ### React Hook Example
287
+
288
+ ```typescript
289
+ function useWalletDiscovery(chainInfo: ChainInfo, appId: string) {
290
+ const [providers, setProviders] = useState<WalletProvider[]>([]);
291
+ const [isDiscovering, setIsDiscovering] = useState(true);
292
+ const discoveryRef = useRef<DiscoverySession | null>(null);
293
+
294
+ useEffect(() => {
295
+ setProviders([]);
296
+ setIsDiscovering(true);
297
+
298
+ const discovery = WalletManager.configure({
299
+ extensions: { enabled: true },
300
+ }).getAvailableWallets({
301
+ chainInfo,
302
+ appId,
303
+ timeout: 60000,
304
+ onWalletDiscovered: (provider) => {
305
+ setProviders(prev => [...prev, provider]);
306
+ },
307
+ });
308
+
309
+ discoveryRef.current = discovery;
310
+
311
+ discovery.done.then(() => setIsDiscovering(false));
312
+
313
+ return () => {
314
+ discovery.cancel();
315
+ discoveryRef.current = null;
316
+ };
317
+ }, [chainInfo.chainId.toString(), chainInfo.version.toString(), appId]);
318
+
319
+ return { providers, isDiscovering, cancel: () => discoveryRef.current?.cancel() };
320
+ }
321
+ ```
322
+
323
+ ## Credentialed node RPC
324
+
325
+ When an embedded wallet connects to a cross-origin node that uses session cookies, opt in to browser credentials through the node client options:
326
+
327
+ ```typescript
328
+ import { EmbeddedWallet } from '@aztec-labs/wallets/embedded';
329
+
330
+ const wallet = await EmbeddedWallet.create('https://rpc.example.com', {
331
+ nodeClientOptions: {
332
+ fetchOptions: { credentials: 'include' },
333
+ maxBatchSize: 50,
334
+ },
335
+ });
336
+ ```
337
+
338
+ Node.js does not manage cookies automatically. Applications that need affinity there can inject any asynchronous cookie jar, including a `tough-cookie` jar installed by the application:
339
+
340
+ ```typescript
341
+ import { Agent, makeUndiciFetch } from '@aztec-labs/foundation/json-rpc/undici';
342
+ import { EmbeddedWallet } from '@aztec-labs/wallets/embedded';
343
+ import { CookieJar } from 'tough-cookie';
344
+
345
+ const wallet = await EmbeddedWallet.create('https://rpc.example.com', {
346
+ nodeClientOptions: {
347
+ fetch: makeUndiciFetch(new Agent(), new CookieJar()),
348
+ maxBatchSize: 50,
349
+ },
350
+ });
351
+ ```
352
+
353
+ Cookie storage is optional.
354
+
355
+ ## Storage backends
356
+
357
+ Your wallet and the PXE it embeds persist state through a pluggable key-value store (`@aztec-labs/kv-store`). In the browser there are two backends:
358
+
359
+ - **IndexedDB** (`@aztec-labs/kv-store/deprecated/indexeddb`): the default in browser environments up to Aztec Alpha v4, now moved to a deprecated subpath. We plan to remove this backend, so new browser code should use the SQLite backend below.
360
+ - **SQLite-OPFS** (`@aztec-labs/kv-store/sqlite-opfs`): the default KV store backend from Aztec Alpha v5 on. It's backed by the durable Origin Private File System web standard, and it offers a number of advantages over IndexedDB: a sane transaction model (IDB transactions auto-close the moment the event loop yields, which constrains the store layer), support for encryption at rest, and better performance in the access patterns we exercise the most from both wallet and PXE.
361
+
362
+ The backend is chosen by *which store you construct and hand to the wallet* there is no runtime flag or environment variable.
363
+
364
+ > **Data migration is not supported between backends, by design.** The v4→v5 protocol upgrade discards all local state regardless, so switching to SQLite-OPFS simply means starting from a fresh store.
365
+
366
+ ### Quick start: embedded wallet with an encrypted SQLite store
367
+
368
+ If you build on `@aztec-labs/wallets`' `EmbeddedWallet`, open its two stores (PXE state + the wallet DB) with `openEncryptedEmbeddedStores`, then pass them in:
369
+
370
+ ```typescript
371
+ import { EmbeddedWallet } from '@aztec-labs/wallets/embedded';
372
+ import { openEncryptedEmbeddedStores } from '@aztec-labs/wallets/embedded/store-encryption';
373
+ import { createLogger } from '@aztec-labs/foundation/log';
374
+
375
+ const log = createLogger('wallet:storage');
376
+
377
+ // Your wallet derives a 32-byte key (see "Key management" below).
378
+ // IMPORTANT: return a *fresh* Uint8Array each call. Opening a store consumes (empties)
379
+ // the key, so a reused array would be empty on the second open (see "important" below).
380
+ const getEncryptionKey = async () => new Uint8Array(myDerivedKey);
381
+
382
+ const { pxeStore, walletStore } = await openEncryptedEmbeddedStores(
383
+ {
384
+ pxe: { name: `pxe-${rollupAddress}`, poolDirectory: '/pxe' },
385
+ wallet: { name: `wallet-${rollupAddress}`, poolDirectory: '/wallet' },
386
+ },
387
+ getEncryptionKey,
388
+ log,
389
+ );
390
+
391
+ const wallet = await EmbeddedWallet.create(nodeUrl, {
392
+ pxe: { store: pxeStore },
393
+ walletDb: { store: walletStore },
394
+ });
395
+ ```
396
+
397
+ If the supplied key cannot decrypt an existing store, `openEncryptedEmbeddedStores` throws `EmbeddedWalletEncryptionError` with `storeName: 'pxe' | 'wallet'`, which you can then surface as a "wrong password" error in your UI:
398
+
399
+ ```typescript
400
+ import { EmbeddedWalletEncryptionError } from '@aztec-labs/wallets/embedded/store-encryption';
401
+
402
+ try {
403
+ await openEncryptedEmbeddedStores(/* ... */);
404
+ } catch (err) {
405
+ if (err instanceof EmbeddedWalletEncryptionError) {
406
+ showWrongPasswordError(); // err.storeName tells you which store failed
407
+ } else {
408
+ throw err;
409
+ }
410
+ }
411
+ ```
412
+
413
+ ### Important
414
+
415
+ 1. **Opening a store consumes the key, it does not copy it.** So that raw key material does not linger in page memory, the SDK moves your key into the storage worker and detaches the buffer on your side. The `Uint8Array` you passed comes back empty, so the same array cannot be reused to open a second store. To open more than one store with the same key, hand each open a fresh copy (`new Uint8Array(key)`). `openEncryptedEmbeddedStores` does this for you by invoking your `getEncryptionKey` callback once per store.
416
+ 2. **Each coexisting store needs its own `poolDirectory`.** The OPFS SAH Pool holds an *exclusive* lock on its directory, so two stores sharing the default pool fail with "Access Handles cannot be created if there is another open Access Handle…". Give every store a distinct, stable `poolDirectory` (stable so the same files re-open next session).
417
+
418
+ ### No multi-tab access: assume one tab at a time
419
+
420
+ A store can be opened by **one browser tab at a time per origin**. If the user opens your wallet in a second tab of the same origin pointing at the same store, the second open contends for that lock.
421
+
422
+ Thanks to the lock, the data is never corrupted, but the second open fails or hangs rather than succeeding, and there is no graceful "already open elsewhere" signal yet.
423
+
424
+ Until it does, design for a single active tab: detect a second instance (e.g. with the [Web Locks API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API) or a `BroadcastChannel`) and steer the user back to the existing tab, or open the store read-only there.
425
+
426
+ If you need genuine concurrent multi-tab access, route all storage access through a single `SharedWorker` that you own and that holds the one connection.
427
+
428
+ ### Opting out of encryption
429
+
430
+ If you do not need at-rest encryption (you rely on full-disk encryption, or the device is trusted), an *unencrypted* SQLite-OPFS store is still a better default than IndexedDB.
431
+
432
+ The `createStore` convenience helper always uses the default OPFS pool directory and does not currently let you change it, so it only works for a single store per tab. The embedded wallet runs two stores (PXE + walletDB), so open them directly from `AztecSQLiteOPFSStore` with a distinct `poolDirectory` each:
433
+
434
+ ```typescript
435
+ import { EmbeddedWallet } from '@aztec-labs/wallets/embedded';
436
+ import { AztecSQLiteOPFSStore } from '@aztec-labs/kv-store/sqlite-opfs';
437
+ import { createLogger } from '@aztec-labs/foundation/log';
438
+
439
+ const log = createLogger('wallet:storage');
440
+
441
+ // No key; just name, ephemeral=false, and a distinct poolDirectory per store.
442
+ const pxeStore = await AztecSQLiteOPFSStore.open(log, `pxe-${rollupAddress}`, false, '/pxe');
443
+ const walletStore = await AztecSQLiteOPFSStore.open(log, `wallet-${rollupAddress}`, false, '/wallet');
444
+
445
+ const wallet = await EmbeddedWallet.create(nodeUrl, {
446
+ pxe: { store: pxeStore },
447
+ walletDb: { store: walletStore },
448
+ });
449
+ ```
450
+
451
+ ### Building your own wallet (lower-level API)
452
+
453
+ If you are not using `EmbeddedWallet`, construct stores directly from `@aztec-labs/kv-store/sqlite-opfs` and pass them wherever a store is accepted (e.g. `PXECreationOptions.store`):
454
+
455
+ ```typescript
456
+ import { openEncryptedStore, createStore, SqliteEncryptionError } from '@aztec-labs/kv-store/sqlite-opfs';
457
+
458
+ // Encrypted, persistent:
459
+ const store = await openEncryptedStore(new Uint8Array(myDerivedKey), 'my-store', '/my-pool');
460
+
461
+ // Or unencrypted:
462
+ const plain = await createStore('my-store', { dataStoreMapSizeKb: 2e10 });
463
+ ```
464
+
465
+ Note: `dataStoreMapSizeKb` is an LMDB-specific ceiling (the maximum memory-map size). SQLite-OPFS grows its file dynamically and ignores the value, but it is a required field of the shared `DataStoreConfig` type, so you must still pass something (any number is fine). We will fix this implementation leak in coming versions.
466
+
467
+ Note: `openEncryptedStore` throws `SqliteEncryptionError` (with a typed `code`, e.g. `'decrypt_failed'`) on a bad key.
468
+
469
+ ### Using SQLite-OPFS in a browser extension (MV3)
470
+
471
+ SQLite-OPFS needs OPFS, a Web Worker, and cross-origin isolation (SharedArrayBuffer). In a Chrome MV3 extension:
472
+
473
+ - **Run it in an offscreen document, not the background service worker.** The service worker is ephemeral and does not reliably provide OPFS/SharedArrayBuffer; an offscreen document does, and it is where your PXE and stores should live.
474
+ - **No COOP/COEP header setup is needed inside the extension.** Extension pages are cross-origin-isolated by default. (A plain web page hosting the wallet *does* need those headers.)
475
+
476
+ ### Key management is your responsibility
477
+
478
+ The store encrypts data at rest given a 32-byte key, but deriving and safeguarding that key is the wallet's job. A common pattern is to derive the key from a user password with a memory-hard KDF (e.g. Argon2id) and hold it only in memory while the wallet is unlocked. Adapt this to your own security model.
@@ -0,0 +1,179 @@
1
+ import type { Account, NoFrom } from '@aztec-labs/aztec.js/account';
2
+ import type { CallIntent, IntentInnerHash } from '@aztec-labs/aztec.js/authorization';
3
+ import { type InteractionWaitOptions, type SendReturn } from '@aztec-labs/aztec.js/contracts';
4
+ import type { FeePaymentMethod } from '@aztec-labs/aztec.js/fee';
5
+ import { type Aliased, type AppCapabilities, type BatchResults, type BatchedMethod, ContractInitializationStatus, type ExecuteUtilityOptions, type PrivateEvent, type PrivateEventFilter, type ProfileOptions, type SendOptions, type SimulateOptions, TxSimulationResultWithAppOffset, type Wallet, type WalletCapabilities } from '@aztec-labs/aztec.js/wallet';
6
+ import { AccountFeePaymentMethodOptions } from '@aztec-labs/entrypoints/account';
7
+ import type { ChainInfo } from '@aztec-labs/entrypoints/interfaces';
8
+ import { Fr } from '@aztec-labs/foundation/curves/bn254';
9
+ import type { FieldsOf } from '@aztec-labs/foundation/types';
10
+ import type { PXE } from '@aztec-labs/pxe/server';
11
+ import { type ContractArtifact, type EventMetadataDefinition, type FunctionCall } from '@aztec-labs/stdlib/abi';
12
+ import type { AuthWitness } from '@aztec-labs/stdlib/auth-witness';
13
+ import { AztecAddress } from '@aztec-labs/stdlib/aztec-address';
14
+ import { type ContractInstancePreimage } from '@aztec-labs/stdlib/contract';
15
+ import { Gas, GasFees, GasSettings, ManaUsageEstimate } from '@aztec-labs/stdlib/gas';
16
+ import type { AztecNode } from '@aztec-labs/stdlib/interfaces/client';
17
+ import { type MasterSecretKeys } from '@aztec-labs/stdlib/keys';
18
+ import { ExecutionPayload, type TxExecutionRequest, type TxProfileResult, type UtilityExecutionResult } from '@aztec-labs/stdlib/tx';
19
+ /**
20
+ * Options to configure fee payment for a transaction
21
+ */
22
+ export type FeeOptions = {
23
+ /**
24
+ * A wallet-provided fallback fee payment method that is used only if the transaction that is being constructed
25
+ * doesn't already include one
26
+ */
27
+ walletFeePaymentMethod?: FeePaymentMethod;
28
+ /** Configuration options for the account to properly handle the selected fee payment method */
29
+ accountFeePaymentMethodOptions?: AccountFeePaymentMethodOptions;
30
+ /** The gas settings to use for the transaction */
31
+ gasSettings: GasSettings;
32
+ };
33
+ /** Options for `simulateViaEntrypoint`. */
34
+ export type SimulateViaEntrypointOptions = Pick<SimulateOptions, 'from' | 'additionalScopes' | 'skipTxValidation' | 'skipFeeEnforcement' | 'sendMessagesAs' | 'overrides'> & {
35
+ /** Fee options for the entrypoint */
36
+ feeOptions: FeeOptions;
37
+ };
38
+ /** Options for `completeFeeOptions`. */
39
+ export type CompleteFeeOptionsConfig = {
40
+ /** The address where the transaction is being sent from. */
41
+ from: AztecAddress | NoFrom;
42
+ /** The address paying for fees (if any fee payment method is embedded in the execution payload). */
43
+ feePayer?: AztecAddress;
44
+ /** User-provided partial gas settings. */
45
+ gasSettings?: Partial<FieldsOf<GasSettings>>;
46
+ /** If true, returns gas settings with high gas limits for estimation. If false, uses fallback limits. */
47
+ forEstimation?: boolean;
48
+ /**
49
+ * Assumed network congestion level for fee prediction. Controls how aggressively the wallet
50
+ * estimates future fees. Defaults to Limit (worst case) when not specified.
51
+ */
52
+ congestionEstimate?: ManaUsageEstimate;
53
+ };
54
+ /**
55
+ * A base class for Wallet implementations
56
+ */
57
+ export declare abstract class BaseWallet implements Wallet {
58
+ protected readonly pxe: PXE;
59
+ protected readonly aztecNode: AztecNode;
60
+ protected log: import("@aztec-labs/foundation/log").Logger;
61
+ protected minFeePadding: number;
62
+ protected cancellableTransactions: boolean;
63
+ protected defaultWaitInterval?: number;
64
+ private nodeInfoPromise;
65
+ protected constructor(pxe: PXE, aztecNode: AztecNode, log?: import("@aztec-labs/foundation/log").Logger);
66
+ protected scopesFrom(from: AztecAddress | NoFrom, additionalScopes: AztecAddress[], sendMessagesAs: AztecAddress | undefined): AztecAddress[];
67
+ /**
68
+ * Picks the sender address PXE should tag private messages with. Returns `undefined` when there is no signing
69
+ * account (`from === NO_FROM`) and no explicit override; in that case any private log emitted by the tx using
70
+ * the wallet-supplied default sender will fail the "Sender for tags is not set" assertion.
71
+ * @param from - Tx sender, or `NO_FROM`.
72
+ * @param sendMessagesAs - Explicit override.
73
+ */
74
+ protected senderForTagsFrom(from: AztecAddress | NoFrom, sendMessagesAs?: AztecAddress): AztecAddress | undefined;
75
+ protected abstract getAccountFromAddress(address: AztecAddress): Promise<Account>;
76
+ abstract getAccounts(): Promise<Aliased<AztecAddress>[]>;
77
+ /**
78
+ * Returns the list of aliased contacts associated with the wallet.
79
+ * This base implementation directly returns PXE's senders, but note that in general contacts are a superset of senders.
80
+ * - Senders: Addresses we check during synching in case they sent us notes,
81
+ * - Contacts: more general concept akin to a phone's contact list.
82
+ * @returns The aliased collection of AztecAddresses that form this wallet's address book
83
+ */
84
+ getAddressBook(): Promise<Aliased<AztecAddress>[]>;
85
+ /**
86
+ * Fetches and caches the node info for the wallet's lifetime, since a wallet talks to a single network and
87
+ * node info never changes. A rejected fetch clears the cache so the next call retries instead of replaying
88
+ * the cached rejection forever — important because the gas-limit fill-in and validation (run on every send)
89
+ * depend on it.
90
+ */
91
+ private getNodeInfo;
92
+ getChainInfo(): Promise<ChainInfo>;
93
+ /**
94
+ * Returns the maximum gas limits a single transaction may declare on this wallet's network (the
95
+ * node-advertised `txsLimits.gas`). Internal helper used to fill in default gas limits when sending a
96
+ * transaction without explicit limits, and to validate caller-provided limits before sending. Backed by
97
+ * the cached node info, since a wallet talks to a single network.
98
+ */
99
+ protected getMaxTxGasLimits(): Promise<Gas>;
100
+ protected createTxExecutionRequestFromPayloadAndFee(executionPayload: ExecutionPayload, from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<TxExecutionRequest>;
101
+ createAuthWit(from: AztecAddress, messageHashOrIntent: IntentInnerHash | CallIntent): Promise<AuthWitness>;
102
+ /**
103
+ * Request capabilities from the wallet.
104
+ *
105
+ * This method is wallet-implementation-dependent and must be provided by classes extending BaseWallet.
106
+ * Embedded wallets typically don't support capability-based authorization (no user authorization flow),
107
+ * while external wallets (browser extensions, hardware wallets) implement this to reduce authorization
108
+ * friction by allowing apps to request permissions upfront.
109
+ *
110
+ * TODO: Consider making it abstract so implementing it is a conscious decision. Leaving it as-is
111
+ * while the feature stabilizes.
112
+ *
113
+ * @param _manifest - Application capability manifest declaring what operations the app needs
114
+ */
115
+ requestCapabilities(_manifest: AppCapabilities): Promise<WalletCapabilities>;
116
+ batch<const T extends readonly BatchedMethod[]>(methods: T): Promise<BatchResults<T>>;
117
+ /**
118
+ * Completes partial user-provided fee options with wallet defaults.
119
+ * @param config - Fee completion config.
120
+ */
121
+ protected completeFeeOptions(config: CompleteFeeOptionsConfig): Promise<FeeOptions>;
122
+ /**
123
+ * Returns the worst-case min fee across predicted future slots.
124
+ * Falls back to getCurrentMinFees if the node doesn't support getPredictedMinFees.
125
+ * @param estimate - The mana usage estimate to use for fee prediction. Defaults to Limit for conservative estimation.
126
+ */
127
+ protected getMinFees(estimate?: ManaUsageEstimate): Promise<GasFees>;
128
+ registerSender(address: AztecAddress, _alias?: string): Promise<AztecAddress>;
129
+ registerContract(instance: ContractInstancePreimage, artifact?: ContractArtifact, secretKeyOrKeys?: Fr | MasterSecretKeys): Promise<void>;
130
+ registerContractClass(artifact: ContractArtifact): Promise<void>;
131
+ /**
132
+ * Simulates calls through the standard PXE path (account entrypoint).
133
+ * @param executionPayload - The execution payload to simulate.
134
+ * @param opts - Simulation options.
135
+ */
136
+ protected simulateViaEntrypoint(executionPayload: ExecutionPayload, opts: SimulateViaEntrypointOptions): Promise<TxSimulationResultWithAppOffset>;
137
+ /**
138
+ * Computes the index where the app's calls begin in the flattened array of calls (0 = entrypoint/root, 1..N = fee
139
+ * calls, N+1 = app).
140
+ * @param from - The sender address, or NO_FROM for the default entrypoint.
141
+ * @param feeOptions - Fee options containing the wallet fee payment method.
142
+ */
143
+ protected computeAppCallOffset(from: AztecAddress | NoFrom, feeOptions: FeeOptions): Promise<number>;
144
+ /**
145
+ * Simulates a transaction, optimizing leading public static calls by running them directly
146
+ * on the node while sending the remaining calls through the standard PXE path.
147
+ * Return values from both paths are merged back in original call order.
148
+ * @param executionPayload - The execution payload to simulate.
149
+ * @param opts - Simulation options (from address, fee settings, etc.).
150
+ * @returns The merged simulation result.
151
+ */
152
+ simulateTx(executionPayload: ExecutionPayload, opts: SimulateOptions): Promise<TxSimulationResultWithAppOffset>;
153
+ profileTx(executionPayload: ExecutionPayload, opts: ProfileOptions): Promise<TxProfileResult>;
154
+ sendTx<W extends InteractionWaitOptions = undefined>(executionPayload: ExecutionPayload, opts: SendOptions<W>): Promise<SendReturn<W>>;
155
+ /**
156
+ * Resolves a contract address to a human-readable name via PXE, if available.
157
+ * @param address - The contract address to resolve.
158
+ */
159
+ protected getContractName(address: AztecAddress): Promise<string | undefined>;
160
+ protected contextualizeError(err: Error, ...context: string[]): Error;
161
+ executeUtility(call: FunctionCall, opts: ExecuteUtilityOptions): Promise<UtilityExecutionResult>;
162
+ getPrivateEvents<T>(eventDef: EventMetadataDefinition, eventFilter: PrivateEventFilter): Promise<PrivateEvent<T>[]>;
163
+ /**
164
+ * Returns metadata about a contract, including whether it has been initialized, published, and updated.
165
+ * @param address - The contract address to query.
166
+ */
167
+ getContractMetadata(address: AztecAddress): Promise<{
168
+ instance: import("@aztec-labs/stdlib/contract").ContractInstancePreimageWithAddress | undefined;
169
+ initializationStatus: ContractInitializationStatus;
170
+ isContractPublished: boolean;
171
+ isContractUpdated: boolean;
172
+ updatedContractClassId: Fr | undefined;
173
+ }>;
174
+ getContractClassMetadata(id: Fr): Promise<{
175
+ isArtifactRegistered: boolean;
176
+ isContractClassPubliclyRegistered: boolean;
177
+ }>;
178
+ }
179
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZV93YWxsZXQuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXNlLXdhbGxldC9iYXNlX3dhbGxldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sOEJBQThCLENBQUM7QUFFcEUsT0FBTyxLQUFLLEVBQUUsVUFBVSxFQUFFLGVBQWUsRUFBRSxNQUFNLG9DQUFvQyxDQUFDO0FBQ3RGLE9BQU8sRUFFTCxLQUFLLHNCQUFzQixFQUUzQixLQUFLLFVBQVUsRUFHaEIsTUFBTSxnQ0FBZ0MsQ0FBQztBQUN4QyxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBRWpFLE9BQU8sRUFDTCxLQUFLLE9BQU8sRUFDWix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