@sidhujag/sysweb3-keyring 1.0.612 → 1.0.615

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/CHANGELOG.md ADDED
@@ -0,0 +1,61 @@
1
+ # Changelog
2
+
3
+ ## 1.0.615
4
+
5
+ ### Current hardware connection support
6
+
7
+ - Enable Trezor Connect's stable automatic Suite Desktop route and identify Pali Wallet in its permission prompt. Safe 7 requires this Suite flow; the legacy popup remains available through Connect's established fallback for older devices.
8
+ - Retain the production Connect origin and current transports. No beta Suite Web bridge, custom pairing state or dependency upgrade is introduced.
9
+ - Add compatibility tests for Nano Gen5, Flex and Stax through the installed Ledger WebHID library. The declared WebHID minimum already includes these model identifiers.
10
+
11
+ ### Host integration and validation limits
12
+
13
+ For Safe 7, open the current Trezor Suite Desktop, select and unlock the intended device/wallet, then approve Pali's request in Suite. The host must permit `ws://127.0.0.1:21335/connect-ws` in `connect-src`; allow this exact local endpoint rather than a broad `ws:` or localhost wildcard. Browser local-network permission must also permit the connection. Without Suite available, stable Connect can fall back to the legacy popup, which cannot serve Safe 7.
14
+
15
+ The current Safe family is Safe 3, Safe 5 and Safe 7. Future devices require support from Trezor's SDK and Suite; this release does not certify unannounced models. Ledger coverage is for USB/WebHID, including Nano Gen5, Flex and Stax, and retains existing signing protocols. Separate device-app availability, including the Syscoin app, must be checked per device model.
16
+
17
+ Automated validation exercises the actual installed Connect bundle and Ledger WebHID/model resolution with simulated browser/device I/O. This establishes host routing and protocol compatibility, not physical device signing, firmware certification or live transaction acceptance. The replacement signing protections from 1.0.614 remain intact.
18
+
19
+ ## 1.0.614
20
+
21
+ ### EVM Speed Up signing
22
+
23
+ - Authenticate the original signed transaction against its requested hash, selected gas payer and configured chain before credential or device access. Support signed types 0, 1 and 2; reject unsupported envelopes and unprotected legacy originals.
24
+ - Derive type-0/type-2 fee mode from the signed envelope. Preserve type-1 access lists; `isLegacy: true` retains type 1 for software/Ledger, while false converts it to type 2 using its signed gas price as the fee baseline. Trezor type-1 preservation is rejected before prompting; conversion to type 2 remains supported.
25
+ - Preview the maximum execution gas fee without signing or broadcasting. Sending requires an explicit approved ceiling. Final construction cannot exceed it, including when a zero-fee original needs a fresh RPC estimate.
26
+ - Select a local outer gas payer with `targetAccount` for smart-account replacements without changing the active account. Capture the provider and signed body across asynchronous work; check returned hardware signatures against the selected payer.
27
+ - Add an optional local-signing context check immediately before signing. Existing `beforeBroadcast` arguments keep their position and behavior.
28
+
29
+ ### Required caller migration
30
+
31
+ The old two-argument `sendTransactionWithEditedFee(hash, isLegacy)` send now throws `Replacement fee approval required`. Hosts must preview, show the maximum fee to the user, obtain approval, then send with that exact ceiling in decimal wei:
32
+
33
+ ```ts
34
+ const preview = await keyring.ethereumTransaction.sendTransactionWithEditedFee(
35
+ originalHash,
36
+ isLegacy,
37
+ { previewOnly: true, assertCurrentContext }
38
+ );
39
+ if (preview.error || preview.maximumFee === undefined) {
40
+ throw new Error('Replacement preview unavailable');
41
+ }
42
+
43
+ // Host UI displays this execution gas fee in the network's native currency.
44
+ // Approval is valid only for this original transaction and captured context.
45
+ if (await requestUserApproval(preview.maximumFee)) {
46
+ await keyring.ethereumTransaction.sendTransactionWithEditedFee(
47
+ originalHash,
48
+ isLegacy,
49
+ {
50
+ approvedMaximumFee: preview.maximumFee,
51
+ assertCurrentContext,
52
+ }
53
+ );
54
+ }
55
+ ```
56
+
57
+ `assertCurrentContext` is supplied by the host and must throw when the account, network, provider or unlock session changes, or the original is mined or superseded. Invalidate the quote when the approval UI closes. For smart accounts, pass the same outer payer `{ type, id }` as `targetAccount` to both calls, plus the host's `validateOriginal` and `beforeBroadcast` guards. Authentication and fee limits apply without these optional callbacks; session and UI lifecycle checks rely on the host supplying them. Do not persist signing payloads or approvals.
58
+
59
+ The ceiling is `gasLimit × gasPrice` for type 0/1, or `gasLimit × maxFeePerGas` for type 2. It covers execution gas, not separate chain-specific fee components. Existing max-send value adjustment and contract-call rejection are retained. This change applies to Speed Up; `cancelSentTransaction` and ordinary sends retain their existing contracts.
60
+
61
+ Ledger/Trezor dependencies, transports, initialization and signing wrapper APIs are unchanged. Automated tests use real signature reconstruction and protocol serialization with mocked device I/O. Physical device signing, firmware compatibility and live broadcasts remain unverified by this release candidate.
package/README.md CHANGED
@@ -14,6 +14,40 @@ The sysweb3-keyring provides a unified interface for managing accounts, transact
14
14
  - **Secure Session Management**: Encrypted private key handling with session transfer
