From 2d9705577c759d9252b5317dafeb8d429b870ebb Mon Sep 17 00:00:00 2001 From: Kgothatso Date: Sat, 7 Dec 2019 14:55:09 +0200 Subject: [PATCH] Introduce a few user arguments --- lib/commands/sign.js | 4 ++++ lib/core/logic/authentication.js | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/commands/sign.js b/lib/commands/sign.js index 674256a..b99ef72 100644 --- a/lib/commands/sign.js +++ b/lib/commands/sign.js @@ -13,6 +13,10 @@ module.exports.builder = (yargs) => { describe: 'Challenge to sign', type: 'string' }) + .option('p', { + describe: 'will post signature to response endpoint', + type: 'boolean' + }) .demandOption(['challenge']) .argv; } diff --git a/lib/core/logic/authentication.js b/lib/core/logic/authentication.js index 44666fe..aaf3c1c 100644 --- a/lib/core/logic/authentication.js +++ b/lib/core/logic/authentication.js @@ -50,10 +50,12 @@ module.exports.authenticate = function(challenge, authenticationRequest, argv) { const signature = cryptoUtil.signMessage(walletXpriv, challengeDerivationPath, challenge.message).toString('hex'); console.log("Signature: ", signature); - postSignature.postSignature(authenticationRequest.responseEndpoint, { - id: challenge.id, - signature: signature - }) + if(argv.p) { + postSignature.postSignature(authenticationRequest.responseEndpoint, { + id: challenge.id, + signature: signature + }) + } } else { console.error("Challenge not signed by registered service."); }