@@ -1751,7 +1751,10 @@ Wallet.prototype.createAndSignTransaction = function (params, callback) {
17511751 const safeUserKey = _ . get ( this . wallet , 'private.userPrivKey' ) ;
17521752 if ( _ . isString ( safeUserKey ) && _ . isString ( params . walletPassphrase ) ) {
17531753 // @ts -expect-error - no implicit this
1754- transaction . signingKey = this . bitgo . decrypt ( { password : params . walletPassphrase , input : safeUserKey } ) ;
1754+ transaction . signingKey = await this . bitgo . decryptAsync ( {
1755+ password : params . walletPassphrase ,
1756+ input : safeUserKey ,
1757+ } ) ;
17551758 } else {
17561759 throw e ;
17571760 }
@@ -1809,10 +1812,13 @@ Wallet.prototype.getAndPrepareSigningKeychain = function (params, callback) {
18091812
18101813 // Caller provided a wallet passphrase
18111814 if ( params . walletPassphrase ) {
1812- return self . getEncryptedUserKeychain ( ) . then ( function ( keychain ) {
1815+ return self . getEncryptedUserKeychain ( ) . then ( async function ( keychain ) {
18131816 // Decrypt the user key with a passphrase
18141817 try {
1815- keychain . xprv = self . bitgo . decrypt ( { password : params . walletPassphrase , input : keychain . encryptedXprv } ) ;
1818+ keychain . xprv = await self . bitgo . decryptAsync ( {
1819+ password : params . walletPassphrase ,
1820+ input : keychain . encryptedXprv ,
1821+ } ) ;
18161822 } catch ( e ) {
18171823 throw new Error ( 'Unable to decrypt user keychain' ) ;
18181824 }
@@ -2295,21 +2301,24 @@ Wallet.prototype.shareWallet = function (params, callback) {
22952301 sharing = result ;
22962302
22972303 if ( needsKeychain ) {
2298- return self . getEncryptedUserKeychain ( { } ) . then ( function ( keychain ) {
2304+ return self . getEncryptedUserKeychain ( { } ) . then ( async function ( keychain ) {
22992305 // Decrypt the user key with a passphrase
23002306 if ( keychain . encryptedXprv ) {
23012307 if ( ! params . walletPassphrase ) {
23022308 throw new Error ( 'Missing walletPassphrase argument' ) ;
23032309 }
23042310 try {
2305- keychain . xprv = self . bitgo . decrypt ( { password : params . walletPassphrase , input : keychain . encryptedXprv } ) ;
2311+ keychain . xprv = await self . bitgo . decryptAsync ( {
2312+ password : params . walletPassphrase ,
2313+ input : keychain . encryptedXprv ,
2314+ } ) ;
23062315 } catch ( e ) {
23072316 throw new Error ( 'Unable to decrypt user keychain' ) ;
23082317 }
23092318
23102319 const eckey = makeRandomKey ( ) ;
23112320 const secret = getSharedSecret ( eckey , Buffer . from ( sharing . pubkey , 'hex' ) ) . toString ( 'hex' ) ;
2312- const newEncryptedXprv = self . bitgo . encrypt ( { password : secret , input : keychain . xprv } ) ;
2321+ const newEncryptedXprv = await self . bitgo . encryptAsync ( { password : secret , input : keychain . xprv } ) ;
23132322
23142323 sharedKeychain = {
23152324 xpub : keychain . xpub ,
@@ -2599,10 +2608,10 @@ Wallet.prototype.recover = async function (params) {
25992608 assert ( parsedUnsignedTx . outs . length === 1 ) ;
26002609 assert ( _ . sumBy ( params . unspents , 'value' ) - _ . sumBy ( parsedUnsignedTx . outs , 'value' ) === Number ( approximateTxFee ) ) ;
26012610
2602- const plainUserKey = this . bitgo . decrypt ( { password : params . walletPassphrase , input : params . userKey } ) ;
2611+ const plainUserKey = await this . bitgo . decryptAsync ( { password : params . walletPassphrase , input : params . userKey } ) ;
26032612 const halfSignedTx = await this . signTransaction ( { ...unsignedTx , signingKey : plainUserKey } ) ;
26042613
2605- const plainBackupKey = this . bitgo . decrypt ( { password : params . walletPassphrase , input : params . backupKey } ) ;
2614+ const plainBackupKey = await this . bitgo . decryptAsync ( { password : params . walletPassphrase , input : params . backupKey } ) ;
26062615 const fullSignedTx = await this . signTransaction ( {
26072616 ...unsignedTx ,
26082617 transactionHex : halfSignedTx . tx ,
@@ -2659,7 +2668,7 @@ Wallet.prototype.sweep = async function (params) {
26592668 assert ( parsedUnsignedTx . outs . length === 1 ) ;
26602669 assert ( _ . sumBy ( params . unspents , 'value' ) - _ . sumBy ( parsedUnsignedTx . outs , 'value' ) === Number ( approximateTxFee ) ) ;
26612670
2662- const plainUserKey = this . bitgo . decrypt ( { password : params . walletPassphrase , input : params . userKey } ) ;
2671+ const plainUserKey = await this . bitgo . decryptAsync ( { password : params . walletPassphrase , input : params . userKey } ) ;
26632672 const halfSignedTx = await this . signTransaction ( { ...unsignedTx , signingKey : plainUserKey } ) ;
26642673
26652674 return await this . sendTransaction ( {
0 commit comments