Encrypt / Decrypt strings with RSA in Node.JS
Interesting things that go through my mind during lock-down haha!
const crypto = require('crypto');
const PASSPHRASE = 'I had learned that some things are best kept secret.';
const KEY_PAIR_OPTIONS = {
modulusLength: 2048,
publicKeyEncoding: {
type: 'spki',
format: 'pem'
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
passphrase: PASSPHRASE
}
};
const KEY_PAIR