Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11661

How to avoid deleting backslash in Node.js

$
0
0

I have to verify signature that created by Ruby service. The signature is creating from stringified JSON data.The problem is that if data contains single backslash in nested strings then Node.js deletes backslashes.And because of it the signature that I am creating is not matching what I receive.

The code that I am creating signature in Node.js

const calculatedHash = crypto        .createHmac('SHA512', privateKey)        .update(data)        .digest('hex');

How can I create signature if string data contains backslashes ?

I have tried to use replace method but doesn't work.

The example data that I should create hash {"changes: {\"recalculated\"=\\u003e\"true\", \"amount\"=\\u003e\"132\"}}


Viewing all articles
Browse latest Browse all 11661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>