15
15
  - **Transaction Management**: Full transaction lifecycle support for both network types
16
16
 
17
+ ## Vault encryption compatibility
18
+
19
+ New vaults require WebCrypto and use PBKDF2-HMAC-SHA-512 (900,000 production
20
+ iterations) with AES-256-GCM. Missing WebCrypto rejects the operation without
21
+ writing a weaker fallback vault. Restore WebCrypto availability before retrying
22
+ an unmarked legacy vault.
23
+
24
+ Historical fallback vaults used a 20,000-iteration key that also encrypted their
25
+ persisted account keys. After authenticating such a CBC vault, the keyring records
26
+ the explicit `pbkdf2-sha512-20000` compatibility profile and rewraps the vault with
27
+ AES-GCM. This preserves existing account access across restart; it is **not** a
28
+ full rekey of those account records to 900,000 iterations. The profile is written
29
+ before rewrapping, so interruption of either write remains recoverable. Arbitrary
30
+ KDF profiles or parameters are rejected.
31
+
32
+ Storage clients must return their asynchronous write/delete promises. The core
33
+ adapter preserves them so rejected writes do not silently advance vault migration.
34
+ Fresh wallet creation additionally requires conditional batch creation. Native
35
+ `chrome.storage.local` and `browser.storage.local` use a prefix-scoped Web Lock
36
+ around the absence check and awaited write, coordinating contexts in the same
37
+ extension origin and storage partition. Custom clients must provide an atomic
38
+ `createItemsIfAbsent(items)` backend operation over prefixed, JSON-serialized
39
+ values; the built-in memory client provides this operation synchronously.
40
+ There is no sequential or unlocked fallback. A backend shared across storage
41
+ partitions needs its own atomic implementation or a single owner.
42
+
43
+ ### Release order for 1.0.613
44
+
45
+ Publish `@sidhujag/sysweb3-core@1.0.29` before `@sidhujag/sysweb3-keyring@1.0.613`.
46
+ The updated lock entry describes that intended dependency; its integrity is
47
+ intentionally absent until publication. Regenerate and verify the lockfile from
48
+ the published registry artifacts before a clean registry installation. Local
49
+ validation uses the built package tarballs and does not establish publication.
50
+
17
51
  ## Installation
18
52
 
