npm install --save openpgp
var openpgp = require('openpgp');
var hkp = new openpgp.HKP('https://pgp.mit.edu');
hkp.lookup({
query: 'alice@example.com'
}).then(function(key) {
var publicKey = openpgp.key.readArmored(key);
});
return fetch(uri).then(function(response) {
TypeError: fetch is not a function
at HKP.lookup (*\node_modules\openpgp\src\hkp\hkp.js:63:10)
For the OpenPGP HTTP Key Server (HKP) client the new fetch api is used. There is a polyfill for both browsers and node.js runtimes. These are not bundled in the library however and users must add these themselves. See the unit tests for examples of how to integrate them.https://github.com/openpgpjs/openpgpjs#dependencies