Skip to content

[CHORE] Add encrypt-key command to CLI #858

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

Merged
merged 6 commits into from
Dec 18, 2020
Merged

Conversation

mmrozek
Copy link
Contributor

@mmrozek mmrozek commented Dec 11, 2020

Description

encrypt-key command could be useful to set up a faucet

private val EncryptKey: Command[String] =
Command(name = encryptKeyCommand, header = "Encrypt private key") {

val privateKey = Opts
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't common options be defined outside commands? Or maybe even all options should replace current string constants in lines ~17-25?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to leave string constants because it is convenient to use them in tests

ByteStringUtils.hash2string(decrypted) shouldBe privateKey
}

it should "encrypt private key (with passphrase)" in {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: this test looks like a perfect candidate for a property-based one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really. I don't want to test decryption/encryption here. It should be done in a different place. I only want to check if I get the correct JSON when I specify the correct arguments

README.md Outdated
@@ -50,6 +50,11 @@ Possible networks: `etc`, `eth`, `mordor`, `testnet-internal`
./bin/mantis cli generate-key-pairs 5
```

- encrypt private key (could be used to setup private faucet)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably bit more documentation (and explanation) would be helpful. Either here or in the help for that command

Copy link
Contributor

@lemastero lemastero left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Contributor

@kapke kapke left a comment

Choose a reason for hiding this comment

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

LGTM!

@mmrozek mmrozek merged commit bed419f into develop Dec 18, 2020
@mmrozek mmrozek deleted the add-encypt-key-command branch December 18, 2020 11:18
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.

4 participants