Is there any way to get hold of the GNUPG from a Lambda Node.js function, I can see AWS uses this elsewhere but I can't seem to get access to it.
I want to encrypt some text for transmission over email using a public key.
I did try finding an NPM for it but it seems incomplete, what I did find was OpenPGP.js http://openpgpjs.org/ but I'm not sure how to include a static js file into a AWS Lambda function as it seems to error
Many thanks in advance.
Not to worry I found out what I did wrong, it was because the data was inside a function so it was always null, to complete the information here is now to do it:
npm install --save openpgp
or get the file from the dist.
var enctext, ciphertext, encoptions;
var text = "Hello world this needs to be secure";
var openpgp = require('openpgp');
openpgp.initWorker({ path:'openpgp.worker.js' }) // set the relative web worker path
encoptions = {
data: enctext,
publicKeys: openpgp.key.readArmored(fs.readFileSync ('./pubkey.asc','UTF-8')).keys,
armor: true
};
openpgp.encrypt(encoptions).then(function(ciphertext) {
output = ciphertext.data;
console.log(output);
});
This should work