@volr/sdk-core 0.1.111 → 0.1.112

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/dist/index.d.cts CHANGED
@@ -117,40 +117,58 @@ type WrapKey = Uint8Array & {
117
117
  type MasterSeed = Uint8Array & {
118
118
  readonly __brand: 'MasterSeed';
119
119
  };
120
+ /**
121
+ * Opaque type for Entropy (32 bytes = 256 bits)
122
+ * Used for BIP-39 mnemonic generation (24 words)
123
+ * This is a type-level marker to prevent accidental misuse
124
+ */
125
+ type Entropy = Uint8Array & {
126
+ readonly __brand: 'Entropy';
127
+ };
120
128
 
121
129
  /**
122
- * Opaque handle to master seed
123
- * Provides controlled access and ensures cleanup via destroy()
130
+ * Handle to master key material
131
+ * Provides controlled access to entropy and seed, with secure cleanup
124
132
  */
125
- type MasterSeedHandle = {
126
- /** Read-only access to master seed bytes */
127
- readonly bytes: MasterSeed;
128
- /** Destroy the handle and zeroize the seed */
133
+ type MasterKeyHandle = {
134
+ /** 32-byte entropy for BIP-39 mnemonic generation */
135
+ readonly entropy: Entropy;
136
+ /** 32-byte seed for BIP-32 key derivation */
137
+ readonly seed: MasterSeed;
138
+ /**
139
+ * Get mnemonic phrase for export (24 words)
140
+ *
141
+ * WARNING: Returned string cannot be zeroized.
142
+ * Only call this when user explicitly requests wallet export.
143
+ * Minimize retention time of the returned string.
144
+ */
145
+ getMnemonic(): string;
146
+ /** Destroy the handle and zeroize all sensitive data */
129
147
  destroy(): void;
130
148
  };
131
149
  /**
132
150
  * Master key provider interface
133
- * Handles generation and unsealing of master seeds
151
+ * Handles generation and unsealing of master keys
134
152
  */
135
153
  interface MasterKeyProvider {
136
154
  /**
137
- * Unseal master seed from encrypted blob
155
+ * Unseal entropy from encrypted blob and derive seed
138
156
  *
139
157
  * @param blob - Encrypted blob containing ciphertext, nonce, and AAD
140
158
  * @param wrapKey - Wrap key for decryption
141
- * @returns Handle to unsealed master seed
159
+ * @returns Handle to unsealed master key
142
160
  */
143
161
  unsealFromBlob(blob: {
144
162
  cipher: Uint8Array;
145
163
  nonce: Uint8Array;
146
164
  aad: Uint8Array;
147
- }, wrapKey: WrapKey): Promise<MasterSeedHandle>;
165
+ }, wrapKey: WrapKey): Promise<MasterKeyHandle>;
148
166
  /**
149
- * Generate a new master seed
167
+ * Generate a new master key (entropy + derived seed)
150
168
  *
151
- * @returns Handle to newly generated master seed
169
+ * @returns Handle to newly generated master key
152
170
  */
153
- generate(): Promise<MasterSeedHandle>;
171
+ generate(): Promise<MasterKeyHandle>;
154
172
  }
155
173
  /**
156
174
  * Create a master key provider instance
@@ -161,8 +179,15 @@ interface MasterKeyProvider {
161
179
  * ```ts
162
180
  * const provider = createMasterKeyProvider();
163
181
  * const handle = await provider.generate();
164
- * // Use handle.bytes for key derivation
165
- * handle.destroy(); // Cleanup
182
+ *
183
+ * // Use handle.seed for key derivation
184
+ * const keypair = deriveEvmKey({ masterSeed: handle.seed });
185
+ *
186
+ * // Export mnemonic when user requests (only for backup/migration)
187
+ * const mnemonic = handle.getMnemonic();
188
+ *
189
+ * // Cleanup
190
+ * handle.destroy();
166
191
  * ```
167
192
  */
168
193
  declare function createMasterKeyProvider(): MasterKeyProvider;
