Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function doEncrypt(plaintext) {
openpgp.encryptMessage(pubKey, plaintext).then(function(pgpMessage) {
pgpMessage = pgpMessage.replace('OpenPGP.js', 'Profanity-PGP');
pgpMessage = pgpMessage.replace('http://openpgpjs.org', 'https://github.com/mapmeld/profanity-pgp');
var msg = pgpMessage.split('\n');
for(var l = 4; l < msg.length - 2; l++) {
var original_line = msg[l];
var new_line = [];
for(var sym = 0; sym < original_line.length; sym++) {
var symbol_index = originalSymbols.indexOf(original_line[sym]);
new_line.push(profanity[symbol_index]);
}
msg[l] = new_line.join(' ');
}
console.log(msg.join('\n'));
}).catch(function(err) {
throw err;
});
EncryptionManager.prototype.encryptData = function(pubkey, data, callback) {
var key = pubkey;
var publicKey = openpgp.key.readArmored(key);
var message = JSON.stringify(data);
openpgp.encryptMessage(publicKey.keys, message).then(function(pgpMessage) {
return callback(null, pgpMessage);
}).catch(function(error) {
if (error.action) {
return callback(error, null);
}
});
};