File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
modules/sdk-core/src/bitgo/keychain Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -498,25 +498,28 @@ export class Keychains implements IKeychains {
498498 }
499499
500500 /**
501- * Create keychain for ofc wallet using the password
502- * @param userPassword
503- * @returns
501+ * Create user keychain, encrypt the private key with the wallet passphrase and store it in BitGo.
502+ * @param walletPassphrase
503+ * @returns Keychain including the decrypted private key
504504 */
505- async createUserKeychain ( userPassword : string ) : Promise < Keychain > {
505+ async createUserKeychain ( walletPassphrase : string ) : Promise < Keychain > {
506506 const keychains = this . baseCoin . keychains ( ) ;
507507 const newKeychain = keychains . create ( ) ;
508508 const originalPasscodeEncryptionCode = generateRandomPassword ( 5 ) ;
509509
510510 const encryptedPrv = this . bitgo . encrypt ( {
511- password : userPassword ,
511+ password : walletPassphrase ,
512512 input : newKeychain . prv ,
513513 } ) ;
514514
515- return await keychains . add ( {
516- encryptedPrv,
517- originalPasscodeEncryptionCode,
518- pub : newKeychain . pub ,
519- source : 'user' ,
520- } ) ;
515+ return {
516+ ...( await keychains . add ( {
517+ encryptedPrv,
518+ originalPasscodeEncryptionCode,
519+ pub : newKeychain . pub ,
520+ source : 'user' ,
521+ } ) ) ,
522+ prv : newKeychain . prv ,
523+ } ;
521524 }
522525}
You can’t perform that action at this time.
0 commit comments