I'm trying to encrypt some strings in the frontend with javascript with the some public-private key method in which only the backend could decrypt with the private key, is this possible? how can I achieve it?
I don't mind if it has a really basic encryption as long it has a public and private key
// This is an EXAMPLE of what I want:
let message = encrypt("hello word!","public_key");
let decrypt_message = decrypt(message, "public_key");
/* the decrypt() method should throws error cuz the user shouldn't be able to
* decrypt his own message with the public_key
*/
also notice that I'm already using HTTPS but having extra security doesn't hurt anyone :)
thank you in advance ♥