@@ -1673,7 +1673,7 @@ export class Wallet implements IWallet {
16731673 if ( ! params . walletPassphrase ) {
16741674 throw new Error ( 'wallet passphrase was not provided' ) ;
16751675 }
1676- const userPrv = decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
1676+ const userPrv = await decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
16771677 if ( ! userPrv ) {
16781678 throw new Error ( 'error decrypting wallet private key' ) ;
16791679 }
@@ -1853,7 +1853,7 @@ export class Wallet implements IWallet {
18531853 throw new Error ( 'Missing walletPassphrase argument' ) ;
18541854 }
18551855
1856- const prv = decryptKeychainPrivateKey ( this . bitgo , keychain , walletPassphrase ) ;
1856+ const prv = await decryptKeychainPrivateKey ( this . bitgo , keychain , walletPassphrase ) ;
18571857 if ( ! prv ) {
18581858 throw new IncorrectPasswordError ( 'Password shared is incorrect for this wallet' ) ;
18591859 }
@@ -2218,7 +2218,7 @@ export class Wallet implements IWallet {
22182218 if ( this . multisigType ( ) === 'tss' ) {
22192219 return this . signTransactionTss ( {
22202220 ...presign ,
2221- prv : this . getUserPrv ( presign as GetUserPrvOptions ) ,
2221+ prv : await this . getUserPrv ( presign as GetUserPrvOptions ) ,
22222222 apiVersion,
22232223 } ) ;
22242224 }
@@ -2256,7 +2256,7 @@ export class Wallet implements IWallet {
22562256 }
22572257 return this . baseCoin . signTransaction ( {
22582258 ...signTransactionParams ,
2259- prv : this . getUserPrv ( presign as GetUserPrvOptions ) ,
2259+ prv : await this . getUserPrv ( presign as GetUserPrvOptions ) ,
22602260 wallet : this ,
22612261 } ) ;
22622262 }
@@ -2291,7 +2291,7 @@ export class Wallet implements IWallet {
22912291 ...params ,
22922292 walletData : this . _wallet ,
22932293 tssUtils : this . tssUtils ,
2294- prv : this . getUserPrv ( userPrvOptions ) ,
2294+ prv : await this . getUserPrv ( userPrvOptions ) ,
22952295 keychain : keychains [ 0 ] ,
22962296 backupKeychain : keychains . length > 1 ? keychains [ 1 ] : null ,
22972297 bitgoKeychain : keychains . length > 2 ? keychains [ 2 ] : null ,
@@ -2330,7 +2330,7 @@ export class Wallet implements IWallet {
23302330 ...params ,
23312331 walletData : this . _wallet ,
23322332 tssUtils : this . tssUtils ,
2333- prv : this . getUserPrv ( userPrvOptions ) ,
2333+ prv : await this . getUserPrv ( userPrvOptions ) ,
23342334 keychain : keychains [ 0 ] ,
23352335 backupKeychain : keychains . length > 1 ? keychains [ 1 ] : null ,
23362336 bitgoKeychain : keychains . length > 2 ? keychains [ 2 ] : null ,
@@ -2387,7 +2387,7 @@ export class Wallet implements IWallet {
23872387 * @param [params.keychain / params.key] (object) or params.prv (string)
23882388 * @param params.walletPassphrase (string)
23892389 */
2390- getUserPrv ( params : GetUserPrvOptions = { } ) : string {
2390+ async getUserPrv ( params : GetUserPrvOptions = { } ) : Promise < string > {
23912391 const userKeychain = params . keychain || params . key ;
23922392 let userPrv = params . prv ;
23932393 if ( userPrv && typeof userPrv !== 'string' ) {
@@ -2424,7 +2424,7 @@ export class Wallet implements IWallet {
24242424 if ( ! params . walletPassphrase ) {
24252425 throw new Error ( 'walletPassphrase property missing' ) ;
24262426 }
2427- userPrv = decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
2427+ userPrv = await decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
24282428 if ( ! userPrv ) {
24292429 throw new Error ( 'failed to decrypt user keychain' ) ;
24302430 }
@@ -4409,7 +4409,7 @@ export class Wallet implements IWallet {
44094409 // we ignore this check with if customSigningFunction is provided
44104410 // which means that the user is handling the signing in external signing mode
44114411 if ( ! customSigningFunction && keychains ?. [ 0 ] ?. encryptedPrv && walletPassphrase ) {
4412- if ( ! decryptKeychainPrivateKey ( this . bitgo , keychains [ 0 ] , walletPassphrase ) ) {
4412+ if ( ! ( await decryptKeychainPrivateKey ( this . bitgo , keychains [ 0 ] , walletPassphrase ) ) ) {
44134413 const error : Error & { code ?: string } = new Error (
44144414 `unable to decrypt keychain with the given wallet passphrase`
44154415 ) ;
0 commit comments