fix(sdk-coin-ada,sdk-coin-iota): validate precomputed EdDSA signing material - #9580
Merged
Marzooqa merged 1 commit intoAug 28, 2026
Conversation
Contributor
…aterial Discovered while manually verifying ADA/IOTA non-BitGo recovery against Wallet Recovery Wizard on staging: WRW's generic Electron 'recover' IPC handler always passes a second positional argument (openSSLBytes, meant only for EVM-like coins) to every coin's recover() call. Ada.recover() and Iota.recover() accept an optional second positional parameter of their own (precomputedMaterial, used by recoverConsolidations() to avoid re-decrypting the keycard per scanned index), so that ArrayBuffer was silently misinterpreted as signing material, causing: JSON.parse(signingMaterial.userPrv) -> JSON.parse(undefined) -> SyntaxError: "undefined" is not valid JSON Add a shared isEddsaSigningMaterial() type guard to sdk-core (next to EddsaSigningMaterial/getEddsaSigningMaterial/signEddsaMpcV2RecoveryTx) and use it in Ada/Iota's signRecoveryTransaction() before trusting a caller-supplied precomputedMaterial, falling back to real detection otherwise. This mirrors the guard sdk-coin-dot already had in place when it added the same optimization, which is why DOT was unaffected. Verified end-to-end: ADA and IOTA non-BitGo recovery via WRW against staging now build and broadcast signed transactions successfully. TICKET: WCI-1460
Marzooqa
force-pushed
the
marzooqakather498/wci-1460-test-iota-dkg-dsg-and-recovery-flows-on-staging
branch
from
August 27, 2026 10:23
128a8b8 to
6d30f56
Compare
Contributor
Author
Contributor
|
Claude finished @Marzooqa's task —— View job Code Review Complete ✅Todo List
🔍 Review SummaryThis is an excellent, focused fix that resolves a real-world bug affecting ADA and IOTA wallet recovery. The solution is well-architected and thoroughly tested. ✅ Positive Aspects1. Root Cause Analysis
2. Smart Code Reuse
3. Robust Type Guard ImplementationThe type guard validation is comprehensive: export function isEddsaSigningMaterial(value: unknown): value is EddsaSigningMaterial {
if (typeof value !== 'object' || value === null) return false;
if (!('version' in value)) return false;
if (value.version === 'v1') {
return 'userPrv' in value && typeof value.userPrv === 'string';
}
if (value.version === 'v2') {
return 'encryptedUserKey' in value && typeof value.encryptedUserKey === 'string';
}
return false;
}4. Correct Integration in Coin ImplementationsBoth ADA and IOTA use the validation properly:
5. Excellent Test Coverage
🔧 Technical Implementation QualitySecurity Considerations ✅
Performance Impact ✅
Backward Compatibility ✅
📋 Minor Observations
🎯 VerificationThe fix addresses the exact error described in the PR: By validating the shape before trusting ✨ RecommendationAPPROVE - This is a high-quality fix that:
The implementation is minimal, focused, and exactly addresses the problem without over-engineering. Job Run: View Details |
OttoAllmendinger
approved these changes
Aug 27, 2026
rishikeshdadam136
approved these changes
Aug 28, 2026
parasgarg-bitgo
approved these changes
Aug 28, 2026
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.
Summary
Found while manually testing ADA/NEAR/TON/IOTA non-BitGo recovery end-to-end through the Wallet Recovery Wizard against staging (see WCI-1460).
Wallet Recovery Wizard's generic Electron
recoverIPC handler always passes a second positional argument (openSSLBytes, anArrayBuffermeant only for EVM-like coins) to every coin'srecover()call:Ada.recover()andIota.recover()both accept an optional second parameter of their own —precomputedMaterial, used byrecoverConsolidations()to avoid re-decrypting the keycard once per scanned index. WRW's strayopenSSLBytesargument gets silently misinterpreted as that signing material:sdk-coin-dotalready guards against exactly this with a localisEddsaSigningMaterial()type guard (added when DOT'srecoverConsolidationswas written) — which is why DOT was unaffected. This PR extracts that guard intosdk-core(next toEddsaSigningMaterial/getEddsaSigningMaterial/signEddsaMpcV2RecoveryTx) and applies it in ADA and IOTA'ssignRecoveryTransaction().sdk-coin-suihas the same latent issue but is intentionally left untouched in this PR (out of scope — no SUI changes requested).Changes
sdk-core: add and exportisEddsaSigningMaterial()type guardsdk-coin-ada: validateprecomputedMaterialshape before trusting it insignRecoveryTransaction()sdk-coin-iota: sameTest plan
yarn unit-testforsdk-coin-ada(183 passing) andsdk-coin-iota(255 passing)tsc --buildandeslintclean for all touched packagesTICKET: WCI-1460
🤖 Generated with Claude Code