fix(terminal): sign as the RFC-0022 product account - #366
Open
Imod7 wants to merge 7 commits into
Open
Conversation
📦 Bundle size impactComparing
Thresholds — 🟡 ≥10% or ≥5.0 KB · 🟠 ≥20% or ≥15.0 KB (bundled). Percentage only applies once the baseline is ≥ 10 KB. Informational — this check never blocks merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #168
Description
Product accounts were derived with three soft junctions from the session's root public key, which predates RFC-0022. RFC-0022 made
//product//{productId}two hard junctions, and a public key cannot cross those, so the derived address stopped matching the one the hosts use. The subtree key now comes from the paired wallet viagetProductSubtree, and the account is soft-derived from it.Product-account addresses change as a result, so anything funded at a previously derived address, or any allowance granted to one, is worth checking before upgrading. Signing failed closed in the meantime: the wallet resolves an account selector rather than a key, so it signed as the correct account and transactions were rejected rather than misapplied.
Changes
deriveProductAccountPublicKey(productSubtreePublicKey, derivationIndex)replaces the three-argument form, andcreateChainCodeis gone.createSessionSigner,createSessionSignerForAccountandderiveProductPublicKeyreturn promises, since the first derivation per product costs one consent-free round trip to the phone, cached afterwards. The RFC-0022 index expansion moves to@parity/product-sdk-utils, shared withpackages/individuality.Testing
The old fixtures were generated from the implementation they were meant to check, so they froze the wrong answer. The test now derives the subtree from a seed and matches host-rust-core's own vector in
truapi-server/tests/wasm_crypto_vectors.rs(0x1c1ae478...21cd5b5c).1985 tests pass across 19 packages, terminal 196 including both interop suites. Not covered: signing against a physically paired phone.