19
53
  ```bash
@@ -191,7 +225,11 @@ Main class for keyring operations:
191
225
 
192
226
  ## Security
193
227
 
194
- - Private keys are encrypted and stored in memory only
228
+ - `initializeSession`, `initializeWalletSecurely`, and the initialization factories create a new wallet only when both vault records are absent. Use `unlock()` to restore an existing wallet. Repeating initialization on a matching live session verifies the stored wallet without rewriting it.
229
+ - Fresh vault salt and ciphertext are created together only if both are absent, through the core conditional-creation operation. Native extension contexts sharing an origin/storage partition are coordinated by Web Locks; custom backends must provide atomic `createItemsIfAbsent`. Unsupported adapters are rejected before writing. Existing or incomplete records are preserved.
230
+ - UTXO signing authenticates the selected account's paths, public keys and spent scripts. A joint PSBT may include unfinished inputs for another signer: their HD/path hints are removed before the selected private signer runs, then their public metadata is restored to the returned partial PSBT. Another account in the same wallet remains unsigned. At least one unfinished input must authenticate to the selected account; a wholly finalized PSBT retains its existing handling. Standard P2WSH, wrapped P2WSH and P2SH multisig preserve external cosigner signatures and continuation. Hardware paths and single-address imports can reject unsupported joint inputs rather than widening signing authority.
231
+ - Hardware signing preserves already-finalized external inputs without requesting their private derivations. Trezor receives them as `EXTERNAL` inputs; Ledger retains their final scripts in PSBTv2 and skips signing/finalizing them again. Unfinished foreign hardware inputs remain unsupported.
232
+ - Persisted wallet and account secrets are encrypted; plaintext signing material is used in memory
195
233
  - Session data is cleared when the keyring is locked
196
234
  - Hardware wallet integration follows device security models
197
235
  - Secure memory management with explicit cleanup
@@ -171,6 +171,7 @@ class HardwareWalletManager extends events_1.EventEmitter {
171
171
  }
172
172
  await connect_webextension_1.default.init({
173
173
  manifest: {
174
+ appName: 'Pali Wallet',
174
175
  appUrl: 'https://paliwallet.com/',
175
176
  email: 'support@syscoin.org',
176
177
  },
@@ -180,7 +181,8 @@ class HardwareWalletManager extends events_1.EventEmitter {
180
181
  _extendWebextensionLifetime: true,
181
182
  transports: ['BridgeTransport', 'WebUsbTransport'],
182
183
  debug: false, // Disable debug mode to prevent extra logs
183
- coreMode: 'popup', // Use popup mode for webUSB support in Chrome extension
184
+ // Suite desktop handles newer devices; older devices retain the popup fallback.
185
+ coreMode: 'auto',
184
186
  });
185
187
  entry.status = ConnectionStatus.CONNECTED;
186
188
  entry.retryCount = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"hardware-wallet-manager.js","sourceRoot":"","sources":["../../src/hardware-wallet-manager.ts"],"names":[],"mappings":";;;;;;AACA,wFAAyD;AACzD,yCAAwC;AACxC,wFAAyD;AACzD,mCAAsC;AAEtC,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;AACnB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,iDAA6B,CAAA;IAC7B,6CAAyB,CAAA;IACzB,2CAAuB,CAAA;IACvB,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AA6BD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,qBAAY;IAcrD;QACE,KAAK,EAAE,CAAC;QAdF,mBAAc,GAAqC,IAAI,GAAG,EAAE,CAAC;QAC7D,0BAAqB,GAA0B,IAAI,CAAC;QAC3C,uBAAkB,GAAG,KAAK,CAAC,CAAC,aAAa;QACzC,iBAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;QAC1C,0BAAqB,GAAG,IAAI,CAAC,CAAC,YAAY;QAE1C,gBAAW,GAAgB;YAC1C,UAAU,EAAE,CAAC;YACb,SAAS,EAAE,IAAI,EAAE,WAAW;YAC5B,QAAQ,EAAE,KAAK,EAAE,aAAa;YAC9B,iBAAiB,EAAE,CAAC;SACrB,CAAC;QAIA,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,8B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B,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;gBAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC;gBACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;YACjC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC;YACtC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC;YAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;YAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAChC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,oDAAoD;QACpD,IACE,IAAI,KAAK,iBAAiB;YAC1B,IAAI,KAAK,YAAY;YACrB,IAAI,KAAK,YAAY;YACrB,IAAI,KAAK,gBAAgB;YACzB,IAAI,KAAK,cAAc,EACvB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhmBD,sDAgmBC"}
@@ -51,6 +51,7 @@ const BIP84 = __importStar(require("syscoinjs-lib/bip84-replacement"));
51
51
  // Reference embedded bitcoinjs from syscoinjs-lib
52
52
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
53
53
  const bjs = syscoinjs.utils.bitcoinjs;
54
+ const LEGACY_ENCRYPTION_KDF = 'pbkdf2-sha512-20000';
54
55
  const SLH_DSA_DERIVATION_VERSION = 1;
55
56
  // Preserve Pali v1 SLH derivation: first 32 bytes of the account-scoped HMAC.
56
57
  // Pali expands this setup secret into the 48-byte SLH skSeed/skPrf/pkSeed tuple.
@@ -68,6 +69,7 @@ const trezor_1 = require("./trezor");
68
69
  const types_1 = require("./types");
69
70
  const blockbook_cache_1 = require("./utils/blockbook-cache");
70
71
  const derivation_paths_1 = require("./utils/derivation-paths");
72
+ const psbt_account_scope_1 = require("./utils/psbt-account-scope");
71
73
  // Dynamic ETH HD path generation - will be computed as needed
72
74
  /**
73
75
  * Secure Buffer implementation for sensitive data
@@ -374,7 +376,7 @@ class KeyringManager {
374
376
  if (!vaultKeys || !vaultKeys.salt) {
375
377
  throw new Error('Vault keys not found');
376
378
  }
377
- const genPwd = await this.encryptSHA512Async(pwd, vaultKeys.salt);
379
+ const genPwd = await this.deriveStoredSessionKey(pwd, vaultKeys);
378
380
  if (this.getSessionPasswordString() !== genPwd) {
379
381
  throw new Error('Invalid password');
380
382
  }
@@ -426,7 +428,7 @@ class KeyringManager {
426
428
  if (!vaultKeys || !vaultKeys.salt) {
427
429
  throw new Error('Vault keys not found');
428
430
  }
429
- const genPwd = await this.encryptSHA512Async(pwd, vaultKeys.salt);
431
+ const genPwd = await this.deriveStoredSessionKey(pwd, vaultKeys);
430
432
  if (this.getSessionPasswordString() !== genPwd) {
431
433
  throw new Error('Invalid password');
432
434
  }
@@ -558,7 +560,7 @@ class KeyringManager {
558
560
  if (!vaultKeys || !vaultKeys.salt) {
559
561
  throw new Error('Vault keys not found');
560
562
  }
561
- const genPwd = await this.encryptSHA512Async(pwd, vaultKeys.salt);
563
+ const genPwd = await this.deriveStoredSessionKey(pwd, vaultKeys);
562
564
  if (!this.sessionPassword) {
563
565
  throw new Error('Unlock wallet first');
564
566
  }
@@ -683,10 +685,11 @@ class KeyringManager {
683
685
  * PRIVATE METHODS
684
686
  */
685
687
  // ===================================== AUXILIARY METHOD - FOR TRANSACTIONS CLASSES ===================================== //
686
- this.getDecryptedPrivateKey = () => {
688
+ this.getDecryptedPrivateKey = (targetAccount) => {
687
689
  try {
688
690
  const vault = this.getVault();
689
- const { accounts, activeAccount } = vault;
691
+ const { accounts } = vault;
692
+ const activeAccount = targetAccount || vault.activeAccount;
690
693
  const activeAccountId = activeAccount.id;
691
694
  const activeAccountType = activeAccount.type;
692
695
  const isLedger = activeAccountType === types_1.KeyringAccountType.Ledger;
@@ -755,6 +758,33 @@ class KeyringManager {
755
758
  throw error;
756
759
  }
757
760
  };
761
+ this.capturePsbtSigningContext = () => {
762
+ const session = this.sessionPassword;
763
+ const vault = this.getVault();
764
+ const selected = { ...vault.activeAccount };
765
+ const account = vault.accounts[selected.type]?.[selected.id];
766
+ const identity = { address: account?.address, xpub: account?.xpub };
767
+ const network = { ...vault.activeNetwork };
768
+ const assertCurrent = () => {
769
+ const current = this.getVault();
770
+ const currentAccount = current.accounts[selected.type]?.[selected.id];
771
+ if (!session ||
772
+ session.isCleared() ||
773
+ this.sessionPassword !== session ||
774
+ current.activeAccount.id !== selected.id ||
775
+ current.activeAccount.type !== selected.type ||
776
+ currentAccount?.address !== identity.address ||
777
+ currentAccount?.xpub !== identity.xpub ||
778
+ current.activeNetwork.kind !== network.kind ||
779
+ current.activeNetwork.chainId !== network.chainId ||
780
+ current.activeNetwork.slip44 !== network.slip44 ||
781
+ current.activeNetwork.url !== network.url) {
782
+ throw new Error('Wallet signing context changed');
783
+ }
784
+ };
785
+ assertCurrent();
786
+ return assertCurrent;
787
+ };
758
788
  this.getSigner = () => {
759
789
  if (!this.sessionPassword) {
760
790
  throw new Error('Wallet is locked cant proceed with transaction');
@@ -766,6 +796,7 @@ class KeyringManager {
766
796
  const { activeAccount } = vault;
767
797
  const accountId = activeAccount.id;
768
798
  const accountType = activeAccount.type;
799
+ const assertCurrent = this.capturePsbtSigningContext();
769
800
  // Determine signer type: HD or WIF single-address
770
801
  let signerForUse;
771
802
  if (accountType === types_1.KeyringAccountType.HDAccount) {
@@ -801,6 +832,33 @@ class KeyringManager {
801
832
  else {
802
833
  throw new Error(`Unsupported account type for UTXO signing: ${accountType}`);
803
834
  }
835
+ const scope = {
836
+ account: vault.accounts[accountType][accountId],
837
+ accountId,
838
+ accountType,
839
+ network: vault.activeNetwork,
840
+ };
841
+ if (typeof signerForUse.getRootNode === 'function') {
842
+ const getRootNode = signerForUse.getRootNode.bind(signerForUse);
843
+ const guardPath = (0, psbt_account_scope_1.createPsbtDerivationGuard)(scope);
844
+ signerForUse.getRootNode = () => {
845
+ const root = getRootNode();
846
+ const scopedRoot = Object.create(root);
847
+ scopedRoot.derivePath = (path) => {
848
+ guardPath(path);
849
+ return root.derivePath(path);
850
+ };
851
+ return scopedRoot;
852
+ };
853
+ }
854
+ const sign = signerForUse.sign.bind(signerForUse);
855
+ signerForUse.sign = async (psbt) => {
856
+ assertCurrent();
857
+ (0, psbt_account_scope_1.assertPsbtAccountScope)(psbt, scope);
858
+ const result = await sign(psbt);
859
+ assertCurrent();
860
+ return result;
861
+ };
804
862
  // Create syscoinjs instance with current network (no need to attach signer for signing flow)
805
863
  const network = vault.activeNetwork;
806
864
  const networkConfig = (0, sysweb3_network_1.getNetworkConfig)(network.slip44, network.currency);
@@ -1022,51 +1080,65 @@ class KeyringManager {
1022
1080
  if (!BIP84.validateMnemonic(seedPhrase)) {
1023
1081
  throw new Error('Invalid Seed');
1024
1082
  }
1025
- let foundVaultKeys = true;
1026
- let salt = '';
1027
- const vaultKeys = await this.storage.get('vault-keys');
1028
- if (!vaultKeys || !vaultKeys.salt) {
1029
- foundVaultKeys = false;
1030
- salt = crypto_1.default.randomBytes(16).toString('hex');
1031
- }
1032
- else {
1033
- salt = vaultKeys.salt;
1034
- }
1035
- // v4 stores only the salt on disk (vault-keys.salt).
1036
- // The derived session encryption key must remain in memory only.
1037
- const sessionPasswordSaltedHash = await this.encryptSHA512Async(password, salt);
1038
- if (!foundVaultKeys) {
1039
- // Store vault-keys using the storage abstraction
1040
- await this.storage.set('vault-keys', {
1041
- salt,
1042
- });
1043
- }
1044
- // Check if already initialized with the same password (idempotent behavior)
1045
- if (this.sessionPassword) {
1046
- if (sessionPasswordSaltedHash === this.getSessionPasswordString()) {
1083
+ const [vault, vaultKeys] = await Promise.all([
1084
+ this.storage.get('vault'),
1085
+ this.storage.get('vault-keys'),
1086
+ ]);
1087
+ const hasVault = vault !== undefined && vault !== null;
1088
+ const hasVaultKeys = vaultKeys !== undefined && vaultKeys !== null;
1089
+ const livePassword = this.sessionPassword;
1090
+ const liveMnemonic = this.sessionMnemonic;
1091
+ // Only an already-unlocked, matching session may repeat initialization.
1092
+ // Restoring any existing wallet must use unlock(), never rewrite its vault.
1093
+ if (livePassword &&
1094
+ liveMnemonic &&
1095
+ !livePassword.isCleared() &&
1096
+ !liveMnemonic.isCleared()) {
1097
+ if (!hasVault || !hasVaultKeys || !vaultKeys.salt) {
1098
+ throw new Error('Cannot initialize a new vault over existing wallet storage');
1099
+ }
1100
+ const sessionPasswordSaltedHash = await this.deriveStoredSessionKey(password, vaultKeys);
1101
+ if (livePassword === this.sessionPassword &&
1102
+ liveMnemonic === this.sessionMnemonic &&
1103
+ sessionPasswordSaltedHash === this.getSessionPasswordString()) {
1047
1104
  // Same password - check if it's the same mnemonic to ensure full idempotency
1105
+ let currentMnemonic;
1048
1106
  try {
1049
- const currentMnemonic = this.withSecureData((sessionPwd, sessionMnemonic) => {
1107
+ currentMnemonic = this.withSecureData((sessionPwd, sessionMnemonic) => {
1050
1108
  return crypto_js_1.default.AES.decrypt(sessionMnemonic, sessionPwd).toString(crypto_js_1.default.enc.Utf8);
1051
1109
  });
1052
- if (currentMnemonic === seedPhrase) {
1053
- // Same mnemonic and password - already initialized
1054
- return;
1055
- }
1056
1110
  }
1057
1111
  catch (error) {
1058
1112
  // If we can't decrypt, fall through to error
1059
1113
  }
1114
+ if (currentMnemonic === seedPhrase) {
1115
+ const storedVault = await (0, storage_1.getDecryptedVault)(sessionPasswordSaltedHash);
1116
+ if (livePassword === this.sessionPassword &&
1117
+ liveMnemonic === this.sessionMnemonic &&
1118
+ !livePassword.isCleared() &&
1119
+ !liveMnemonic.isCleared() &&
1120
+ storedVault?.mnemonic === seedPhrase) {
1121
+ // This is a read-only identity check, not a second vault write.
1122
+ return;
1123
+ }
1124
+ }
1060
1125
  }
1061
1126
  // Different password or mnemonic - this is not a simple re-initialization
1062
- throw new Error('Wallet already initialized with different parameters. Create a new keyring instance for different parameters.');
1127
+ throw new Error('Wallet already initialized with different parameters. Unlock the existing wallet or explicitly remove it before starting setup.');
1128
+ }
1129
+ if (hasVault || hasVaultKeys) {
1130
+ throw new Error('Cannot initialize a new vault over existing wallet storage');
1063
1131
  }
1132
+ const salt = crypto_1.default.randomBytes(16).toString('hex');
1133
+ // v4 stores only the salt on disk. A genuinely fresh initialization always
1134
+ // commits its own salt and ciphertext together under the vault mutex.
1135
+ const sessionPasswordSaltedHash = await this.deriveStoredSessionKey(password, { salt });
1064
1136
  // Encrypt and store vault (mnemonic storage) - now uses single vault for all networks
1065
1137
  await (0, storage_1.setEncryptedVault)({
1066
1138
  mnemonic: seedPhrase, // Store plain mnemonic - setEncryptedVault will encrypt the entire vault
1067
1139
  },
1068
1140
  // v4 vault is encrypted with the derived session password key (PBKDF2 output)
1069
- sessionPasswordSaltedHash);
1141
+ sessionPasswordSaltedHash, { salt });
1070
1142
  await this.recreateSessionFromVault(sessionPasswordSaltedHash);
1071
1143
  };
1072
1144
  // NEW: Create first account without signer setup
@@ -1108,9 +1180,7 @@ class KeyringManager {
1108
1180
  };
1109
1181
  this.storage = sysweb3.sysweb3Di.getStateStorageDb();
1110
1182
  // Don't initialize secure buffers in constructor - they're created on unlock
1111
- this.storage.set('utf8Error', {
1112
- hasUtf8Error: false,
1113
- });
1183
+ this.writeUtf8Diagnostic(false);
1114
1184
  // NOTE: activeChain is now derived from vault state, not stored locally
1115
1185
  // NOTE: No more persistent signers - use getSigner() for fresh on-demand signers
1116
1186
  this.utf8Error = false;
@@ -1123,7 +1193,7 @@ class KeyringManager {
1123
1193
  this.trezorSigner = new trezor_1.TrezorKeyring();
1124
1194
  this.ledgerSigner = new ledger_1.LedgerKeyring(hardwareManager);
1125
1195
  // this.syscoinTransaction = SyscoinTransactions();
1126
- this.syscoinTransaction = new transactions_1.SyscoinTransactions(this.getSigner, this.getReadOnlySigner, this.getAccountsState, this.getAddress, this.ledgerSigner, this.trezorSigner);
1196
+ this.syscoinTransaction = new transactions_1.SyscoinTransactions(this.getSigner, this.getReadOnlySigner, this.getAccountsState, this.getAddress, this.ledgerSigner, this.trezorSigner, this.capturePsbtSigningContext);
1127
1197
  this.ethereumTransaction = new transactions_1.EthereumTransactions(this.getNetwork, this.getDecryptedPrivateKey, this.getAccountsState, this.ledgerSigner, this.trezorSigner);
1128
1198
  }
1129
1199
  // Static factory method for creating a fully initialized KeyringManager with slip44 support
@@ -1166,7 +1236,7 @@ class KeyringManager {
1166
1236
  const { salt } = vaultKeys;
1167
1237
  // Derive session encryption key (in-memory only) used to encrypt/decrypt xprv fields
1168
1238
  // IMPORTANT: This MUST NOT be the same value as the stored verifier above.
1169
- const sessionPasswordKey = await this.encryptSHA512Async(password, salt);
1239
+ let sessionPasswordKey = await this.deriveStoredSessionKey(password, vaultKeys);
1170
1240
  // Handle migration from old vault format with currentSessionSalt
1171
1241
  if (vaultKeys.currentSessionSalt) {
1172
1242
  console.log('[KeyringManager] Detected old vault format, handling session migration...');
@@ -1227,8 +1297,44 @@ class KeyringManager {
1227
1297
  }
1228
1298
  // v4 vault is encrypted with the derived session password key (PBKDF2 output).
1229
1299
  // If the password is wrong, this will throw and we return canLogin:false below.
1230
- await (0, storage_1.getDecryptedVault)(sessionPasswordKey);
1300
+ let decryptedVault;
1301
+ let legacyProfile = vaultKeys.keyDerivation === LEGACY_ENCRYPTION_KDF;
1302
+ try {
1303
+ decryptedVault = await (0, storage_1.getDecryptedVault)(sessionPasswordKey);
1304
+ }
1305
+ catch (error) {
1306
+ // Only the historical CBC fallback used the 20k key without metadata.
1307
+ // Never try it for GCM, malformed records, or platform/storage failures.
1308
+ const rawVault = error instanceof storage_1.VaultAuthenticationError &&
1309
+ !vaultKeys.keyDerivation &&
1310
+ !vaultKeys.currentSessionSalt
1311
+ ? await this.storage.get('vault')
1312
+ : undefined;
1313
+ if (typeof rawVault !== 'string' || rawVault.trim().startsWith('{')) {
1314
+ throw error;
1315
+ }
1316
+ const legacyKey = await this.deriveLegacySessionKey(password, salt);
1317
+ decryptedVault = await (0, storage_1.getDecryptedVault)(legacyKey);
1318
+ authenticated = true;
1319
+ sessionPasswordKey = legacyKey;
1320
+ // Keep the historical account wrapping key. Persist its profile before
1321
+ // GCM rewrapping so either interrupted write remains recoverable.
1322
+ await this.storage.set('vault-keys', {
1323
+ ...vaultKeys,
1324
+ keyDerivation: LEGACY_ENCRYPTION_KDF,
1325
+ });
1326
+ legacyProfile = true;
1327
+ }
1231
1328
  authenticated = true;
1329
+ if (legacyProfile && this.hasWebCrypto()) {
1330
+ const storedVault = await this.storage.get('vault');
1331
+ if (typeof storedVault === 'string' &&
1332
+ !storedVault.trim().startsWith('{')) {
1333
+ // A failed earlier rewrap can leave the authenticated profile plus
1334
+ // CBC. Retry that write without changing the account wrapping key.
1335
+ await (0, storage_1.setEncryptedVault)(decryptedVault, sessionPasswordKey);
1336
+ }
1337
+ }
1232
1338
  // If session data missing or corrupted, recreate from vault
1233
1339
  if (!this.sessionMnemonic) {
1234
1340
  await this.recreateSessionFromVault(sessionPasswordKey);
@@ -1238,7 +1344,7 @@ class KeyringManager {
1238
1344
  // so we must restore the real class instance on unlock.
1239
1345
  if (!this.syscoinTransaction ||
1240
1346
  typeof this.syscoinTransaction.getRecommendedFee !== 'function') {
1241
- this.syscoinTransaction = new transactions_1.SyscoinTransactions(this.getSigner, this.getReadOnlySigner, this.getAccountsState, this.getAddress, this.ledgerSigner, this.trezorSigner);
1347
+ this.syscoinTransaction = new transactions_1.SyscoinTransactions(this.getSigner, this.getReadOnlySigner, this.getAccountsState, this.getAddress, this.ledgerSigner, this.trezorSigner, this.capturePsbtSigningContext);
1242
1348
  }
1243
1349
  // NOTE: Active account management is now handled by vault state/Redux
1244
1350
  // No need to explicitly set active account after unlock - it's managed externally
@@ -1576,11 +1682,20 @@ class KeyringManager {
1576
1682
  return { isValid: false, message: error.message };
1577
1683
  }
1578
1684
  }
1685
+ writeUtf8Diagnostic(hasUtf8Error) {
1686
+ try {
1687
+ void Promise.resolve(this.storage.set('utf8Error', { hasUtf8Error })).catch(() => undefined);
1688
+ }
1689
+ catch {
1690
+ // This diagnostic must not interrupt authentication or become an
1691
+ // unhandled rejection when an asynchronous storage client is offline.
1692
+ }
1693
+ }
1579
1694
  validateAndHandleErrorByMessage(message) {
1580
1695
  const utf8ErrorMessage = 'Malformed UTF-8 data';
1581
1696
  if (message.includes(utf8ErrorMessage) ||
1582
1697
  message.toLowerCase().includes(utf8ErrorMessage.toLowerCase())) {
1583
- this.storage.set('utf8Error', { hasUtf8Error: true });
1698
+ this.writeUtf8Diagnostic(true);
1584
1699
  }
1585
1700
  }
1586
1701
  async pbkdf2WebCryptoHex(params) {
@@ -1608,7 +1723,33 @@ class KeyringManager {
1608
1723
  hash: 'SHA-512',
1609
1724
  });
1610
1725
  }
1611
- return this.encryptSHA512(password, salt);
1726
+ throw new Error('WebCrypto is required for vault key derivation');
1727
+ }
1728
+ async deriveLegacySessionKey(password, salt) {
1729
+ if (this.hasWebCrypto()) {
1730
+ return this.pbkdf2WebCryptoHex({
1731
+ password,
1732
+ saltHex: salt,
1733
+ iterations: 20000,
1734
+ lengthBytes: 32,
1735
+ hash: 'SHA-512',
1736
+ });
1737
+ }
1738
+ // Read compatibility only; new vault writes still require WebCrypto.
1739
+ return crypto_js_1.default.PBKDF2(password, crypto_js_1.default.enc.Hex.parse(salt), {
1740
+ keySize: 256 / 32,
1741
+ iterations: 20000,
1742
+ hasher: crypto_js_1.default.algo.SHA512,
1743
+ }).toString();
1744
+ }
1745
+ async deriveStoredSessionKey(password, vaultKeys) {
1746
+ if (vaultKeys.keyDerivation === LEGACY_ENCRYPTION_KDF) {
1747
+ return this.deriveLegacySessionKey(password, vaultKeys.salt);
1748
+ }
1749
+ if (vaultKeys.keyDerivation !== undefined) {
1750
+ throw new Error('Unsupported vault key derivation profile');
1751
+ }
1752
+ return this.encryptSHA512Async(password, vaultKeys.salt);
1612
1753
  }
1613
1754
  async _createTrezorAccount(coin, slip44, index, label) {
1614
1755
  const vault = this.getVault();