-
Notifications
You must be signed in to change notification settings - Fork 30
Migrate passphrase command - Closes #561 #573
Conversation
4669cd4
to
865d40c
Compare
f7128d8
to
c04cbed
Compare
1e415ea
to
2cab2ec
Compare
src/commands/passphrase/decrypt.js
Outdated
`; | ||
|
||
DecryptCommand.examples = [ | ||
'passphrase:decrypt "salt=xxx&cipherText=xxx&iv=xxx&tag=xxx&version=1"', |
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.
I understand why you'd shorten this, but in general realistic examples are preferable. Do you have any specific reasoning for changing this?
src/commands/passphrase/decrypt.js
Outdated
}; | ||
|
||
DecryptCommand.description = ` | ||
Decrypts your secret passphrase using a password using the initialisation vector (IV) which was provided at the time of encryption. |
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.
Decrypts your secret passphrase using the password which was provided at the time of encryption.
src/commands/passphrase/encrypt.js
Outdated
const encryptedPassphrase = cryptography.stringifyEncryptedPassphrase( | ||
encryptedPassphraseObject, | ||
); | ||
const cipherAndIv = { encryptedPassphrase }; |
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 variable name could use an update.
describe('passphrase:decrypt', () => { | ||
const defaultEncryptedPassphrase = | ||
'salt=d3887df959ed2bfe5961a6831da6e177&cipherText=1c08a1&iv=096ede534df9092fd4523ec7&tag=2a055e1c860b3ef76084a6c9aca68ce9&version=1'; | ||
const passphrase = '123'; |
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 recommended example.
setupTest() | ||
.stdout() | ||
.command(['passphrase:decrypt']) | ||
.catch(error => |
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.
Normally we put brackets around expectations even when there's only one for consistency.
}); | ||
}, | ||
); | ||
}); |
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 when both come from stdin?
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.
stdin should be covered by two flags case because it's stubbed.
version: 1, | ||
}; | ||
const defaultInputs = { | ||
passphrase: '123', |
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 passphrase in a form we recommend.
}; | ||
const defaultInputs = { | ||
passphrase: '123', | ||
password: '456', |
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.
Same for password.
version: 1, | ||
}; | ||
const defaultInputs = { | ||
password: '456', |
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 stronger password.
setupTest() | ||
.stdout() | ||
.command(['passphrase:encrypt', '--passphrase=pass:123']) | ||
.it('should call print with the user config', () => { |
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.
Wrong description.
setupTest() | ||
.command([ | ||
'passphrase:encrypt', | ||
'--passphrase=pass:enemy pill squeeze gold spoil aisle awake thumb congress false box wagon', |
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 isn't exactly how a user would provide this. It would be --passphrase="pass:enemy pill squeeze gold spoil aisle awake thumb congress false box wagon"
setupTest() | ||
.command([ | ||
'passphrase:encrypt', | ||
'--passphrase=pass:enemy pill squeeze gold spoil aisle awake thumb congress false box wagon', |
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.
As above.
Description
Migration from
npm t
./bin/run passphrase:encrypt
./bin/run passphrase:decrypt
Review checklist