feat: make encrypt/decrypt async#9150
Conversation
4992a5e to
f9fa896
Compare
910a4ba to
e934715
Compare
|
NOTE: This is a breaking change and must be released as such |
|
@claude review and outline the breaking changes for clients clearly i.e what method they'll need to update. |
|
Claude finished @pranavjain97's task —— View job Breaking Changes Review ✅This PR introduces significant breaking changes that will affect all BitGoJS SDK clients. Here's a comprehensive breakdown: Todo List:
🚨 Breaking Changes for Clients1. Encryption/Decryption Method NamesREMOVED:
NEW:
Client Impact: // ❌ Before (will break)
const encrypted = await bitgo.encryptAsync({
password: 'password',
input: 'data'
});
const decrypted = await bitgo.decryptAsync({
password: 'password',
input: encrypted
});
// ✅ After (required changes)
const encrypted = await bitgo.encrypt({
password: 'password',
input: 'data'
});
const decrypted = await bitgo.decrypt({
password: 'password',
input: encrypted
});2. Key Verification MethodsREMOVED:
CHANGED:
Client Impact: // ❌ Before (will break)
const isValid = await verifyUserPublicKeyAsync(bitgo, params);
// ✅ After (required changes)
const isValid = await verifyUserPublicKey(bitgo, params);3. BaseCoin Interface ChangesREMOVED:
CHANGED:
Client Impact: // ❌ Before (will break)
coin.assertIsValidKey(params); // sync
// OR
await coin.assertIsValidKeyAsync(params);
// ✅ After (required changes)
await coin.assertIsValidKey(params); // now async4. Low-Level Encrypt Module ChangesFor clients using the low-level encrypt module directly: REMOVED:
NEW:
🔧 Migration GuideStep 1: Update Method NamesReplace all instances of:
Step 2: Add Async/AwaitEnsure all encryption/decryption calls are properly awaited:
Step 3: Update Type DefinitionsIf using TypeScript, update method signatures to reflect async nature: // Update function signatures that call these methods
async function myFunction() {
const result = await bitgo.encrypt({...});
// ...
}Step 4: Test Thoroughly
|
pranavjain97
left a comment
There was a problem hiding this comment.
lgtm! lets get @vmccarty to review as well, not sure how breaking change release notes are picked up (if they use commit message)
BREAKING CHANGE: synchronous encrypt/decrypt callsites removed
TICKET: WCN-174
In preparation for the Argon 2 migration notice, this pull request focuses on removing deprecated synchronous encryption and decryption methods in favor of their asynchronous (now renamed to drop the 'async' suffix) replacements across multiple modules. It also simplifies and modernizes key verification logic, updates related tests, and cleans up unused imports. The changes ensure consistency and future-proof the codebase by using only the preferred encryption/decryption interfaces.
Encryption/Decryption Method Updates
decryptAsyncandencryptAsyncwithdecryptandencryptthroughout the codebase, including inabstract-eth,abstract-lightning,abstract-substrate, andabstract-utxomodules. This affects key decryption for wallets, tokens, and recovery flows. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18]Key Verification Logic Refactor
verifyUserPublicKeyAsyncfunction and its usages, updating all references to use the now-asyncverifyUserPublicKeyfunction instead. Updated theAbstractUtxoCoinclass and related files to reflect this change. [1] [2] [3] [4] [5] [6]Test Suite Modernization
Code Cleanup
These changes collectively improve code consistency, remove deprecated interfaces, and prepare the codebase for future updates.