fix(sdk-core): throw NeedUserSignupError when recipient has no ECDH pubkey#9215
Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Draft
fix(sdk-core): throw NeedUserSignupError when recipient has no ECDH pubkey#9215bitgo-ai-agent-dev[bot] wants to merge 1 commit into
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
Conversation
…ubkey When a user tries to share a wallet with a recipient whose ECDH keychain has not been initialized (pubkey is empty or missing from getSharingKey response), the previous code would proceed to decrypt the sharer's keychain and then fail with a cryptographic assertion error. The UI surface this as a misleading "wallet password incorrect" error. The fix adds a pubkey presence check inside prepareSharedKeychain, after confirming the wallet has an encrypted keychain to share. Cold wallets (no encryptedPrv) still silently skip keychain sharing as before. Ticket: POL-41 Session-Id: 2c2322e0-26a5-4458-974b-16c52d93e7e3 Task-Id: 372e9c2b-34e3-4aed-aaa1-62bc2c038f73
Contributor
3f6f77b to
85dccff
Compare
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.
What
prepareSharedKeychain, add a guard that throwsNeedUserSignupErrorwhen the recipient's ECDH pubkey is empty or missing but the wallet has an encrypted keychain to sharerecipientEmailthrough the call chain so the error message names the affected userWhy
/user/sharingkeyreturns an emptypubkey, the code decrypts the sharer's keychain successfully then passes an empty buffer to the ECDH function, which fails with a cryptographic assertion error — not a password errorbulkShareWalletpath already correctly throwsNeedUserSignupErrorfor this case; this alignsshareWalletwith the same behaviorencryptedPrv) are unaffected — the check only fires after confirming there is a keychain to encryptTest plan
should throw NeedUserSignupError when recipient has no ECDH pubkey (spend permission)— empty pubkeyshould throw NeedUserSignupError when recipient pubkey is missing (spend permission)— undefined pubkeyshould not throw NeedUserSignupError when recipient has no pubkey but permission is view-only— no keychain path, succeedsWallet Sharingtests continue to passsdk-coreTypeScript build is cleanTicket: POL-41