Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: encrypt and return backup key by default #4551

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ericli-bitgo
Copy link

TICKET: BTC-1174

Copy link
Contributor

@mmcshinsky-bitgo mmcshinsky-bitgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidkaplanbitgo has identified that these actions will be breaking changes per the ticket information. Commit needs to reflect that if it is the case.

TICKET: BTC-1174

BREAKING CHANGE: changes the default behavior of generateWallet
@@ -264,6 +264,9 @@ export class Keychains implements IKeychains {
// if the provider is undefined, we generate a local key and add the source details
const key = this.create();
_.extend(params, key);
if (params.passphrase !== undefined) {
_.extend(params, { encryptedPrv: this.bitgo.encrypt({ input: key.prv, password: params.passphrase }) });
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checking line 273, do we want to return the prv and the encryptedPrv ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the params defined here and above get sent to WP via line 272.

line 273 annotates the response from WP with the prv, so the PRV doesn't actually get sent to WP.

@@ -435,7 +436,7 @@ export class Wallets implements IWallets {
throw new Error('cannot generate backup keypair without passphrase');
}
// No provided backup xpub or address, so default to creating one here
return this.baseCoin.keychains().createBackup({ reqId });
return this.baseCoin.keychains().createBackup({ reqId, passphrase: params.passphrase });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only call-site we need to update?

Copy link
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm so far, but lets add some tests as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants