We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
router.post('/api/test', (req, res) => { try { var privateKeyB = eccrypto.generatePrivate(); var publicKeyB = eccrypto.getPublic(privateKeyB); console.log("body data",req.body) let body = JSON.parse(JSON.stringify(req.body)) console.log(body) // Encrypting the message for B. eccrypto.encrypt(publicKeyB, Buffer.from(body.data)).then((encrypted) => { eccrypto.decrypt(privateKeyB, encrypted).then(function(plaintext) { console.log("Message to part B:", plaintext.toString()); res.json({"msg": plaintext.toString()}) }).catch((e) => { console.log("err while decrypting ",e) res.statusCode(400).send(e) }); }).catch((e) => { console.log("err while encrypting ",e) res.statusCode(400).send(e) }); } catch (error) { console.log("error try catch",error); res.statusCode(400).send(error) } })
while my req.body.data parameter length is greater then 14 its breaking.
The text was updated successfully, but these errors were encountered:
body.data is an object, you should use Buffer.from with a string like JSON.stringify(body.data)
Sorry, something went wrong.
I'm not able to reproduce, can you share any more info about your environment and setup?
No branches or pull requests
while my req.body.data parameter length is greater then 14 its breaking.
The text was updated successfully, but these errors were encountered: