Conversation
9fbbd43 to
f78b977
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.
Ticket: WCN-172
This pull request refactors key decryption logic across multiple coin modules to use the asynchronous
decryptAsyncmethod instead of the synchronousdecryptmethod. Additionally, it updates the Web Crypto usage inencryptV2.tsto ensure compatibility with both browser and Node.js environments by using the correctsubtlecrypto implementation. These changes improve security, performance, and compatibility.Key Decryption Refactor
Migration to async decryption:
this.bitgo.decryptwithawait this.bitgo.decryptAsyncfor user and backup key decryption in the following coins and modules:abstractEthLikeNewCoins.ts,ethLikeToken.ts,erc20Token.ts,erc721Token.ts,avaxc.ts,eth.ts,etc.ts) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]abstractSubstrateCoin.ts,dot.ts,polyx.ts) [1] [2] [3] [4] [5] [6]Crypto Compatibility Improvements
Web Crypto subtle selection:
encryptV2.tsto use asubtlevariable that references either the browser'scrypto.subtleor Node'swebcrypto.subtle, ensuring compatibility across environments. All cryptographic operations (importKey,deriveKey,encrypt,decrypt) now use this unified reference. [1] [2] [3] [4] [5]These changes modernize the codebase to use asynchronous cryptography APIs, which is essential for non-blocking operations, and ensure that cryptographic functions work seamlessly in both browser and Node.js contexts.
WRW Local Test
Tested by wiring the modules from local BitGoJs (with these changes) into WRW. A HTETH wallet was created in staging with

encryptionVersion: 2. Before these changes, the following error would appear when attempting to use the WRW:With the changes wired up:
Screen.Recording.2026-05-21.at.5.47.35.PM.mov