@aztec/wallet-sdk 0.0.1-commit.d1f2d6c → 0.0.1-commit.d431d1c
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.
- package/README.md +294 -217
- package/dest/base-wallet/base_wallet.d.ts +4 -4
- package/dest/base-wallet/base_wallet.d.ts.map +1 -1
- package/dest/base-wallet/base_wallet.js +4 -9
- package/dest/crypto.d.ts +50 -59
- package/dest/crypto.d.ts.map +1 -1
- package/dest/crypto.js +108 -202
- package/dest/manager/index.d.ts +8 -2
- package/dest/manager/index.d.ts.map +1 -1
- package/dest/manager/index.js +6 -0
- package/dest/manager/types.d.ts +6 -88
- package/dest/manager/types.d.ts.map +1 -1
- package/dest/manager/types.js +1 -17
- package/dest/manager/wallet_manager.d.ts +7 -50
- package/dest/manager/wallet_manager.d.ts.map +1 -1
- package/dest/manager/wallet_manager.js +44 -174
- package/dest/providers/extension/extension_provider.d.ts +63 -0
- package/dest/providers/extension/extension_provider.d.ts.map +1 -0
- package/dest/providers/extension/extension_provider.js +124 -0
- package/dest/providers/extension/extension_wallet.d.ts +155 -0
- package/dest/providers/extension/extension_wallet.d.ts.map +1 -0
- package/dest/{extension/provider → providers/extension}/extension_wallet.js +95 -48
- package/dest/providers/extension/index.d.ts +6 -0
- package/dest/providers/extension/index.d.ts.map +1 -0
- package/dest/{extension/provider → providers/extension}/index.js +2 -0
- package/dest/types.d.ts +12 -43
- package/dest/types.d.ts.map +1 -1
- package/dest/types.js +2 -3
- package/package.json +9 -10
- package/src/base-wallet/base_wallet.ts +8 -15
- package/src/crypto.ts +113 -237
- package/src/manager/index.ts +10 -2
- package/src/manager/types.ts +5 -91
- package/src/manager/wallet_manager.ts +46 -192
- package/src/providers/extension/extension_provider.ts +167 -0
- package/src/{extension/provider → providers/extension}/extension_wallet.ts +110 -52
- package/src/providers/extension/index.ts +5 -0
- package/src/types.ts +10 -44
- package/dest/emoji_alphabet.d.ts +0 -35
- package/dest/emoji_alphabet.d.ts.map +0 -1
- package/dest/emoji_alphabet.js +0 -299
- package/dest/extension/handlers/background_connection_handler.d.ts +0 -158
- package/dest/extension/handlers/background_connection_handler.d.ts.map +0 -1
- package/dest/extension/handlers/background_connection_handler.js +0 -258
- package/dest/extension/handlers/content_script_connection_handler.d.ts +0 -56
- package/dest/extension/handlers/content_script_connection_handler.d.ts.map +0 -1
- package/dest/extension/handlers/content_script_connection_handler.js +0 -174
- package/dest/extension/handlers/index.d.ts +0 -12
- package/dest/extension/handlers/index.d.ts.map +0 -1
- package/dest/extension/handlers/index.js +0 -10
- package/dest/extension/handlers/internal_message_types.d.ts +0 -63
- package/dest/extension/handlers/internal_message_types.d.ts.map +0 -1
- package/dest/extension/handlers/internal_message_types.js +0 -22
- package/dest/extension/provider/extension_provider.d.ts +0 -107
- package/dest/extension/provider/extension_provider.d.ts.map +0 -1
- package/dest/extension/provider/extension_provider.js +0 -160
- package/dest/extension/provider/extension_wallet.d.ts +0 -131
- package/dest/extension/provider/extension_wallet.d.ts.map +0 -1
- package/dest/extension/provider/index.d.ts +0 -3
- package/dest/extension/provider/index.d.ts.map +0 -1
- package/src/emoji_alphabet.ts +0 -317
- package/src/extension/handlers/background_connection_handler.ts +0 -423
- package/src/extension/handlers/content_script_connection_handler.ts +0 -246
- package/src/extension/handlers/index.ts +0 -25
- package/src/extension/handlers/internal_message_types.ts +0 -69
- package/src/extension/provider/extension_provider.ts +0 -233
- package/src/extension/provider/index.ts +0 -7
package/dest/crypto.js
CHANGED
|
@@ -4,69 +4,38 @@
|
|
|
4
4
|
* This module provides ECDH key exchange and AES-GCM encryption primitives
|
|
5
5
|
* for establishing secure communication channels between dApps and wallet extensions.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* The crypto flow uses HKDF for key derivation with domain separation:
|
|
10
|
-
*
|
|
7
|
+
* The crypto flow:
|
|
11
8
|
* 1. Both parties generate ECDH key pairs using {@link generateKeyPair}
|
|
12
9
|
* 2. Public keys are exchanged (exported via {@link exportPublicKey}, imported via {@link importPublicKey})
|
|
13
|
-
* 3. Both parties derive
|
|
14
|
-
*
|
|
15
|
-
* - HKDF expands the secret into 512 bits using concatenated public keys as salt
|
|
16
|
-
* - The 512 bits are split: first 256 bits for AES-GCM, second 256 bits for HMAC
|
|
17
|
-
* 4. Fingerprint is computed as HMAC(HMAC_KEY, "aztec-wallet-verification-verificationHash")
|
|
18
|
-
* 5. Messages are encrypted/decrypted using {@link encrypt} and {@link decrypt}
|
|
19
|
-
*
|
|
20
|
-
* This design ensures:
|
|
21
|
-
* - The encryption key is never exposed (verificationHash uses separate HMAC key)
|
|
22
|
-
* - Public keys are bound to the derived keys via HKDF salt
|
|
23
|
-
* - Single HKDF derivation with domain-separated output splitting
|
|
24
|
-
*
|
|
25
|
-
* ## Curve Choice
|
|
26
|
-
*
|
|
27
|
-
* We use P-256 (secp256r1) because it's the only ECDH curve with broad Web Crypto API
|
|
28
|
-
* support across all browsers. X25519 would be preferable for its simplicity and
|
|
29
|
-
* resistance to implementation errors, but it lacks universal browser support.
|
|
10
|
+
* 3. Both parties derive the same shared secret using {@link deriveSharedKey}
|
|
11
|
+
* 4. Messages are encrypted/decrypted using {@link encrypt} and {@link decrypt}
|
|
30
12
|
*
|
|
31
13
|
* @example
|
|
32
14
|
* ```typescript
|
|
33
|
-
* // Party A
|
|
15
|
+
* // Party A
|
|
34
16
|
* const keyPairA = await generateKeyPair();
|
|
35
17
|
* const publicKeyA = await exportPublicKey(keyPairA.publicKey);
|
|
36
18
|
*
|
|
37
|
-
* // Party B
|
|
19
|
+
* // Party B
|
|
38
20
|
* const keyPairB = await generateKeyPair();
|
|
39
21
|
* const publicKeyB = await exportPublicKey(keyPairB.publicKey);
|
|
40
22
|
*
|
|
41
|
-
* // Exchange public keys, then derive
|
|
42
|
-
* // App side: isApp = true
|
|
23
|
+
* // Exchange public keys, then derive shared secret
|
|
43
24
|
* const importedB = await importPublicKey(publicKeyB);
|
|
44
|
-
* const
|
|
45
|
-
*
|
|
46
|
-
* // Wallet side: isApp = false
|
|
47
|
-
* const importedA = await importPublicKey(publicKeyA);
|
|
48
|
-
* const sessionB = await deriveSessionKeys(keyPairB, importedA, false);
|
|
49
|
-
*
|
|
50
|
-
* // Both parties compute the same verificationHash for verification
|
|
51
|
-
* const verificationHashA = sessionA.verificationHash;
|
|
52
|
-
* const emojiA = hashToEmoji(verificationHashA);
|
|
25
|
+
* const sharedKeyA = await deriveSharedKey(keyPairA.privateKey, importedB);
|
|
53
26
|
*
|
|
54
27
|
* // Encrypt and decrypt
|
|
55
|
-
* const encrypted = await encrypt(
|
|
56
|
-
* const decrypted = await decrypt(
|
|
28
|
+
* const encrypted = await encrypt(sharedKeyA, { message: 'hello' });
|
|
29
|
+
* const decrypted = await decrypt(sharedKeyB, encrypted);
|
|
57
30
|
* ```
|
|
58
31
|
*
|
|
59
32
|
* @packageDocumentation
|
|
60
|
-
*/ import {
|
|
61
|
-
/** P-256 coordinate size in bytes */ const P256_COORDINATE_SIZE = 32;
|
|
62
|
-
// HKDF info string for key derivation
|
|
63
|
-
const HKDF_INFO = new TextEncoder().encode('Aztec Wallet DAPP Key derivation');
|
|
64
|
-
const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-verificationHash');
|
|
33
|
+
*/ import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
65
34
|
/**
|
|
66
35
|
* Generates an ECDH P-256 key pair for key exchange.
|
|
67
36
|
*
|
|
68
|
-
* The generated key pair can be used to derive
|
|
69
|
-
* party's public key using {@link
|
|
37
|
+
* The generated key pair can be used to derive a shared secret with another
|
|
38
|
+
* party's public key using {@link deriveSharedKey}.
|
|
70
39
|
*
|
|
71
40
|
* @returns A new ECDH key pair
|
|
72
41
|
*
|
|
@@ -81,7 +50,7 @@ const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-ver
|
|
|
81
50
|
name: 'ECDH',
|
|
82
51
|
namedCurve: 'P-256'
|
|
83
52
|
}, true, [
|
|
84
|
-
'
|
|
53
|
+
'deriveKey'
|
|
85
54
|
]);
|
|
86
55
|
return {
|
|
87
56
|
publicKey: keyPair.publicKey,
|
|
@@ -115,16 +84,16 @@ const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-ver
|
|
|
115
84
|
/**
|
|
116
85
|
* Imports a public key from JWK format.
|
|
117
86
|
*
|
|
118
|
-
* Used to import the other party's public key for deriving
|
|
87
|
+
* Used to import the other party's public key for deriving a shared secret.
|
|
119
88
|
*
|
|
120
89
|
* @param exported - The public key in JWK format
|
|
121
|
-
* @returns A CryptoKey that can be used with {@link
|
|
90
|
+
* @returns A CryptoKey that can be used with {@link deriveSharedKey}
|
|
122
91
|
*
|
|
123
92
|
* @example
|
|
124
93
|
* ```typescript
|
|
125
|
-
* //
|
|
126
|
-
* const
|
|
127
|
-
* const
|
|
94
|
+
* // Receive exported public key from other party
|
|
95
|
+
* const theirPublicKey = await importPublicKey(receivedPublicKey);
|
|
96
|
+
* const sharedKey = await deriveSharedKey(myPrivateKey, theirPublicKey);
|
|
128
97
|
* ```
|
|
129
98
|
*/ export function importPublicKey(exported) {
|
|
130
99
|
return crypto.subtle.importKey('jwk', {
|
|
@@ -135,150 +104,58 @@ const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-ver
|
|
|
135
104
|
}, {
|
|
136
105
|
name: 'ECDH',
|
|
137
106
|
namedCurve: 'P-256'
|
|
138
|
-
},
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Decodes a base64url-encoded coordinate to fixed-size bytes.
|
|
142
|
-
*
|
|
143
|
-
* For P-256, coordinates are always 32 bytes. This function ensures
|
|
144
|
-
* consistent serialization regardless of leading zeros.
|
|
145
|
-
*
|
|
146
|
-
* @param base64url - Base64url-encoded coordinate
|
|
147
|
-
* @param size - Expected size in bytes (32 for P-256)
|
|
148
|
-
* @returns Fixed-size Uint8Array, left-padded with zeros if needed
|
|
149
|
-
*/ function decodeCoordinateFixedSize(base64url, size) {
|
|
150
|
-
const decoded = base64UrlToBytes(base64url);
|
|
151
|
-
if (decoded.length === size) {
|
|
152
|
-
return decoded;
|
|
153
|
-
}
|
|
154
|
-
if (decoded.length > size) {
|
|
155
|
-
throw new Error(`Invalid P-256 coordinate: expected ${size} bytes, got ${decoded.length}`);
|
|
156
|
-
}
|
|
157
|
-
// Left-pad with zeros
|
|
158
|
-
const padded = new Uint8Array(size);
|
|
159
|
-
padded.set(decoded, size - decoded.length);
|
|
160
|
-
return padded;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Creates HKDF salt from public keys with fixed ordering by party role.
|
|
164
|
-
*
|
|
165
|
-
* The app's public key always comes first, followed by the wallet's public key.
|
|
166
|
-
* This ensures both parties produce the same salt.
|
|
167
|
-
*
|
|
168
|
-
* @param appKey - The app's public key in exported format
|
|
169
|
-
* @param walletKey - The wallet's public key in exported format
|
|
170
|
-
* @returns Concatenated bytes: app_x || app_y || wallet_x || wallet_y (128 bytes for P-256)
|
|
171
|
-
*/ function createSaltFromPublicKeys(appKey, walletKey) {
|
|
172
|
-
// Fixed ordering: app first, then wallet
|
|
173
|
-
// Each coordinate is fixed at 32 bytes for P-256
|
|
174
|
-
const appX = decodeCoordinateFixedSize(appKey.x, P256_COORDINATE_SIZE);
|
|
175
|
-
const appY = decodeCoordinateFixedSize(appKey.y, P256_COORDINATE_SIZE);
|
|
176
|
-
const walletX = decodeCoordinateFixedSize(walletKey.x, P256_COORDINATE_SIZE);
|
|
177
|
-
const walletY = decodeCoordinateFixedSize(walletKey.y, P256_COORDINATE_SIZE);
|
|
178
|
-
// Total: 4 * 32 = 128 bytes
|
|
179
|
-
const salt = new Uint8Array(4 * P256_COORDINATE_SIZE);
|
|
180
|
-
salt.set(appX, 0);
|
|
181
|
-
salt.set(appY, P256_COORDINATE_SIZE);
|
|
182
|
-
salt.set(walletX, 2 * P256_COORDINATE_SIZE);
|
|
183
|
-
salt.set(walletY, 3 * P256_COORDINATE_SIZE);
|
|
184
|
-
return salt.buffer;
|
|
107
|
+
}, false, []);
|
|
185
108
|
}
|
|
186
109
|
/**
|
|
187
|
-
* Derives
|
|
188
|
-
*
|
|
189
|
-
* This is the main key derivation function that produces:
|
|
190
|
-
* 1. An AES-256-GCM encryption key (first 256 bits)
|
|
191
|
-
* 2. An HMAC key for verificationHash computation (second 256 bits)
|
|
192
|
-
* 3. A verificationHash computed as HMAC(hmacKey, "aztec-wallet-verification-verificationHash")
|
|
110
|
+
* Derives a shared AES-256-GCM key from ECDH key exchange.
|
|
193
111
|
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
112
|
+
* Both parties will derive the same shared key when using their own private key
|
|
113
|
+
* and the other party's public key. This is the core of ECDH key agreement.
|
|
196
114
|
*
|
|
197
|
-
* @param
|
|
198
|
-
* @param
|
|
199
|
-
* @
|
|
200
|
-
* @returns Session keys containing encryption key and verificationHash
|
|
115
|
+
* @param privateKey - Your ECDH private key
|
|
116
|
+
* @param publicKey - The other party's ECDH public key
|
|
117
|
+
* @returns An AES-256-GCM key for encryption/decryption
|
|
201
118
|
*
|
|
202
119
|
* @example
|
|
203
120
|
* ```typescript
|
|
204
|
-
* //
|
|
205
|
-
* const
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* // sessionA.verificationHash === sessionB.verificationHash
|
|
121
|
+
* // Both parties derive the same key
|
|
122
|
+
* const sharedKeyA = await deriveSharedKey(privateKeyA, publicKeyB);
|
|
123
|
+
* const sharedKeyB = await deriveSharedKey(privateKeyB, publicKeyA);
|
|
124
|
+
* // sharedKeyA and sharedKeyB are equivalent
|
|
209
125
|
* ```
|
|
210
|
-
*/ export
|
|
211
|
-
|
|
212
|
-
const sharedSecretBits = await crypto.subtle.deriveBits({
|
|
126
|
+
*/ export function deriveSharedKey(privateKey, publicKey) {
|
|
127
|
+
return crypto.subtle.deriveKey({
|
|
213
128
|
name: 'ECDH',
|
|
214
|
-
public:
|
|
215
|
-
},
|
|
216
|
-
// Step 2: Import shared secret as HKDF key material
|
|
217
|
-
const hkdfKey = await crypto.subtle.importKey('raw', sharedSecretBits, {
|
|
218
|
-
name: 'HKDF'
|
|
219
|
-
}, false, [
|
|
220
|
-
'deriveBits'
|
|
221
|
-
]);
|
|
222
|
-
// Step 3: Export public keys and create salt (app first, wallet second)
|
|
223
|
-
const ownExportedKey = await exportPublicKey(ownKeyPair.publicKey);
|
|
224
|
-
const peerExportedKey = await exportPublicKey(peerPublicKey);
|
|
225
|
-
const appPublicKey = isApp ? ownExportedKey : peerExportedKey;
|
|
226
|
-
const walletPublicKey = isApp ? peerExportedKey : ownExportedKey;
|
|
227
|
-
const salt = createSaltFromPublicKeys(appPublicKey, walletPublicKey);
|
|
228
|
-
// Step 4: Derive 512 bits in a single HKDF call
|
|
229
|
-
const derivedBits = await crypto.subtle.deriveBits({
|
|
230
|
-
name: 'HKDF',
|
|
231
|
-
hash: 'SHA-256',
|
|
232
|
-
salt,
|
|
233
|
-
info: HKDF_INFO
|
|
234
|
-
}, hkdfKey, 512);
|
|
235
|
-
// Step 5: Split into GCM key (first 256 bits) and HMAC key (second 256 bits)
|
|
236
|
-
const gcmKeyBits = derivedBits.slice(0, 32);
|
|
237
|
-
const hmacKeyBits = derivedBits.slice(32, 64);
|
|
238
|
-
// Step 6: Import GCM key
|
|
239
|
-
const encryptionKey = await crypto.subtle.importKey('raw', gcmKeyBits, {
|
|
129
|
+
public: publicKey
|
|
130
|
+
}, privateKey, {
|
|
240
131
|
name: 'AES-GCM',
|
|
241
132
|
length: 256
|
|
242
|
-
},
|
|
133
|
+
}, true, [
|
|
243
134
|
'encrypt',
|
|
244
135
|
'decrypt'
|
|
245
136
|
]);
|
|
246
|
-
// Step 7: Import HMAC key
|
|
247
|
-
const hmacKey = await crypto.subtle.importKey('raw', hmacKeyBits, {
|
|
248
|
-
name: 'HMAC',
|
|
249
|
-
hash: 'SHA-256'
|
|
250
|
-
}, false, [
|
|
251
|
-
'sign'
|
|
252
|
-
]);
|
|
253
|
-
// Step 8: Compute verificationHash as HMAC of fixed string
|
|
254
|
-
const verificationHashBytes = await crypto.subtle.sign('HMAC', hmacKey, FINGERPRINT_DATA);
|
|
255
|
-
// Convert to hex string
|
|
256
|
-
const verificationHash = arrayBufferToHex(verificationHashBytes);
|
|
257
|
-
return {
|
|
258
|
-
encryptionKey,
|
|
259
|
-
verificationHash
|
|
260
|
-
};
|
|
261
137
|
}
|
|
262
138
|
/**
|
|
263
139
|
* Encrypts data using AES-256-GCM.
|
|
264
140
|
*
|
|
265
|
-
* A random 12-byte IV is
|
|
141
|
+
* The data is JSON serialized before encryption. A random 12-byte IV is
|
|
142
|
+
* generated for each encryption operation.
|
|
266
143
|
*
|
|
267
144
|
* AES-GCM provides both confidentiality and authenticity - any tampering
|
|
268
145
|
* with the ciphertext will cause decryption to fail.
|
|
269
146
|
*
|
|
270
|
-
* @param key - The AES-GCM key (from {@link
|
|
271
|
-
* @param data - The
|
|
147
|
+
* @param key - The AES-GCM key (from {@link deriveSharedKey})
|
|
148
|
+
* @param data - The data to encrypt (will be JSON serialized)
|
|
272
149
|
* @returns The encrypted payload with IV and ciphertext
|
|
273
150
|
*
|
|
274
151
|
* @example
|
|
275
152
|
* ```typescript
|
|
276
|
-
* const encrypted = await encrypt(
|
|
153
|
+
* const encrypted = await encrypt(sharedKey, { action: 'transfer', amount: 100 });
|
|
277
154
|
* // encrypted.iv and encrypted.ciphertext are base64 strings
|
|
278
155
|
* ```
|
|
279
156
|
*/ export async function encrypt(key, data) {
|
|
280
157
|
const iv = crypto.getRandomValues(new Uint8Array(12));
|
|
281
|
-
const encoded = new TextEncoder().encode(data);
|
|
158
|
+
const encoded = new TextEncoder().encode(jsonStringify(data));
|
|
282
159
|
const ciphertext = await crypto.subtle.encrypt({
|
|
283
160
|
name: 'AES-GCM',
|
|
284
161
|
iv
|
|
@@ -294,7 +171,7 @@ const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-ver
|
|
|
294
171
|
* The decrypted data is JSON parsed before returning.
|
|
295
172
|
*
|
|
296
173
|
* @typeParam T - The expected type of the decrypted data
|
|
297
|
-
* @param key - The AES-GCM key (from {@link
|
|
174
|
+
* @param key - The AES-GCM key (from {@link deriveSharedKey})
|
|
298
175
|
* @param payload - The encrypted payload from {@link encrypt}
|
|
299
176
|
* @returns The decrypted and parsed data
|
|
300
177
|
*
|
|
@@ -302,7 +179,7 @@ const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-ver
|
|
|
302
179
|
*
|
|
303
180
|
* @example
|
|
304
181
|
* ```typescript
|
|
305
|
-
* const decrypted = await decrypt<{ action: string; amount: number }>(
|
|
182
|
+
* const decrypted = await decrypt<{ action: string; amount: number }>(sharedKey, encrypted);
|
|
306
183
|
* console.log(decrypted.action); // 'transfer'
|
|
307
184
|
* ```
|
|
308
185
|
*/ export async function decrypt(key, payload) {
|
|
@@ -338,57 +215,86 @@ const FINGERPRINT_DATA = new TextEncoder().encode('aztec-wallet-verification-ver
|
|
|
338
215
|
return bytes.buffer;
|
|
339
216
|
}
|
|
340
217
|
/**
|
|
341
|
-
*
|
|
218
|
+
* Emoji alphabet for visual verification of shared secrets.
|
|
219
|
+
* 32 distinct, easily recognizable emojis for anti-spoofing verification.
|
|
342
220
|
* @internal
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
221
|
+
*/ const EMOJI_ALPHABET = [
|
|
222
|
+
'🔵',
|
|
223
|
+
'🟢',
|
|
224
|
+
'🔴',
|
|
225
|
+
'🟡',
|
|
226
|
+
'🟣',
|
|
227
|
+
'🟠',
|
|
228
|
+
'⚫',
|
|
229
|
+
'⚪',
|
|
230
|
+
'🌟',
|
|
231
|
+
'🌙',
|
|
232
|
+
'☀️',
|
|
233
|
+
'🌈',
|
|
234
|
+
'🔥',
|
|
235
|
+
'💧',
|
|
236
|
+
'🌸',
|
|
237
|
+
'🍀',
|
|
238
|
+
'🦋',
|
|
239
|
+
'🐬',
|
|
240
|
+
'🦊',
|
|
241
|
+
'🐼',
|
|
242
|
+
'🦁',
|
|
243
|
+
'🐯',
|
|
244
|
+
'🐸',
|
|
245
|
+
'🦉',
|
|
246
|
+
'🎵',
|
|
247
|
+
'🎨',
|
|
248
|
+
'🎯',
|
|
249
|
+
'🎲',
|
|
250
|
+
'🔔',
|
|
251
|
+
'💎',
|
|
252
|
+
'🔑',
|
|
253
|
+
'🏆'
|
|
254
|
+
];
|
|
355
255
|
/**
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
|
|
359
|
-
|
|
256
|
+
* Hashes a shared AES key to a hex string for verification.
|
|
257
|
+
*
|
|
258
|
+
* This extracts the raw key material and hashes it with SHA-256,
|
|
259
|
+
* returning the first 16 bytes as a hex string.
|
|
260
|
+
*
|
|
261
|
+
* @param sharedKey - The AES-GCM shared key (must be extractable)
|
|
262
|
+
* @returns A hex string representation of the hash
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* const hash = await hashSharedSecret(sharedKey);
|
|
267
|
+
* const emoji = hashToEmoji(hash);
|
|
268
|
+
* ```
|
|
269
|
+
*/ export async function hashSharedSecret(sharedKey) {
|
|
270
|
+
const rawKey = await crypto.subtle.exportKey('raw', sharedKey);
|
|
271
|
+
const hash = await crypto.subtle.digest('SHA-256', rawKey);
|
|
272
|
+
const bytes = new Uint8Array(hash.slice(0, 16));
|
|
360
273
|
return Array.from(bytes).map((b)=>b.toString(16).padStart(2, '0')).join('');
|
|
361
274
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Default grid size for emoji verification display.
|
|
364
|
-
* 3x3 grid = 9 emojis = 72 bits of security.
|
|
365
|
-
*/ export const DEFAULT_EMOJI_GRID_SIZE = 9;
|
|
366
275
|
/**
|
|
367
276
|
* Converts a hex hash to an emoji sequence for visual verification.
|
|
368
277
|
*
|
|
369
|
-
* This is used for verification - both the dApp and wallet
|
|
370
|
-
* independently compute the same emoji sequence from the
|
|
278
|
+
* This is used for anti-MITM verification - both the dApp and wallet
|
|
279
|
+
* independently compute the same emoji sequence from the shared secret.
|
|
371
280
|
* Users can visually compare the sequences to detect interception.
|
|
372
281
|
*
|
|
373
|
-
*
|
|
374
|
-
* 72 bits of security (9 * 8 = 72 bits), making brute-force attacks
|
|
375
|
-
* computationally infeasible.
|
|
282
|
+
* Similar to SAS (Short Authentication String) in ZRTP/Signal.
|
|
376
283
|
*
|
|
377
|
-
* @param hash - Hex string from
|
|
378
|
-
* @param
|
|
284
|
+
* @param hash - Hex string from {@link hashSharedSecret}
|
|
285
|
+
* @param length - Number of emojis to generate (default: 4)
|
|
379
286
|
* @returns A string of emojis representing the hash
|
|
380
287
|
*
|
|
381
288
|
* @example
|
|
382
289
|
* ```typescript
|
|
383
|
-
* const
|
|
384
|
-
* const emoji = hashToEmoji(
|
|
385
|
-
* // Display
|
|
290
|
+
* const hash = await hashSharedSecret(sharedKey);
|
|
291
|
+
* const emoji = hashToEmoji(hash); // e.g., "🔵🦋🎯🐼"
|
|
292
|
+
* // Display to user for verification
|
|
386
293
|
* ```
|
|
387
|
-
*/ export function hashToEmoji(hash,
|
|
388
|
-
const
|
|
389
|
-
for(let i = 0; i < hash.length &&
|
|
390
|
-
|
|
391
|
-
emojis.push(EMOJI_ALPHABET[byteValue % EMOJI_ALPHABET_SIZE]);
|
|
294
|
+
*/ export function hashToEmoji(hash, length = 4) {
|
|
295
|
+
const bytes = [];
|
|
296
|
+
for(let i = 0; i < hash.length && bytes.length < length; i += 2){
|
|
297
|
+
bytes.push(parseInt(hash.slice(i, i + 2), 16));
|
|
392
298
|
}
|
|
393
|
-
return
|
|
299
|
+
return bytes.map((b)=>EMOJI_ALPHABET[b % EMOJI_ALPHABET.length]).join('');
|
|
394
300
|
}
|
package/dest/manager/index.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export { WalletManager } from './wallet_manager.js';
|
|
2
|
-
export type { WalletManagerConfig, ExtensionWalletConfig, WebWalletConfig, WalletProviderType, WalletProvider,
|
|
3
|
-
|
|
2
|
+
export type { WalletManagerConfig, ExtensionWalletConfig, WebWalletConfig, WalletProviderType, WalletProvider, ProviderDisconnectionCallback, DiscoverWalletsOptions, } from './types.js';
|
|
3
|
+
export { WalletMessageType } from '../types.js';
|
|
4
|
+
export type { WalletInfo, WalletMessage, WalletResponse, DiscoveryRequest, DiscoveryResponse } from '../types.js';
|
|
5
|
+
export { ChainInfoSchema } from '@aztec/aztec.js/account';
|
|
6
|
+
export type { ChainInfo } from '@aztec/aztec.js/account';
|
|
7
|
+
export { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
8
|
+
export { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
9
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tYW5hZ2VyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNwRCxZQUFZLEVBQ1YsbUJBQW1CLEVBQ25CLHFCQUFxQixFQUNyQixlQUFlLEVBQ2Ysa0JBQWtCLEVBQ2xCLGNBQWMsRUFDZCw2QkFBNkIsRUFDN0Isc0JBQXNCLEdBQ3ZCLE1BQU0sWUFBWSxDQUFDO0FBR3BCLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNoRCxZQUFZLEVBQUUsVUFBVSxFQUFFLGFBQWEsRUFBRSxjQUFjLEVBQUUsZ0JBQWdCLEVBQUUsaUJBQWlCLEVBQUUsTUFBTSxhQUFhLENBQUM7QUFHbEgsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzFELFlBQVksRUFBRSxTQUFTLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN6RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDdEQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLDRCQUE0QixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EACV,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGlH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dest/manager/index.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
1
|
export { WalletManager } from './wallet_manager.js';
|
|
2
|
+
// Re-export types and enums from providers for convenience
|
|
3
|
+
export { WalletMessageType } from '../types.js';
|
|
4
|
+
// Re-export commonly needed utilities for wallet integration
|
|
5
|
+
export { ChainInfoSchema } from '@aztec/aztec.js/account';
|
|
6
|
+
export { WalletSchema } from '@aztec/aztec.js/wallet';
|
|
7
|
+
export { jsonStringify } from '@aztec/foundation/json-rpc';
|
package/dest/manager/types.d.ts
CHANGED
|
@@ -1,33 +1,5 @@
|
|
|
1
1
|
import type { ChainInfo } from '@aztec/aztec.js/account';
|
|
2
2
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
3
|
-
/**
|
|
4
|
-
* A pending connection that requires user verification before finalizing.
|
|
5
|
-
*
|
|
6
|
-
* After key exchange, both dApp and wallet compute a verification hash independently.
|
|
7
|
-
* The dApp should display this hash (typically as emojis) and let the user confirm
|
|
8
|
-
* it matches what's shown in their wallet before calling `confirm()`.
|
|
9
|
-
*
|
|
10
|
-
* This protects the dApp from connecting to a malicious wallet that might be
|
|
11
|
-
* intercepting the connection (MITM attack).
|
|
12
|
-
*/
|
|
13
|
-
export interface PendingConnection {
|
|
14
|
-
/**
|
|
15
|
-
* The verification hash computed from the shared secret.
|
|
16
|
-
* Use `hashToEmoji()` to convert to a visual representation for user verification.
|
|
17
|
-
* The user should confirm this matches what their wallet displays.
|
|
18
|
-
*/
|
|
19
|
-
verificationHash: string;
|
|
20
|
-
/**
|
|
21
|
-
* Confirms the connection after user verifies the emojis match.
|
|
22
|
-
* @returns The connected wallet instance
|
|
23
|
-
*/
|
|
24
|
-
confirm(): Promise<Wallet>;
|
|
25
|
-
/**
|
|
26
|
-
* Cancels the pending connection.
|
|
27
|
-
* Call this if the user indicates the emojis don't match.
|
|
28
|
-
*/
|
|
29
|
-
cancel(): void;
|
|
30
|
-
}
|
|
31
3
|
/**
|
|
32
4
|
* Configuration for extension wallets
|
|
33
5
|
*/
|
|
@@ -58,7 +30,7 @@ export interface WalletManagerConfig {
|
|
|
58
30
|
/**
|
|
59
31
|
* Type of wallet provider
|
|
60
32
|
*/
|
|
61
|
-
export type WalletProviderType = 'extension' | 'web';
|
|
33
|
+
export type WalletProviderType = 'extension' | 'web' | 'embedded';
|
|
62
34
|
/**
|
|
63
35
|
* Callback type for wallet disconnect events at the provider level.
|
|
64
36
|
*/
|
|
@@ -79,32 +51,13 @@ export interface WalletProvider {
|
|
|
79
51
|
/** Additional metadata */
|
|
80
52
|
metadata?: Record<string, unknown>;
|
|
81
53
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* This performs the ECDH key exchange and returns a pending connection with the
|
|
85
|
-
* verification hash. The channel is encrypted but NOT yet verified - the dApp
|
|
86
|
-
* should display the hash (as emojis) to the user and let them confirm it
|
|
87
|
-
* matches their wallet before calling `confirm()`.
|
|
88
|
-
*
|
|
54
|
+
* Connect to this wallet provider with an application ID
|
|
89
55
|
* @param appId - Application identifier for the requesting dapp
|
|
90
|
-
* @returns A pending connection with verification hash and confirm/cancel methods
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* const pending = await provider.establishSecureChannel('my-app');
|
|
95
|
-
*
|
|
96
|
-
* // Show emojis to user for verification
|
|
97
|
-
* const emojis = hashToEmoji(pending.verificationHash);
|
|
98
|
-
* showDialog(`Verify these match your wallet: ${emojis}`);
|
|
99
|
-
*
|
|
100
|
-
* // User confirms emojis match
|
|
101
|
-
* const wallet = await pending.confirm();
|
|
102
|
-
* ```
|
|
103
56
|
*/
|
|
104
|
-
|
|
57
|
+
connect(appId: string): Promise<Wallet>;
|
|
105
58
|
/**
|
|
106
59
|
* Disconnects the current wallet and cleans up resources.
|
|
107
|
-
* After calling this, the wallet returned from
|
|
60
|
+
* After calling this, the wallet returned from connect() should no longer be used.
|
|
108
61
|
* @returns A promise that resolves when disconnection is complete
|
|
109
62
|
*/
|
|
110
63
|
disconnect?(): Promise<void>;
|
|
@@ -126,42 +79,7 @@ export interface WalletProvider {
|
|
|
126
79
|
export interface DiscoverWalletsOptions {
|
|
127
80
|
/** Chain information to filter by */
|
|
128
81
|
chainInfo: ChainInfo;
|
|
129
|
-
/**
|
|
130
|
-
appId: string;
|
|
131
|
-
/** Discovery timeout in milliseconds. Default: 60000 (60s) */
|
|
82
|
+
/** Discovery timeout in milliseconds */
|
|
132
83
|
timeout?: number;
|
|
133
|
-
/**
|
|
134
|
-
* Callback invoked when a wallet provider is discovered.
|
|
135
|
-
* Use this to show wallets to users as they approve them, rather than
|
|
136
|
-
* waiting for the full timeout.
|
|
137
|
-
*/
|
|
138
|
-
onWalletDiscovered?: (provider: WalletProvider) => void;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* A cancellable discovery session.
|
|
142
|
-
*
|
|
143
|
-
* Returned by `WalletManager.getAvailableWallets()` to allow consumers to
|
|
144
|
-
* cancel discovery when no longer needed (e.g., network changes, user navigates away).
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* const discovery = WalletManager.configure({...}).getAvailableWallets({...});
|
|
149
|
-
*
|
|
150
|
-
* // Iterate over discovered wallets
|
|
151
|
-
* for await (const wallet of discovery.wallets) {
|
|
152
|
-
* console.log(`Found: ${wallet.name}`);
|
|
153
|
-
* }
|
|
154
|
-
*
|
|
155
|
-
* // Cancel discovery when no longer needed
|
|
156
|
-
* discovery.cancel();
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
export interface DiscoverySession {
|
|
160
|
-
/** Async iterator that yields wallet providers as they're discovered */
|
|
161
|
-
wallets: AsyncIterable<WalletProvider>;
|
|
162
|
-
/** Promise that resolves when discovery completes or is cancelled */
|
|
163
|
-
done: Promise<void>;
|
|
164
|
-
/** Cancel discovery immediately and clean up resources */
|
|
165
|
-
cancel: () => void;
|
|
166
84
|
}
|
|
167
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
85
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tYW5hZ2VyL3R5cGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQ3pELE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRXJEOztHQUVHO0FBQ0gsTUFBTSxXQUFXLHFCQUFxQjtJQUNwQyw0Q0FBNEM7SUFDNUMsT0FBTyxFQUFFLE9BQU8sQ0FBQztJQUNqQix5REFBeUQ7SUFDekQsU0FBUyxDQUFDLEVBQUUsTUFBTSxFQUFFLENBQUM7SUFDckIseURBQXlEO0lBQ3pELFNBQVMsQ0FBQyxFQUFFLE1BQU0sRUFBRSxDQUFDO0NBQ3RCO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsZUFBZTtJQUM5QixrQ0FBa0M7SUFDbEMsSUFBSSxFQUFFLE1BQU0sRUFBRSxDQUFDO0NBQ2hCO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsbUJBQW1CO0lBQ2xDLHFDQUFxQztJQUNyQyxVQUFVLENBQUMsRUFBRSxxQkFBcUIsQ0FBQztJQUNuQywrQkFBK0I7SUFDL0IsVUFBVSxDQUFDLEVBQUUsZUFBZSxDQUFDO0NBQzlCO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLE1BQU0sa0JBQWtCLEdBQUcsV0FBVyxHQUFHLEtBQUssR0FBRyxVQUFVLENBQUM7QUFFbEU7O0dBRUc7QUFDSCxNQUFNLE1BQU0sNkJBQTZCLEdBQUcsTUFBTSxJQUFJLENBQUM7QUFFdkQ7OztHQUdHO0FBQ0gsTUFBTSxXQUFXLGNBQWM7SUFDN0IseUNBQXlDO0lBQ3pDLEVBQUUsRUFBRSxNQUFNLENBQUM7SUFDWCw4QkFBOEI7SUFDOUIsSUFBSSxFQUFFLGtCQUFrQixDQUFDO0lBQ3pCLG1CQUFtQjtJQUNuQixJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsZUFBZTtJQUNmLElBQUksQ0FBQyxFQUFFLE1BQU0sQ0FBQztJQUNkLDBCQUEwQjtJQUMxQixRQUFRLENBQUMsRUFBRSxNQUFNLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxDQUFDO0lBQ25DOzs7T0FHRztJQUNILE9BQU8sQ0FBQyxLQUFLLEVBQUUsTUFBTSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUN4Qzs7OztPQUlHO0lBQ0gsVUFBVSxDQUFDLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQzdCOzs7O09BSUc7SUFDSCxZQUFZLENBQUMsQ0FBQyxRQUFRLEVBQUUsNkJBQTZCLEdBQUcsTUFBTSxJQUFJLENBQUM7SUFDbkU7OztPQUdHO0lBQ0gsY0FBYyxDQUFDLElBQUksT0FBTyxDQUFDO0NBQzVCO0FBRUQ7O0dBRUc7QUFDSCxNQUFNLFdBQVcsc0JBQXNCO0lBQ3JDLHFDQUFxQztJQUNyQyxTQUFTLEVBQUUsU0FBUyxDQUFDO0lBQ3JCLHdDQUF3QztJQUN4QyxPQUFPLENBQUMsRUFBRSxNQUFNLENBQUM7Q0FDbEIifQ==
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,4CAA4C;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,kCAAkC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC,+BAA+B;IAC/B,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,KAAK,GAAG,UAAU,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,MAAM,IAAI,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IACzB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC;;;;OAIG;IACH,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B;;;;OAIG;IACH,YAAY,CAAC,CAAC,QAAQ,EAAE,6BAA6B,GAAG,MAAM,IAAI,CAAC;IACnE;;;OAGG;IACH,cAAc,CAAC,IAAI,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dest/manager/types.js
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Returned by `WalletManager.getAvailableWallets()` to allow consumers to
|
|
5
|
-
* cancel discovery when no longer needed (e.g., network changes, user navigates away).
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const discovery = WalletManager.configure({...}).getAvailableWallets({...});
|
|
10
|
-
*
|
|
11
|
-
* // Iterate over discovered wallets
|
|
12
|
-
* for await (const wallet of discovery.wallets) {
|
|
13
|
-
* console.log(`Found: ${wallet.name}`);
|
|
14
|
-
* }
|
|
15
|
-
*
|
|
16
|
-
* // Cancel discovery when no longer needed
|
|
17
|
-
* discovery.cancel();
|
|
18
|
-
* ```
|
|
2
|
+
* Options for discovering wallets
|
|
19
3
|
*/ export { };
|