Skip to content

Commit

Permalink
#230 uppercase to add to check signature
Browse files Browse the repository at this point in the history
  • Loading branch information
branciard committed Jul 21, 2020
1 parent ec74104 commit 9209103
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions orchestrator/src/routes/sms.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ router.post(
const params = Object.assign(req.query, req.body);
console.log('/webhooks/inbound-sms');
// console.log(params);
// console.log('generated sig = ' + Nexmo.generateSignature(orchestrator.nexmoApiSignatureMethod, orchestrator.nexmoApiSignatureSecret, params));
// console.log('params.sig = '+ params.sig);
if (orchestrator.nexmoApiCheckMsgSignature === 'true') {
if (Nexmo.generateSignature(orchestrator.nexmoApiSignatureMethod, orchestrator.nexmoApiSignatureSecret, params) === params.sig) {
const sigToCheck = Nexmo.generateSignature(orchestrator.nexmoApiSignatureMethod, orchestrator.nexmoApiSignatureSecret, params);
if (sigToCheck && sigToCheck.toUpperCase() === params.sig) {
console.log('Valid signature');
if (params && params.text && params.text.toString() !== '') {
console.log('text:' + params.text.toString());
Expand Down Expand Up @@ -42,10 +41,9 @@ router.get(
const params = Object.assign(req.query, req.body);
console.log('/webhooks/inbound-sms');
// console.log(params);
// console.log('generated sig = ' + Nexmo.generateSignature(orchestrator.nexmoApiSignatureMethod, orchestrator.nexmoApiSignatureSecret, params));
// console.log('params.sig = '+ params.sig);
if (orchestrator.nexmoApiCheckMsgSignature === 'true') {
if (Nexmo.generateSignature(orchestrator.nexmoApiSignatureMethod, orchestrator.nexmoApiSignatureSecret, params) === params.sig) {
const sigToCheck = Nexmo.generateSignature(orchestrator.nexmoApiSignatureMethod, orchestrator.nexmoApiSignatureSecret, params);
if (sigToCheck && sigToCheck.toUpperCase() === params.sig) {
console.log('Valid signature');
if (params && params.text && params.text.toString() !== '') {
console.log('text:' + params.text.toString());
Expand Down

0 comments on commit 9209103

Please sign in to comment.