A very minimal implementation of PGP message encryption/decryption by Herbert Hanewinkel, originally posted to his site at https://www.hanewin.net/encrypt/ and mirrored at https://dossy.github.io/hanewinpgp/.
$ npm install --save hanewinpgp
const hanewinpgp = require('hanewinpgp');
var pubkey = "ASCII armored public key here";
var plaintext = "your plaintext message here";
var key = hanewinpgp.extract(pubkey);
var encrypted = hanewinpgp.encrypt(key, plaintext);
// encrypted now contains ASCII armored encrypted message
You can try a demo of this code right in your reasonably modern web browser.
See LICENSE file.