@@ -250,6 +275,69 @@ type PrfInput = {
250
275
  */
251
276
  declare function deriveWrapKey(input: PrfInput): WrapKey;
252
277
 
278
+ /**
279
+ * BIP-39 Mnemonic utilities
280
+ *
281
+ * Provides functions to generate entropy, convert to/from mnemonic strings,
282
+ * and derive seeds for key generation.
283
+ *
284
+ * Security Note:
285
+ * - Entropy (Uint8Array) can be zeroized after use
286
+ * - Mnemonic strings cannot be zeroized (JavaScript strings are immutable)
287
+ * - Only convert to mnemonic string when absolutely necessary (e.g., export)
288
+ */
289
+
290
+ /**
291
+ * Generate random entropy for BIP-39 mnemonic (256 bits = 24 words)
292
+ *
293
+ * @returns 32-byte entropy that can be converted to a 24-word mnemonic
294
+ *
295
+ * @example
296
+ * ```ts
297
+ * const entropy = generateEntropy();
298
+ * const mnemonic = entropyToMnemonicString(entropy);
299
+ * // ... use mnemonic for export
300
+ * zeroize(entropy);
301
+ * ```
302
+ */
303
+ declare function generateEntropy(): Entropy;
304
+ /**
305
+ * Validate entropy has correct length for 24-word mnemonic
306
+ *
307
+ * @param entropy - Entropy to validate
308
+ * @returns true if entropy is valid (32 bytes)
309
+ */
310
+ declare function validateEntropy(entropy: Entropy): boolean;
311
+ /**
312
+ * Convert entropy to BIP-39 mnemonic string (24 words)
313
+ *
314
+ * WARNING: Returned string cannot be zeroized. Minimize retention time.
315
+ * Only call this function when the user explicitly requests to export their wallet.
316
+ *
317
+ * @param entropy - 32-byte entropy
318
+ * @returns 24-word mnemonic phrase (space-separated)
319
+ */
320
+ declare function entropyToMnemonicString(entropy: Entropy): string;
321
+ /**
322
+ * Convert BIP-39 mnemonic string back to entropy
323
+ *
324
+ * @param mnemonic - 24-word mnemonic phrase (space-separated)
325
+ * @returns 32-byte entropy
326
+ * @throws Error if mnemonic is invalid
327
+ */
328
+ declare function mnemonicStringToEntropy(mnemonic: string): Entropy;
329
+ /**
330
+ * Derive BIP-39 seed from entropy
331
+ *
332
+ * This function internally converts entropy to a mnemonic string (temporarily),
333
+ * then uses PBKDF2 to derive the seed. The mnemonic string exists only within
334
+ * this function's scope.
335
+ *
336
+ * @param entropy - 32-byte entropy
337
+ * @returns 32-byte master seed for BIP-32 key derivation
338
+ */
339
+ declare function entropyToSeed(entropy: Entropy): Promise<MasterSeed>;
340
+
253
341
  /**
254
342
  * Default BIP-32 derivation path for Ethereum
255
343
  * m / purpose' / coin_type' / account' / change / address_index
@@ -1404,4 +1492,4 @@ type SelectSignerContext = {
1404
1492
  */
1405
1493
  declare function selectSigner(ctx: SelectSignerContext): Promise<SignerPort>;
1406
1494
 
1407
- export { type AesGcmParams, type AuthorizationTuple, type Call, ChainNotAddedError, DEFAULT_EVM_PATH, DOMAIN, type DeriveArgs, EIP1193ErrorCode, type EIP1193Provider, EIP712_DOMAIN, ERR_AAD_MISMATCH, ERR_CHAIN_MISMATCH, ERR_CRYPTO_FAIL, ERR_INVALID_PARAM, ERR_LOW_ENTROPY, ERR_NONCE_SIZE, type EvmKeypair, type ExtendedRPCClient, ExternalWalletSigner, type KeyStorageType, type Sig$1 as LegacySig, type MasterKeyProvider, type MasterSeed, type MasterSeedHandle, type MpcTransport, PasskeyP256Signer, type PasskeyProviderOptions, type PasskeyProviderPort, type PrecheckInput, type PrecheckQuote, type PrfInput, type RelayInput, type RelayMode, type RelayResult, RequestPendingError, type RpcLike, Secp256k1SoftwareSigner, type SelectSignerContext, type SessionAuth, type Sig, type SignerContext, type SignerKind, type SignerPort, TYPES, type TypedDataDomain, type TypedDataField, type TypedDataInput, type TypedDataTypes, UnauthorizedError, UnsupportedMethodError, type UploadBlobOptions, type UploadViaPresignOptions, UserRejectedError, VolrError, WalletError, type WalletProviderPort, type WrapKey, WrongNetworkError, ZERO_ADDRESS, ZERO_HASH, aesGcmDecrypt, aesGcmEncrypt, buildSignedBatchMessage, computeCallsHash, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, evmSign, evmVerify, generateNonce, getAuthNonce, getRandomBytes, hkdfSha256, normalizeWalletError, sealMasterSeed, selectSigner, selectSigner$1 as selectSignerLegacy, signAuthorization, signSession, toChecksumAddress, unsealMasterSeed, uploadBlob, uploadBlobViaPresign, zeroize };
1495
+ export { type AesGcmParams, type AuthorizationTuple, type Call, ChainNotAddedError, DEFAULT_EVM_PATH, DOMAIN, type DeriveArgs, EIP1193ErrorCode, type EIP1193Provider, EIP712_DOMAIN, ERR_AAD_MISMATCH, ERR_CHAIN_MISMATCH, ERR_CRYPTO_FAIL, ERR_INVALID_PARAM, ERR_LOW_ENTROPY, ERR_NONCE_SIZE, type Entropy, type EvmKeypair, type ExtendedRPCClient, ExternalWalletSigner, type KeyStorageType, type Sig$1 as LegacySig, type MasterKeyHandle, type MasterKeyProvider, type MasterSeed, type MpcTransport, PasskeyP256Signer, type PasskeyProviderOptions, type PasskeyProviderPort, type PrecheckInput, type PrecheckQuote, type PrfInput, type RelayInput, type RelayMode, type RelayResult, RequestPendingError, type RpcLike, Secp256k1SoftwareSigner, type SelectSignerContext, type SessionAuth, type Sig, type SignerContext, type SignerKind, type SignerPort, TYPES, type TypedDataDomain, type TypedDataField, type TypedDataInput, type TypedDataTypes, UnauthorizedError, UnsupportedMethodError, type UploadBlobOptions, type UploadViaPresignOptions, UserRejectedError, VolrError, WalletError, type WalletProviderPort, type WrapKey, WrongNetworkError, ZERO_ADDRESS, ZERO_HASH, aesGcmDecrypt, aesGcmEncrypt, buildSignedBatchMessage, computeCallsHash, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, entropyToMnemonicString, entropyToSeed, evmSign, evmVerify, generateEntropy, generateNonce, getAuthNonce, getRandomBytes, hkdfSha256, mnemonicStringToEntropy, normalizeWalletError, sealMasterSeed, selectSigner, selectSigner$1 as selectSignerLegacy, signAuthorization, signSession, toChecksumAddress, unsealMasterSeed, uploadBlob, uploadBlobViaPresign, validateEntropy, zeroize };
package/dist/index.d.ts CHANGED
@@ -117,40 +117,58 @@ type WrapKey = Uint8Array & {
117
117
  type MasterSeed = Uint8Array & {
118
118
  readonly __brand: 'MasterSeed';
119
119
  };
120
+ /**
121
+ * Opaque type for Entropy (32 bytes = 256 bits)
122
+ * Used for BIP-39 mnemonic generation (24 words)
123
+ * This is a type-level marker to prevent accidental misuse
124
+ */
125
+ type Entropy = Uint8Array & {
126
+ readonly __brand: 'Entropy';
127
+ };
120
128
 
121
129
  /**
122
- * Opaque handle to master seed
123
- * Provides controlled access and ensures cleanup via destroy()
130
+ * Handle to master key material
131
+ * Provides controlled access to entropy and seed, with secure cleanup
124
132
  */
125
- type MasterSeedHandle = {
126
- /** Read-only access to master seed bytes */
127
- readonly bytes: MasterSeed;
128
- /** Destroy the handle and zeroize the seed */
133
+ type MasterKeyHandle = {
134
+ /** 32-byte entropy for BIP-39 mnemonic generation */
135
+ readonly entropy: Entropy;
136
+ /** 32-byte seed for BIP-32 key derivation */
137
+ readonly seed: MasterSeed;
138
+ /**
139
+ * Get mnemonic phrase for export (24 words)
140
+ *
141
+ * WARNING: Returned string cannot be zeroized.
142
+ * Only call this when user explicitly requests wallet export.
143
+ * Minimize retention time of the returned string.
144
+ */
145
+ getMnemonic(): string;
146
+ /** Destroy the handle and zeroize all sensitive data */
129
147
  destroy(): void;
130
148
  };
131
149
  /**
132
150
  * Master key provider interface
133
- * Handles generation and unsealing of master seeds
151
+ * Handles generation and unsealing of master keys
134
152
  */
135
153
  interface MasterKeyProvider {
136
154
  /**
137
- * Unseal master seed from encrypted blob
155
+ * Unseal entropy from encrypted blob and derive seed
138
156
  *
139
157
  * @param blob - Encrypted blob containing ciphertext, nonce, and AAD
140
158
  * @param wrapKey - Wrap key for decryption
141
- * @returns Handle to unsealed master seed
159
+ * @returns Handle to unsealed master key
142
160
  */
143
161
  unsealFromBlob(blob: {
144
162
  cipher: Uint8Array;
145
163
  nonce: Uint8Array;
146
164
  aad: Uint8Array;
147
- }, wrapKey: WrapKey): Promise<MasterSeedHandle>;
165
+ }, wrapKey: WrapKey): Promise<MasterKeyHandle>;
148
166
  /**
149
- * Generate a new master seed
167
+ * Generate a new master key (entropy + derived seed)
150
168
  *
151
- * @returns Handle to newly generated master seed
169
+ * @returns Handle to newly generated master key
152
170
  */
153
- generate(): Promise<MasterSeedHandle>;
171
+ generate(): Promise<MasterKeyHandle>;
154
172
  }
155
173
  /**
156
174
  * Create a master key provider instance
@@ -161,8 +179,15 @@ interface MasterKeyProvider {
161
179
  * ```ts
162
180
  * const provider = createMasterKeyProvider();
163
181
  * const handle = await provider.generate();
164
- * // Use handle.bytes for key derivation
165
- * handle.destroy(); // Cleanup
182
+ *
183
+ * // Use handle.seed for key derivation
184
+ * const keypair = deriveEvmKey({ masterSeed: handle.seed });
185
+ *
186
+ * // Export mnemonic when user requests (only for backup/migration)
187
+ * const mnemonic = handle.getMnemonic();
188
+ *
189
+ * // Cleanup
190
+ * handle.destroy();
166
191
  * ```
167
192
  */
168
193
  declare function createMasterKeyProvider(): MasterKeyProvider;
@@ -250,6 +275,69 @@ type PrfInput = {
250
275
  */
251
276
  declare function deriveWrapKey(input: PrfInput): WrapKey;
252
277
 
278
+ /**
279
+ * BIP-39 Mnemonic utilities
280
+ *
281
+ * Provides functions to generate entropy, convert to/from mnemonic strings,
282
+ * and derive seeds for key generation.
283
+ *
284
+ * Security Note:
285
+ * - Entropy (Uint8Array) can be zeroized after use
286
+ * - Mnemonic strings cannot be zeroized (JavaScript strings are immutable)
287
+ * - Only convert to mnemonic string when absolutely necessary (e.g., export)
288
+ */
289
+
290
+ /**
291
+ * Generate random entropy for BIP-39 mnemonic (256 bits = 24 words)
292
+ *
293
+ * @returns 32-byte entropy that can be converted to a 24-word mnemonic
294
+ *
295
+ * @example
296
+ * ```ts
297
+ * const entropy = generateEntropy();
298
+ * const mnemonic = entropyToMnemonicString(entropy);
299
+ * // ... use mnemonic for export
300
+ * zeroize(entropy);
301
+ * ```
302
+ */
303
+ declare function generateEntropy(): Entropy;
304
+ /**
305
+ * Validate entropy has correct length for 24-word mnemonic
306
+ *
307
+ * @param entropy - Entropy to validate
308
+ * @returns true if entropy is valid (32 bytes)
309
+ */
310
+ declare function validateEntropy(entropy: Entropy): boolean;
311
+ /**
312
+ * Convert entropy to BIP-39 mnemonic string (24 words)
313
+ *
314
+ * WARNING: Returned string cannot be zeroized. Minimize retention time.
315
+ * Only call this function when the user explicitly requests to export their wallet.
316
+ *
317
+ * @param entropy - 32-byte entropy
318
+ * @returns 24-word mnemonic phrase (space-separated)
319
+ */
320
+ declare function entropyToMnemonicString(entropy: Entropy): string;
321
+ /**
322
+ * Convert BIP-39 mnemonic string back to entropy
323
+ *
324
+ * @param mnemonic - 24-word mnemonic phrase (space-separated)
325
+ * @returns 32-byte entropy
326
+ * @throws Error if mnemonic is invalid
327
+ */
328
+ declare function mnemonicStringToEntropy(mnemonic: string): Entropy;
329
+ /**
330
+ * Derive BIP-39 seed from entropy
331
+ *
332
+ * This function internally converts entropy to a mnemonic string (temporarily),
333
+ * then uses PBKDF2 to derive the seed. The mnemonic string exists only within
334
+ * this function's scope.
335
+ *
336
+ * @param entropy - 32-byte entropy
337
+ * @returns 32-byte master seed for BIP-32 key derivation
338
+ */
339
+ declare function entropyToSeed(entropy: Entropy): Promise<MasterSeed>;
340
+
253
341
  /**
254
342
  * Default BIP-32 derivation path for Ethereum
255
343
  * m / purpose' / coin_type' / account' / change / address_index
@@ -1404,4 +1492,4 @@ type SelectSignerContext = {
1404
1492
  */
1405
1493
  declare function selectSigner(ctx: SelectSignerContext): Promise<SignerPort>;
1406
1494
 
1407
- export { type AesGcmParams, type AuthorizationTuple, type Call, ChainNotAddedError, DEFAULT_EVM_PATH, DOMAIN, type DeriveArgs, EIP1193ErrorCode, type EIP1193Provider, EIP712_DOMAIN, ERR_AAD_MISMATCH, ERR_CHAIN_MISMATCH, ERR_CRYPTO_FAIL, ERR_INVALID_PARAM, ERR_LOW_ENTROPY, ERR_NONCE_SIZE, type EvmKeypair, type ExtendedRPCClient, ExternalWalletSigner, type KeyStorageType, type Sig$1 as LegacySig, type MasterKeyProvider, type MasterSeed, type MasterSeedHandle, type MpcTransport, PasskeyP256Signer, type PasskeyProviderOptions, type PasskeyProviderPort, type PrecheckInput, type PrecheckQuote, type PrfInput, type RelayInput, type RelayMode, type RelayResult, RequestPendingError, type RpcLike, Secp256k1SoftwareSigner, type SelectSignerContext, type SessionAuth, type Sig, type SignerContext, type SignerKind, type SignerPort, TYPES, type TypedDataDomain, type TypedDataField, type TypedDataInput, type TypedDataTypes, UnauthorizedError, UnsupportedMethodError, type UploadBlobOptions, type UploadViaPresignOptions, UserRejectedError, VolrError, WalletError, type WalletProviderPort, type WrapKey, WrongNetworkError, ZERO_ADDRESS, ZERO_HASH, aesGcmDecrypt, aesGcmEncrypt, buildSignedBatchMessage, computeCallsHash, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, evmSign, evmVerify, generateNonce, getAuthNonce, getRandomBytes, hkdfSha256, normalizeWalletError, sealMasterSeed, selectSigner, selectSigner$1 as selectSignerLegacy, signAuthorization, signSession, toChecksumAddress, unsealMasterSeed, uploadBlob, uploadBlobViaPresign, zeroize };
1495
+ export { type AesGcmParams, type AuthorizationTuple, type Call, ChainNotAddedError, DEFAULT_EVM_PATH, DOMAIN, type DeriveArgs, EIP1193ErrorCode, type EIP1193Provider, EIP712_DOMAIN, ERR_AAD_MISMATCH, ERR_CHAIN_MISMATCH, ERR_CRYPTO_FAIL, ERR_INVALID_PARAM, ERR_LOW_ENTROPY, ERR_NONCE_SIZE, type Entropy, type EvmKeypair, type ExtendedRPCClient, ExternalWalletSigner, type KeyStorageType, type Sig$1 as LegacySig, type MasterKeyHandle, type MasterKeyProvider, type MasterSeed, type MpcTransport, PasskeyP256Signer, type PasskeyProviderOptions, type PasskeyProviderPort, type PrecheckInput, type PrecheckQuote, type PrfInput, type RelayInput, type RelayMode, type RelayResult, RequestPendingError, type RpcLike, Secp256k1SoftwareSigner, type SelectSignerContext, type SessionAuth, type Sig, type SignerContext, type SignerKind, type SignerPort, TYPES, type TypedDataDomain, type TypedDataField, type TypedDataInput, type TypedDataTypes, UnauthorizedError, UnsupportedMethodError, type UploadBlobOptions, type UploadViaPresignOptions, UserRejectedError, VolrError, WalletError, type WalletProviderPort, type WrapKey, WrongNetworkError, ZERO_ADDRESS, ZERO_HASH, aesGcmDecrypt, aesGcmEncrypt, buildSignedBatchMessage, computeCallsHash, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, entropyToMnemonicString, entropyToSeed, evmSign, evmVerify, generateEntropy, generateNonce, getAuthNonce, getRandomBytes, hkdfSha256, mnemonicStringToEntropy, normalizeWalletError, sealMasterSeed, selectSigner, selectSigner$1 as selectSignerLegacy, signAuthorization, signSession, toChecksumAddress, unsealMasterSeed, uploadBlob, uploadBlobViaPresign, validateEntropy, zeroize };
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { hkdf } from '@noble/hashes/hkdf';
2
2
  import { sha256 } from '@noble/hashes/sha256';
3
+ import { entropyToMnemonic, validateMnemonic, mnemonicToEntropy, mnemonicToSeed } from '@scure/bip39';
4
+ import { wordlist } from '@scure/bip39/wordlists/english';
3
5
  import { HDKey } from '@scure/bip32';
4
6
  import { secp256k1 } from '@noble/curves/secp256k1';
5
7
  import { keccak_256 } from '@noble/hashes/sha3';
@@ -193,32 +195,56 @@ async function unsealMasterSeed(cipher, wrapKey, aad, nonce) {
193
195
  const decrypted = await aesGcmDecrypt(cipher, { key: wrapKey, aad, nonce });
194
196
  return decrypted;
195
197
  }
198
+ function generateEntropy() {
199
+ return getRandomBytes(32);
200
+ }
201
+ function validateEntropy(entropy) {
202
+ return entropy instanceof Uint8Array && entropy.length === 32;
203
+ }
204
+ function entropyToMnemonicString(entropy) {
205
+ return entropyToMnemonic(entropy, wordlist);
206
+ }
207
+ function mnemonicStringToEntropy(mnemonic) {
208
+ if (!validateMnemonic(mnemonic, wordlist)) {
209
+ throw new Error("Invalid mnemonic phrase");
210
+ }
211
+ return mnemonicToEntropy(mnemonic, wordlist);
212
+ }
213
+ async function entropyToSeed(entropy) {
214
+ const mnemonic = entropyToMnemonic(entropy, wordlist);
215
+ const seed = await mnemonicToSeed(mnemonic);
216
+ return seed.slice(0, 32);
217
+ }
196
218
 
197
219
  // src/master-key/provider.ts
220
+ async function createHandle(entropy) {
221
+ const seed = await entropyToSeed(entropy);
222
+ return {
223
+ entropy,
224
+ seed,
225
+ getMnemonic() {
226
+ return entropyToMnemonicString(entropy);
227
+ },
228
+ destroy() {
229
+ zeroize(entropy);
230
+ zeroize(seed);
231
+ }
232
+ };
233
+ }
198
234
  function createMasterKeyProvider() {
199
235
  return {
200
236
  async unsealFromBlob(blob, wrapKey) {
201
- const masterSeed = await unsealMasterSeed(
237
+ const entropy = await unsealMasterSeed(
202
238
  blob.cipher,
203
239
  wrapKey,
204
240
  blob.aad,
205
241
  blob.nonce
206
242
  );
207
- return {
208
- bytes: masterSeed,
209
- destroy() {
210
- zeroize(masterSeed);
211
- }
212
- };
243
+ return createHandle(entropy);
213
244
  },
214
245
  async generate() {
215
- const masterSeed = getRandomBytes(32);
216
- return {
217
- bytes: masterSeed,
218
- destroy() {
219
- zeroize(masterSeed);
220
- }
221
- };
246
+ const entropy = generateEntropy();
247
+ return createHandle(entropy);
222
248
  }
223
249
  };
224
250
  }
@@ -1290,6 +1316,6 @@ async function selectSigner2(ctx) {
1290
1316
  );
1291
1317
  }
1292
1318
 
1293
- export { ChainNotAddedError, DEFAULT_EVM_PATH, DOMAIN, EIP1193ErrorCode, EIP712_DOMAIN, ERR_AAD_MISMATCH, ERR_CHAIN_MISMATCH, ERR_CRYPTO_FAIL, ERR_INVALID_PARAM, ERR_LOW_ENTROPY, ERR_NONCE_SIZE, ExternalWalletSigner, PasskeyP256Signer, RequestPendingError, Secp256k1SoftwareSigner, TYPES, UnauthorizedError, UnsupportedMethodError, UserRejectedError, VolrError, WalletError, WrongNetworkError, ZERO_ADDRESS, ZERO_HASH, aesGcmDecrypt, aesGcmEncrypt, buildSignedBatchMessage, computeCallsHash, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, evmSign, evmVerify, generateNonce, getAuthNonce, getRandomBytes, hkdfSha256, normalizeWalletError, sealMasterSeed, selectSigner, selectSigner2 as selectSignerLegacy, signAuthorization, signSession, toChecksumAddress, unsealMasterSeed, uploadBlob, uploadBlobViaPresign, zeroize };
1319
+ export { ChainNotAddedError, DEFAULT_EVM_PATH, DOMAIN, EIP1193ErrorCode, EIP712_DOMAIN, ERR_AAD_MISMATCH, ERR_CHAIN_MISMATCH, ERR_CRYPTO_FAIL, ERR_INVALID_PARAM, ERR_LOW_ENTROPY, ERR_NONCE_SIZE, ExternalWalletSigner, PasskeyP256Signer, RequestPendingError, Secp256k1SoftwareSigner, TYPES, UnauthorizedError, UnsupportedMethodError, UserRejectedError, VolrError, WalletError, WrongNetworkError, ZERO_ADDRESS, ZERO_HASH, aesGcmDecrypt, aesGcmEncrypt, buildSignedBatchMessage, computeCallsHash, createMasterKeyProvider, createMpcProvider, createPasskeyProvider, deriveEvmKey, deriveWrapKey, entropyToMnemonicString, entropyToSeed, evmSign, evmVerify, generateEntropy, generateNonce, getAuthNonce, getRandomBytes, hkdfSha256, mnemonicStringToEntropy, normalizeWalletError, sealMasterSeed, selectSigner, selectSigner2 as selectSignerLegacy, signAuthorization, signSession, toChecksumAddress, unsealMasterSeed, uploadBlob, uploadBlobViaPresign, validateEntropy, zeroize };
1294
1320
  //# sourceMappingURL=index.js.map
1295
1321
  //# sourceMappingURL=index.js.map