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

keyring: remove hardcoded default passphrase on NewMnemonic #8662

Merged
merged 15 commits into from
Feb 23, 2021

Conversation

fedekunze
Copy link
Collaborator

@fedekunze fedekunze commented Feb 22, 2021

closes #8635

crypto/keyring/keyring.go Outdated Show resolved Hide resolved
@fedekunze fedekunze added T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). T:Bug C:Keys Keybase, KMS and HSMs labels Feb 22, 2021
@@ -498,12 +501,16 @@ func (ks keystore) NewMnemonic(uid string, language Language, hdPath string, alg
return nil, "", err
}

info, err := ks.NewAccount(uid, mnemonic, DefaultBIP39Passphrase, hdPath, algo)
if passphrase == "default" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Mmmm. Why don't we rely on the zero value ""?

Copy link
Collaborator Author

@fedekunze fedekunze Feb 22, 2021

Choose a reason for hiding this comment

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

in case the default passphrase changes

Copy link
Contributor

Choose a reason for hiding this comment

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

so I think we'll need to modify the command line interfaces as well, correct?

CHANGELOG.md Outdated Show resolved Hide resolved
@alessio
Copy link
Contributor

alessio commented Feb 22, 2021

Test cases need update

@araskachoi
Copy link

i would also suggest possibly removing the NewAccount that is inside the NewMnemonic method. it is a bit misleading, especially in the use-case where a developer wants only a new mnemonic only.

@fedekunze
Copy link
Collaborator Author

where a developer wants only a new mnemonic only

Why don't you use the bip39 library instead if that's your use case?

@araskachoi
Copy link

araskachoi commented Feb 22, 2021

Why don't you use the bip39 library instead if that's your use case?

I think the same argument can be made about why NewMnemonic method exists. Why not generate the mnemonic inside NewAccount and remove the NewMnemonic method if someone cannot do anything with the bip39 mnemonic that is outputted? I just think the behavior and naming are a bit confusing. But besides that, the issue regarding the passphrase is the main point and looks like this PR resolves it! looking forward to having this merged soon!

crypto/keyring/keyring.go Outdated Show resolved Hide resolved
crypto/keyring/keyring.go Outdated Show resolved Hide resolved
@fedekunze fedekunze added the A:automerge Automatically merge PR once all prerequisites pass. label Feb 23, 2021
@codecov
Copy link

codecov bot commented Feb 23, 2021

Codecov Report

Merging #8662 (f79dff7) into master (8db9bbb) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8662      +/-   ##
==========================================
- Coverage   61.47%   61.46%   -0.02%     
==========================================
  Files         659      659              
  Lines       37916    37921       +5     
==========================================
- Hits        23308    23307       -1     
- Misses      12168    12171       +3     
- Partials     2440     2443       +3     
Impacted Files Coverage Δ
crypto/keyring/keyring.go 60.00% <100.00%> (-1.22%) ⬇️
server/init.go 65.00% <100.00%> (ø)

@mergify mergify bot merged commit cc70749 into master Feb 23, 2021
@mergify mergify bot deleted the fedekunze/8635-key-mnemonic branch February 23, 2021 16:49
@cyberbono3 cyberbono3 self-requested a review May 24, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Keys Keybase, KMS and HSMs T: API Breaking Breaking changes that impact APIs and the SDK only (not state machine). T:Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDK NewMnemonic Passphrase Issue
5 participants