-
Notifications
You must be signed in to change notification settings - Fork 30
Conversation
src/commands/show_account.js
Outdated
import commonOptions from '../utils/options'; | ||
import cryptography from '../utils/cryptography'; | ||
|
||
const description = `Shows an account information with the given passphrase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shows account information for a given passphrase
src/commands/show_account.js
Outdated
|
||
const description = `Shows an account information with the given passphrase. | ||
|
||
Examples: show account |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example:
src/commands/show_account.js
Outdated
`; | ||
|
||
const processInput = ({ passphrase }) => | ||
cryptography.liskCrypto.getAddressAndPublicKeyFromPassphrase(passphrase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also want to provide the private key? We do when creating an account.
test/specs/commands/show_account.js
Outdated
given.aPassphrase, | ||
() => { | ||
Given( | ||
'an object with the public key "314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d977ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588" and the address "2167422481642255385L" derived from the passphrase', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider reusing the given step which defines a passphrase and these additional items together?
test/specs/commands/show_account.js
Outdated
when.theActionIsCalledWithTheOptions, | ||
() => { | ||
Then( | ||
'it should resolve to an object with the public key and the address', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did the action know about the passphrase in this scenario?
test/specs/commands/show_account.js
Outdated
given.anEmptyOptionsObject, | ||
() => { | ||
When( | ||
'the action is called with the options', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of this branch?
test/specs/commands/show_account.js
Outdated
given.anObjectWithThePublicKeyAndTheAddressDerivedFromThePassphrase, | ||
() => { | ||
Given( | ||
'an empty options object', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about with the passphrase passed as an option?
test/steps/crypto/1_given.js
Outdated
@@ -216,3 +216,18 @@ export function anEncryptedMessageWithANonce() { | |||
|
|||
this.test.ctx.cipherAndNonce = cipherAndNonce; | |||
} | |||
|
|||
export function anObjectWithThePublicKeyAndTheAddressDerivedFromThePassphrase() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step doesn't define an object at all.
2d8bebb
to
6701798
Compare
6701798
to
8045294
Compare
src/commands/show_account.js
Outdated
|
||
const description = `Shows account information for a given passphrase. | ||
|
||
Example: show account |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be tab-indented.
given.aVorpalInstanceWithAUIAndAnActiveCommandThatCanPrompt, | ||
() => { | ||
Given('an action "show account"', given.anAction, () => { | ||
Given( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step is now redundant.
test/specs/commands/show_account.js
Outdated
() => { | ||
Then( | ||
'it should resolve to an object with the public key, the private key and the address', | ||
then.itShouldResolveToAnObjectWithThePublicKeyThePrivateKeyAndTheAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer a consistent ordering reflecting the derivation direction: in general passphrase
-> privateKey
-> publicKey
-> address
.
test/specs/commands/show_account.js
Outdated
() => { | ||
Given( | ||
'an options object with passphrase set to "passphraseSource"', | ||
given.anOptionsObjectWithPassphraseSetTo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the passphrase be retrieved? What if it can? What if it can't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small typo, otherwise LGTM.
test/specs/commands/show_account.js
Outdated
then.itShouldGetTheInputsFromSourcesUsingThePassphraseSourceWithARepeatingPrompt, | ||
); | ||
Then( | ||
'it should resolve to an object withthe private key, the public key and the address', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the
test/specs/commands/show_account.js
Outdated
then.itShouldGetTheInputsFromSourcesUsingThePassphraseSourceWithARepeatingPrompt, | ||
); | ||
Then( | ||
'it should resolve to an object withthe private key, the public key and the address', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the
2711d07
to
201d7fb
Compare
Description
Add
show account
commandReview checklist