RSAEncrypt.setPublicKey(result.AccessKey);
var encryptedmsg = RSAEncrypt.encrypt(message.content + "##" + daysBack);
const request = new Request(api_url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: "\"" + encryptedmsg + "\""
});
console.log('This url is ',api_url); //Debug code
fetch(request)
.then(response => response.json())
.then(responseData => {
console.log('APITotal Person hits: ',responseData); //Debug code
var person = responseData;
})
});
The encryption process is part of an API request (fetch) that I can't control so I'll need the encryption to be there.