Skip to content

Migrate Trezor transport to Connect 10 with fenced cancellation - #239

Closed
sidhujag wants to merge 284 commits into
syscoin:mainfrom
sidhujag:codex/trezor-connect-10
Closed

sidhujag wants to merge 284 commits into
syscoin:mainfrom
sidhujag:codex/trezor-connect-10

Conversation

@sidhujag

@sidhujag sidhujag commented Nov 3, 2026

Copy link
Copy Markdown
Member

Moves the extension hardware adapter to Trezor Connect 10.0.1 and the supported Suite Desktop / Suite Web transport. Software-only imports remain isolated from browser hardware code. The upcoming keyring version is 1.0.629; this PR does not publish it.

The adapter normalizes Connect 10 errors and signatures, retains account/network/session signing guards, and rejects cancelled or stale results immediately. Raw cleanup is deferred while a remote request is pending because upstream disposal can trigger a new fallback window. Lock/destroy remain prompt; reconnection receives a terminal busy error until the old request settles. Suite Web may retain its old popup, whose late approval is discarded. No private upstream state mutation, global rejection suppression, or forced dependency overrides are used.

Validation: all 43 keyring suites / 1,395 tests passed; tsc and lint passed (three existing warnings). The full-suite diagnostic runner reported existing fixture timers and explicitly exited after the results, so natural full-suite process exit is not claimed. Focused tests exited normally. Independent actual Connect protocol checks cover Desktop/Web cancellation, held late responses, full keyring destruction and reconnect, wrong-origin/unknown-ID messages, and unknown errors without retries. All 141 packed distribution files were independently verified.

Candidate tarball SHA-256: b6bf9f244b3daf6ac84def44139000bcef443582c5aa295f530d538513bfd3a2. Pali must adopt the exact Suite origin in externally_connectable and pre-register the worker transport. Physical hardware/display confirmation is still required; mock transport tests do not establish device compatibility. A separate stacked cleanup will remove the legacy UTXO helper dependency before final Pali package qualification and npm publication.

jagdeep sidhu and others added 30 commits July 30, 2025 20:03
fixing v3/v4 signed compatibility
dont lookup by index but by named index
…hmac for ledger

to prevent silent failures we enable display=true to get xpub as a fallback (for unusual paths).

wallet hmac allows us to process non standard policies silently without requiring display
fix(keyring): derive concrete watch descriptor receive addresses
Add session-bound encryption for private application records
Guard formatted EVM sends at the final signing boundary
Use Node 26.12.1 and Yarn 1.22.22 for repository development and CI.
Keep published package versions and consumer engine requirements unchanged.
Pin SDK build and CI tooling to Node 26
…loors

fix: require patched syscoinjs in utils
…-floors

fix: require patched Bitcoin dependencies in keyring
refactor: isolate vault persistence behind async host storage
refactor: separate transaction hardware adapters from software core
feat: add an isolated software keyring entry
fix: preserve Pali EVM fee approvals in the shared keyring
build: omit compiled tests from keyring releases
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T19:53:25.979650Z 5e2e065 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sidhujag sidhujag closed this Nov 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e2e065d2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +664 to +666
const legacyKey = await this.deriveLegacySessionKey(password, salt);
decryptedVault = await this.vaultPersistence.getDecryptedVault(
legacyKey

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore raw-password decryption for existing CBC vaults

For wallets created by the pre-change initializeSession(), the vault is CryptoJS AES encrypted with the raw password, and vault-keys contains { hash, salt } without currentSessionSalt. This unlock path tries only the modern PBKDF2 key and then the 20,000-iteration PBKDF2 key; neither decrypts that existing format. Consequently, upgrading an ordinary existing wallet makes unlock(correctPassword) return { canLogin: false }. Authenticate and migrate the raw-password CBC format rather than treating every unmarked CBC vault as PBKDF2-encrypted.

Useful? React with 👍 / 👎.

Comment on lines +575 to +578
const oldSessionPassword = this.encryptSHA512(
password,
vaultKeys.currentSessionSalt
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use the historical HMAC key for session-salt migration

For legacy currentSessionSalt vaults whose mnemonic is encrypted with the old session key, this now derives the wrong recovery key. Before this commit, encryptSHA512() used HMAC-SHA512; its replacement uses PBKDF2, so the subsequent recovery attempts try the raw password and a PBKDF2 key instead of the historical HMAC key. A valid legacy vault therefore throws Legacy vault secret could not be recovered even with the correct password. Keep the historical HMAC derivation specifically for reading these legacy records.

Useful? React with 👍 / 👎.

Comment on lines +630 to +633
await this.vaultPersistence.setEncryptedVault(
{ mnemonic: decryptedMnemonic },
sessionPasswordKey
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve encrypted account keys when migrating the vault

When a currentSessionSalt vault has a plain or recoverable mnemonic, this migration succeeds but re-encrypts only the vault payload. Existing account xprv records were encrypted with the historical HMAC session key, while recreateSessionFromVault(sessionPasswordKey) installs the new PBKDF2 key. getDecryptedPrivateKey() and getPrivateKeyByAccountId() then try that new key against unchanged ciphertext, so unlock can succeed while existing imported accounts cannot sign or export their keys. Retain a compatible wrapping-key profile or migrate the encrypted account records before switching session keys; imported private keys cannot be reconstructed from the mnemonic.

Useful? React with 👍 / 👎.

Comment on lines +188 to +191
if (!tx.chainId) {
const network = await provider.getNetwork();
tx.chainId = Number(network.chainId);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject explicit chain IDs that differ from the provider

For a software account selected on chain 1, sendFormattedTransaction() can pass an explicit chainId: 137 through to this helper. verifyConfiguredChainId() verifies the RPC against its configured chain, not against the transaction, and this conditional checks the provider network only when the transaction omits its chain ID. The helper therefore signs a chain-137 envelope and attempts to broadcast it through the chain-1 provider instead of rejecting before signing, unlike the previous Wallet.sendTransaction() path. Compare any supplied transaction chain ID with the provider network before producing a signature.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants