diff --git a/README.md b/README.md index e8f43e3b..c90e4019 100644 --- a/README.md +++ b/README.md @@ -409,7 +409,7 @@ openpgp.revokeKey(options).then(function(key) { #### Lookup public key on HKP server ```js -var hkp = new openpgp.HKP('https://pgp.mit.edu'); +var hkp = new openpgp.HKP(); // Defaults to https://keyserver.ubuntu.com, or pass another keyserver URL as a string var options = { query: 'alice@example.com' diff --git a/src/hkp.js b/src/hkp.js index 37c5d7cb..a2b798a6 100644 --- a/src/hkp.js +++ b/src/hkp.js @@ -27,7 +27,8 @@ import config from './config'; * Initialize the HKP client and configure it with the key server url and fetch function. * @constructor * @param {String} keyServerBaseUrl (optional) The HKP key server base url including - * the protocol to use e.g. https://pgp.mit.edu + * the protocol to use, e.g. 'https://pgp.mit.edu'; defaults to + * openpgp.config.keyserver (https://keyserver.ubuntu.com) */ function HKP(keyServerBaseUrl) { this._baseUrl = keyServerBaseUrl || config.keyserver; diff --git a/test/general/hkp.js b/test/general/hkp.js index 0d5370d2..3906d2c9 100644 --- a/test/general/hkp.js +++ b/test/general/hkp.js @@ -105,6 +105,19 @@ describe('HKP unit tests', function() { '=5obP\r\n' + '-----END PGP PUBLIC KEY BLOCK-----'; + const revocation_certificate = `-----BEGIN PGP PUBLIC KEY BLOCK----- + Comment: This is a revocation certificate + + iQFFBCABCAAvFiEE6mWHlKTGvbGenE8BstiRuVIg7eYFAlxec9cRHQB0aGlzIGlz + IGEgdGVzdC4ACgkQstiRuVIg7eZkywf/QuHU6WaOGmI635xsV8GNyvOOHzDpVuzM + AYGIKOLf1l661aS1MIvbXGxI86a3CzLs3K9nqUS7uAZ89vhf6L8RDZSkpn2GzY3K + JQb0ZM+qf2TGkVDZ/wI8H/BMkJGCLbvbn6Ywk/o4GQIl/ISJPQTiC5VixayLEUQ3 + 6dnENegfEIptSOPNBOelRPfbT8tqcR6SxibjXYxlCqvdSgt7lui06vGcejl4qNgZ + oNMuvQNShV2G9KkPda3AZWCIWzUBuKN5UuE06u68iclH2ckEicQvnmxHnJU/BSC9 + h3bdqlMa87hRGnWluKpJT+XRP0UGiN8UGWo8OEpdz8KbvVTCUVya4g== + =Wjv9 + -----END PGP PUBLIC KEY BLOCK-----` + beforeEach(function() { hkp = new openpgp.HKP(openpgp.config.keyserver); }); @@ -137,10 +150,16 @@ describe('HKP unit tests', function() { }); }); - describe('upload', function() { + describe('upload public key', function() { it('should work', function() { return hkp.upload(pub_key); }); }); + describe('upload revocation certificate', function() { + it('should work', function() { + return hkp.upload(revocation_certificate); + }); + }); + });