Commit f190823f authored by Éloïs's avatar Éloïs
Browse files

[fex] security: remove options --salt & --password

parent 1f3a021b
......@@ -27,11 +27,6 @@ export const KeypairDependency = {
},
cliOptions: [
{ value: "--salt <salt>", desc: "Salt to generate the keypair" },
{
value: "--passwd <password>",
desc: "Password to generate the keypair",
},
{
value: "--keyN <N>",
desc:
......@@ -98,22 +93,6 @@ export const KeypairDependency = {
logger: any,
confDAL: any
) => {
if (
(program.keyN || program.keyr || program.keyp) &&
!(program.salt && program.passwd)
) {
throw Error(
"Missing --salt and --passwd options along with --keyN|keyr|keyp option"
);
}
// If we have salt and password, convert it to keypair
if (program.salt || program.passwd) {
const salt = program.salt || "";
const key = program.passwd || "";
conf.pair = await Scrypt(salt, key);
}
// If no keypair has been loaded, try the default .yml file
if (!conf.pair || !conf.pair.pub || !conf.pair.sec) {
const ymlContent = await confDAL.coreFS.read("keyring.yml");
......
......@@ -18,19 +18,6 @@ const should = require('should');
describe('Module usage', () => {
it('wrong options should throw', async () => {
let errMessage;
try {
const stack = Statics.minimalStack();
stack.registerDependency(KeypairDependency, 'duniter-keypair');
await stack.executeStack(['node', 'index.js', 'config', '--memory', '--keyN', '2048']);
} catch (e) {
errMessage = e.message;
}
should.exist(errMessage);
should.equal(errMessage, 'Missing --salt and --passwd options along with --keyN|keyr|keyp option');
})
it('no options on brand new node should generate random key', async () => {
const stack = Statics.minimalStack();
stack.registerDependency(KeypairDependency, 'duniter-keypair');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment