Introduce a few user arguments

This commit is contained in:
Kgothatso 2019-12-07 14:55:09 +02:00
parent 04d7675c20
commit 2d9705577c
2 changed files with 10 additions and 4 deletions

View File

@ -13,6 +13,10 @@ module.exports.builder = (yargs) => {
describe: 'Challenge to sign', describe: 'Challenge to sign',
type: 'string' type: 'string'
}) })
.option('p', {
describe: 'will post signature to response endpoint',
type: 'boolean'
})
.demandOption(['challenge']) .demandOption(['challenge'])
.argv; .argv;
} }

View File

@ -50,10 +50,12 @@ module.exports.authenticate = function(challenge, authenticationRequest, argv) {
const signature = cryptoUtil.signMessage(walletXpriv, challengeDerivationPath, challenge.message).toString('hex'); const signature = cryptoUtil.signMessage(walletXpriv, challengeDerivationPath, challenge.message).toString('hex');
console.log("Signature: ", signature); console.log("Signature: ", signature);
postSignature.postSignature(authenticationRequest.responseEndpoint, { if(argv.p) {
id: challenge.id, postSignature.postSignature(authenticationRequest.responseEndpoint, {
signature: signature id: challenge.id,
}) signature: signature
})
}
} else { } else {
console.error("Challenge not signed by registered service."); console.error("Challenge not signed by registered service.");
} }