@@ -49,7 +49,7 @@ import {
4949 TxRequestChallengeResponse ,
5050} from '../../../tss/types' ;
5151import { BaseEcdsaUtils } from './base' ;
52- import { IRequestTracer } from '../../../../api' ;
52+ import { EncryptionVersion , IRequestTracer } from '../../../../api' ;
5353
5454const encryptNShare = ECDSAMethods . encryptNShare ;
5555
@@ -183,6 +183,7 @@ export class EcdsaUtils extends BaseEcdsaUtils {
183183 passphrase,
184184 originalPasscodeEncryptionCode,
185185 webauthnInfo,
186+ encryptionVersion,
186187 } : CreateEcdsaKeychainParams ) : Promise < Keychain > {
187188 if ( ! passphrase ) {
188189 throw new Error ( 'Please provide a wallet passphrase' ) ;
@@ -198,7 +199,8 @@ export class EcdsaUtils extends BaseEcdsaUtils {
198199 bitgoKeychain ,
199200 passphrase ,
200201 originalPasscodeEncryptionCode ,
201- webauthnInfo
202+ webauthnInfo ,
203+ encryptionVersion
202204 ) ;
203205 }
204206
@@ -210,6 +212,7 @@ export class EcdsaUtils extends BaseEcdsaUtils {
210212 bitgoKeychain,
211213 bitgoPublicGpgKey,
212214 passphrase,
215+ encryptionVersion,
213216 } : CreateEcdsaKeychainParams ) : Promise < Keychain > {
214217 assert ( backupKeyShare . userHeldKeyShare ) ;
215218 assert ( passphrase ) ;
@@ -221,7 +224,10 @@ export class EcdsaUtils extends BaseEcdsaUtils {
221224 userKeyShare ,
222225 backupKeyShare . userHeldKeyShare ,
223226 bitgoKeychain ,
224- passphrase
227+ passphrase ,
228+ undefined ,
229+ undefined ,
230+ encryptionVersion
225231 ) ;
226232 }
227233
@@ -312,7 +318,8 @@ export class EcdsaUtils extends BaseEcdsaUtils {
312318 bitgoKeychain : Keychain ,
313319 passphrase : string ,
314320 originalPasscodeEncryptionCode ?: string ,
315- webauthnInfo ?: WebauthnKeyEncryptionInfo
321+ webauthnInfo ?: WebauthnKeyEncryptionInfo ,
322+ encryptionVersion ?: EncryptionVersion
316323 ) : Promise < Keychain > {
317324 const bitgoKeyShares = bitgoKeychain . keyShares ;
318325 if ( ! bitgoKeyShares ) {
@@ -402,9 +409,10 @@ export class EcdsaUtils extends BaseEcdsaUtils {
402409 keyType : 'tss' as KeyType ,
403410 commonKeychain : bitgoKeychain . commonKeychain ,
404411 prv : prv ,
405- encryptedPrv : this . bitgo . encrypt ( {
412+ encryptedPrv : await this . bitgo . encryptAsync ( {
406413 input : prv ,
407414 password : passphrase ,
415+ encryptionVersion,
408416 } ) ,
409417 originalPasscodeEncryptionCode,
410418 webauthnDevices :
@@ -499,7 +507,10 @@ export class EcdsaUtils extends BaseEcdsaUtils {
499507 userPublicGpgKey : userPublicGpgKey ,
500508 kShare : userSignShare . kShare ,
501509 wShare : params . walletPassphrase
502- ? this . bitgo . encrypt ( { input : JSON . stringify ( userSignShare . wShare ) , password : params . walletPassphrase } )
510+ ? await this . bitgo . encryptAsync ( {
511+ input : JSON . stringify ( userSignShare . wShare ) ,
512+ password : params . walletPassphrase ,
513+ } )
503514 : userSignShare . wShare ,
504515 } ;
505516 }
@@ -529,7 +540,7 @@ export class EcdsaUtils extends BaseEcdsaUtils {
529540 i : userGammaAndMuShares . muShare . i ,
530541 } ,
531542 oShare : params . walletPassphrase
532- ? this . bitgo . encrypt ( {
543+ ? await this . bitgo . encryptAsync ( {
533544 input : JSON . stringify ( userOmicronAndDeltaShare . oShare ) ,
534545 password : params . walletPassphrase ,
535546 } )
@@ -584,7 +595,10 @@ export class EcdsaUtils extends BaseEcdsaUtils {
584595 encryptedWShare : string ;
585596 walletPassphrase : string ;
586597 } ) : Promise < TssEcdsaStep2ReturnMessage > {
587- const decryptedWShare = this . bitgo . decrypt ( { input : params . encryptedWShare , password : params . walletPassphrase } ) ;
598+ const decryptedWShare = await this . bitgo . decryptAsync ( {
599+ input : params . encryptedWShare ,
600+ password : params . walletPassphrase ,
601+ } ) ;
588602 return await this . createTssEcdsaStep2SigningMaterial ( {
589603 aShareFromBitgo : params . aShareFromBitgo ,
590604 bitgoChallenge : params . bitgoChallenge ,
@@ -618,7 +632,7 @@ export class EcdsaUtils extends BaseEcdsaUtils {
618632 } catch ( err ) {
619633 hash = undefined ;
620634 }
621- const decryptedOShare = this . bitgo . decrypt ( { input : encryptedOShare , password : walletPassphrase } ) ;
635+ const decryptedOShare = await this . bitgo . decryptAsync ( { input : encryptedOShare , password : walletPassphrase } ) ;
622636 const { i, R, s, y } = await ECDSAMethods . createUserSignatureShare (
623637 JSON . parse ( decryptedOShare ) ,
624638 dShareFromBitgo ,
0 commit comments