++ Add another Domain for HKP server ()

* ++ Add another Domain for HKP server

the pgp.mit.edu domain is most of the time down and responds with time out...so i discovered this ubuntu domain for the same database...but its much faster and never falls....i think too much traffic over the bit one :(

* Update hkp.js

* Change HKP server url

* Defined the default HKP server

* Update README.md

Co-Authored-By: rash0 <40761345+rash0@users.noreply.github.com>

* ++ Add revocation certificate test

didn't know if i should use the revocation certificate in the test/key.js file or generate a new one...so i generated a test one and used it...
This commit is contained in:
rash0 2019-02-11 18:33:24 +08:00 committed by Sanjana Rajan
parent e2d19a7414
commit 3edc6e7501
3 changed files with 23 additions and 3 deletions
README.md
src
test/general

View File

@ -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'

View File

@ -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;

View File

@ -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);
});
});
});