@midnight-ntwrk/wallet-sdk-hd 3.1.0-beta.2 → 3.1.0-beta.3

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.
@@ -40,8 +40,11 @@ export declare class HDWallet {
40
40
  static fromSeed(seed: Uint8Array): HDWalletResult;
41
41
  selectAccount(account: number): AccountKey;
42
42
  /**
43
- * Once all keys are derived - clear internals from private data, so that they do not reside in memory longer than
44
- * needed.
43
+ * Wipes the root key's private-key buffer, narrowing the window in which the seed is reachable.
44
+ *
45
+ * It does not reach the intermediate keys BIP32 allocates at each level of a derivation path, nor the derived keys
46
+ * already handed to callers — neither is reachable from here, so both are left to the garbage collector. Call this
47
+ * once all keys are derived, but do not read it as a guarantee that the seed is gone from the process.
45
48
  */
46
49
  clear(): void;
47
50
  }
package/dist/HDWallet.js CHANGED
@@ -61,8 +61,11 @@ export class HDWallet {
61
61
  return new AccountKey(this.rootKey, account);
62
62
  }
63
63
  /**
64
- * Once all keys are derived - clear internals from private data, so that they do not reside in memory longer than
65
- * needed.
64
+ * Wipes the root key's private-key buffer, narrowing the window in which the seed is reachable.
65
+ *
66
+ * It does not reach the intermediate keys BIP32 allocates at each level of a derivation path, nor the derived keys
67
+ * already handed to callers — neither is reachable from here, so both are left to the garbage collector. Call this
68
+ * once all keys are derived, but do not read it as a guarantee that the seed is gone from the process.
66
69
  */
67
70
  clear() {
68
71
  this.rootKey.wipePrivateData();
@@ -67,7 +67,7 @@ export const WalletSeeds = {
67
67
  .selectAccount(account)
68
68
  .selectRoles([Roles.Zswap, unshieldedRole, Roles.Dust])
69
69
  .deriveKeysAt(addressIndex);
70
- // Wiped whether or not the derivation succeeded: a failed walk is no reason to leave the tree open.
70
+ // Wiped whether or not the derivation succeeded: a failed walk is no reason to leave the root key live.
71
71
  opened.hdWallet.clear();
72
72
  if (derived.type !== 'keysDerived') {
73
73
  throw new SeedDerivationError(`No key exists at account ${account}, address index ${addressIndex} for ${derived.roles.length === 1 ? 'role' : 'roles'} ` +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midnight-ntwrk/wallet-sdk-hd",
3
- "version": "3.1.0-beta.2",
3
+ "version": "3.1.0-beta.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",