@@ -1669,7 +1669,7 @@ export class Wallet implements IWallet {
16691669 if ( ! params . walletPassphrase ) {
16701670 throw new Error ( 'wallet passphrase was not provided' ) ;
16711671 }
1672- const userPrv = decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
1672+ const userPrv = await decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
16731673 if ( ! userPrv ) {
16741674 throw new Error ( 'error decrypting wallet private key' ) ;
16751675 }
@@ -1849,7 +1849,7 @@ export class Wallet implements IWallet {
18491849 throw new Error ( 'Missing walletPassphrase argument' ) ;
18501850 }
18511851
1852- const prv = decryptKeychainPrivateKey ( this . bitgo , keychain , walletPassphrase ) ;
1852+ const prv = await decryptKeychainPrivateKey ( this . bitgo , keychain , walletPassphrase ) ;
18531853 if ( ! prv ) {
18541854 throw new IncorrectPasswordError ( 'Password shared is incorrect for this wallet' ) ;
18551855 }
@@ -2214,7 +2214,7 @@ export class Wallet implements IWallet {
22142214 if ( this . multisigType ( ) === 'tss' ) {
22152215 return this . signTransactionTss ( {
22162216 ...presign ,
2217- prv : this . getUserPrv ( presign as GetUserPrvOptions ) ,
2217+ prv : await this . getUserPrv ( presign as GetUserPrvOptions ) ,
22182218 apiVersion,
22192219 } ) ;
22202220 }
@@ -2252,7 +2252,7 @@ export class Wallet implements IWallet {
22522252 }
22532253 return this . baseCoin . signTransaction ( {
22542254 ...signTransactionParams ,
2255- prv : this . getUserPrv ( presign as GetUserPrvOptions ) ,
2255+ prv : await this . getUserPrv ( presign as GetUserPrvOptions ) ,
22562256 wallet : this ,
22572257 } ) ;
22582258 }
@@ -2287,7 +2287,7 @@ export class Wallet implements IWallet {
22872287 ...params ,
22882288 walletData : this . _wallet ,
22892289 tssUtils : this . tssUtils ,
2290- prv : this . getUserPrv ( userPrvOptions ) ,
2290+ prv : await this . getUserPrv ( userPrvOptions ) ,
22912291 keychain : keychains [ 0 ] ,
22922292 backupKeychain : keychains . length > 1 ? keychains [ 1 ] : null ,
22932293 bitgoKeychain : keychains . length > 2 ? keychains [ 2 ] : null ,
@@ -2326,7 +2326,7 @@ export class Wallet implements IWallet {
23262326 ...params ,
23272327 walletData : this . _wallet ,
23282328 tssUtils : this . tssUtils ,
2329- prv : this . getUserPrv ( userPrvOptions ) ,
2329+ prv : await this . getUserPrv ( userPrvOptions ) ,
23302330 keychain : keychains [ 0 ] ,
23312331 backupKeychain : keychains . length > 1 ? keychains [ 1 ] : null ,
23322332 bitgoKeychain : keychains . length > 2 ? keychains [ 2 ] : null ,
@@ -2383,7 +2383,7 @@ export class Wallet implements IWallet {
23832383 * @param [params.keychain / params.key] (object) or params.prv (string)
23842384 * @param params.walletPassphrase (string)
23852385 */
2386- getUserPrv ( params : GetUserPrvOptions = { } ) : string {
2386+ async getUserPrv ( params : GetUserPrvOptions = { } ) : Promise < string > {
23872387 const userKeychain = params . keychain || params . key ;
23882388 let userPrv = params . prv ;
23892389 if ( userPrv && typeof userPrv !== 'string' ) {
@@ -2420,7 +2420,7 @@ export class Wallet implements IWallet {
24202420 if ( ! params . walletPassphrase ) {
24212421 throw new Error ( 'walletPassphrase property missing' ) ;
24222422 }
2423- userPrv = decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
2423+ userPrv = await decryptKeychainPrivateKey ( this . bitgo , userKeychain , params . walletPassphrase ) ;
24242424 if ( ! userPrv ) {
24252425 throw new Error ( 'failed to decrypt user keychain' ) ;
24262426 }
@@ -4393,7 +4393,7 @@ export class Wallet implements IWallet {
43934393 // we ignore this check with if customSigningFunction is provided
43944394 // which means that the user is handling the signing in external signing mode
43954395 if ( ! customSigningFunction && keychains ?. [ 0 ] ?. encryptedPrv && walletPassphrase ) {
4396- if ( ! decryptKeychainPrivateKey ( this . bitgo , keychains [ 0 ] , walletPassphrase ) ) {
4396+ if ( ! ( await decryptKeychainPrivateKey ( this . bitgo , keychains [ 0 ] , walletPassphrase ) ) ) {
43974397 const error : Error & { code ?: string } = new Error (
43984398 `unable to decrypt keychain with the given wallet passphrase`
43994399 ) ;
0 commit comments