Introduce a few user arguments
This commit is contained in:
parent
04d7675c20
commit
2d9705577c
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
if(argv.p) {
|
||||||
postSignature.postSignature(authenticationRequest.responseEndpoint, {
|
postSignature.postSignature(authenticationRequest.responseEndpoint, {
|
||||||
id: challenge.id,
|
id: challenge.id,
|
||||||
signature: signature
|
signature: signature
|
||||||
})
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error("Challenge not signed by registered service.");
|
console.error("Challenge not signed by registered service.");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user