Move HKP client to openpgpjs/hkp-client
This commit is contained in:
parent
fa3c36fc87
commit
43f0724aeb
29
README.md
29
README.md
|
@ -20,8 +20,6 @@ OpenPGP.js [
|
||||
- [Generate new key pair](#generate-new-key-pair)
|
||||
- [Revoke a key](#revoke-a-key)
|
||||
- [Lookup public key on HKP server](#lookup-public-key-on-hkp-server)
|
||||
- [Upload public key to HKP server](#upload-public-key-to-hkp-server)
|
||||
- [Sign and verify cleartext messages](#sign-and-verify-cleartext-messages)
|
||||
- [Create and verify *detached* signatures](#create-and-verify-detached-signatures)
|
||||
- [Streaming sign and verify *Uint8Array* data](#streaming-sign-and-verify-uint8array-data)
|
||||
|
@ -442,33 +440,6 @@ Using the private key:
|
|||
})();
|
||||
```
|
||||
|
||||
#### Lookup public key on HKP server
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
var hkp = new openpgp.HKP(); // Defaults to https://keyserver.ubuntu.com, or pass another keyserver URL as a string
|
||||
|
||||
let publicKeyArmored = await hkp.lookup({
|
||||
query: 'alice@example.com'
|
||||
});
|
||||
let publicKey = await openpgp.readKey({ armoredKey: publicKeyArmored });
|
||||
})();
|
||||
```
|
||||
|
||||
#### Upload public key to HKP server
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
var hkp = new openpgp.HKP('https://pgp.mit.edu');
|
||||
|
||||
var publicKeyArmored = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
...
|
||||
-----END PGP PUBLIC KEY BLOCK-----`;
|
||||
|
||||
await hkp.upload(publicKeyArmored);
|
||||
})();
|
||||
```
|
||||
|
||||
#### Sign and verify cleartext messages
|
||||
|
||||
```js
|
||||
|
|
5
openpgp.d.ts
vendored
5
openpgp.d.ts
vendored
|
@ -680,11 +680,6 @@ export function armor(messagetype: enums.armor, body: object, partindex: number,
|
|||
*/
|
||||
export function unarmor(input: string, config?: Config): Promise<{ text: string, data: Stream<Uint8Array>, type: enums.armor }>;
|
||||
|
||||
export class HKP {
|
||||
constructor(keyServerBaseUrl?: string, config?: Config);
|
||||
public lookup(options: { keyid?: string, query?: string }): Promise<string | undefined>;
|
||||
}
|
||||
|
||||
/* ############## v5 ENUMS #################### */
|
||||
|
||||
export namespace enums {
|
||||
|
|
89
src/hkp.js
89
src/hkp.js
|
@ -1,89 +0,0 @@
|
|||
// OpenPGP.js - An OpenPGP implementation in javascript
|
||||
// Copyright (C) 2015 Tankred Hase
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 3.0 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import defaultConfig from './config';
|
||||
|
||||
/**
|
||||
* This class implements a client for the OpenPGP HTTP Keyserver Protocol (HKP)
|
||||
* in order to lookup and upload keys on standard public key servers.
|
||||
*/
|
||||
class HKP {
|
||||
/**
|
||||
* Initialize the HKP client and configure it with the key server url and fetch function.
|
||||
* @param {String} [keyServerBaseUrl] - The HKP key server base url including
|
||||
* the protocol to use, e.g. 'https://pgp.mit.edu'; defaults to
|
||||
* openpgp.config.keyserver (https://keyserver.ubuntu.com)
|
||||
* @param {Object} [config] - Full configuration, defaults to openpgp.config
|
||||
*/
|
||||
constructor(keyServerBaseUrl, config = defaultConfig) {
|
||||
this._baseUrl = keyServerBaseUrl || config.keyserver;
|
||||
this._fetch = typeof globalThis.fetch === 'function' ? globalThis.fetch : require('node-fetch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a public key on the key server either by key ID or part of the user ID.
|
||||
* @param {String} options.keyId The long public key ID.
|
||||
* @param {String} options.query This can be any part of the key user ID such as name
|
||||
* or email address.
|
||||
* @returns {String} The ascii armored public key.
|
||||
* @async
|
||||
*/
|
||||
lookup(options) {
|
||||
let uri = this._baseUrl + '/pks/lookup?op=get&options=mr&search=';
|
||||
const fetch = this._fetch;
|
||||
|
||||
if (options.keyId) {
|
||||
uri += '0x' + encodeURIComponent(options.keyId);
|
||||
} else if (options.query) {
|
||||
uri += encodeURIComponent(options.query);
|
||||
} else {
|
||||
throw new Error('You must provide a query parameter!');
|
||||
}
|
||||
|
||||
return fetch(uri).then(function(response) {
|
||||
if (response.status === 200) {
|
||||
return response.text();
|
||||
}
|
||||
}).then(function(publicKeyArmored) {
|
||||
if (!publicKeyArmored || publicKeyArmored.indexOf('-----END PGP PUBLIC KEY BLOCK-----') < 0) {
|
||||
return;
|
||||
}
|
||||
return publicKeyArmored.trim();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a public key to the server.
|
||||
* @param {String} publicKeyArmored - An ascii armored public key to be uploaded.
|
||||
* @returns {Promise}
|
||||
* @async
|
||||
*/
|
||||
upload(publicKeyArmored) {
|
||||
const uri = this._baseUrl + '/pks/add';
|
||||
const fetch = this._fetch;
|
||||
|
||||
return fetch(uri, {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
},
|
||||
body: 'keytext=' + encodeURIComponent(publicKeyArmored)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default HKP;
|
|
@ -31,6 +31,4 @@ export { default as config } from './config/config';
|
|||
|
||||
export { default as Keyring } from './keyring';
|
||||
|
||||
export { default as HKP } from './hkp';
|
||||
|
||||
export { default as WKD } from './wkd';
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
const openpgp = typeof window !== 'undefined' && window.openpgp ? window.openpgp : require('../..');
|
||||
|
||||
const chai = require('chai');
|
||||
|
||||
const { expect } = chai;
|
||||
|
||||
module.exports = () => describe.skip('HKP unit tests', function() {
|
||||
this.timeout(60000); // eslint-disable-line no-invalid-this
|
||||
|
||||
let hkp;
|
||||
|
||||
const pub_key = '-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n' +
|
||||
'Version: SKS 1.1.5\r\n' +
|
||||
'Comment: Hostname: keyserver.ubuntu.com\r\n' +
|
||||
'\r\n' +
|
||||
'mQENBFUUKBcBCACwrPNnlBKPnwPXcjIdJUREoeeZx9Zw2mHPqZ3XJxq/zW38RUQgbTmjJjJv\r\n' +
|
||||
'3vO/HtXS76lTZOkWUjbLosEzKaI91phbD1SxJd4HhbRSaFpQc4yWYPmt7F7QFSYf4zGA5BRp\r\n' +
|
||||
'yRcxyQ75RklyYfndYna42jVEbW7UA753e2iDdSn3KQTKdkL+tZegUw+9vxY75X44P31rGogK\r\n' +
|
||||
'N0mEYVWWjZ+++0uZOSO0ZKwfDf65AkI598c4Wh3qXEZvKyC75YQdDNNw7KBlTbrqok0VptS+\r\n' +
|
||||
'4wok309KPbmRf5e/alUp+/B3vxOs7I7QStpjoh8jl64LhzMGlUYvpJDtC3gytK3KN9jTABEB\r\n' +
|
||||
'AAG0KVRlc3QgVXNlciA8c2FmZXdpdGhtZS50ZXN0dXNlckBnbWFpbC5jb20+iQEyBBABCAAm\r\n' +
|
||||
'BQJVFCgXBgsJCAcDAgkQRTDnvxQqhQQEFQgCCgMWAgECGwMCHgEAAAk9CACsT8cmBhWfNdEB\r\n' +
|
||||
'jTwiCJUwnE6YzYmxMqDkkkDXThZa45g0Mh2vJPSNw+kjdb8KM1L9KrqGwyN7DbYvRhEZTCKN\r\n' +
|
||||
'1Z5Xk1DfTlqHyXbUvFedP7kO6d/tdH3e6uwSz/ZaDnV7eAO9Ixh9OfZbBweFeCo/LzKSkEUa\r\n' +
|
||||
'bKNiZd925LfGhif7FLXlNeOFlTZ3PLf4RRtvQzWZsEWl3IlBJdg8NP4EdZPjoLC//o8gMuNQ\r\n' +
|
||||
'IxnHc+ZFGAJx/KfPy4el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IylLVmlH/R24ij\r\n' +
|
||||
'CfHViQ1VxWhg7Db9YxeTpu9p0sl4EtkmfK4YczJ3H5Q+fAv8HuM9iOeWXUqxIYhdXb2e0uVd\r\n' +
|
||||
'nUxxgC1OTbUFYBTI5D+VoJFIA3/i6OBeEGrrfg7ufB3xYdUoSVtZQq756/jmd7ffh1oGz5Di\r\n' +
|
||||
'uw9LVuvHh8RGCH2NZY48zdfB\r\n' +
|
||||
'=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);
|
||||
});
|
||||
|
||||
afterEach(function() {});
|
||||
|
||||
describe('lookup', function() {
|
||||
it('by email address should work', function() {
|
||||
return hkp.lookup({
|
||||
query: 'safewithme.testuser@gmail.com'
|
||||
}).then(function(key) {
|
||||
expect(key).to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
it('by email address should not find a key', function() {
|
||||
return hkp.lookup({
|
||||
query: 'safewithme.testuse@gmail.com'
|
||||
}).then(function(key) {
|
||||
expect(key).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
it('by key id should work', function() {
|
||||
return hkp.lookup({
|
||||
keyId: 'D7FB93FCDFBFC23C'
|
||||
}).then(function(key) {
|
||||
expect(key).to.exist;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
|
@ -8,7 +8,6 @@ module.exports = () => describe('General', function () {
|
|||
require('./key.js')();
|
||||
require('./openpgp.js')();
|
||||
require('./config.js')();
|
||||
require('./hkp.js')();
|
||||
require('./wkd.js')();
|
||||
require('./oid.js')();
|
||||
require('./ecc_nist.js')();
|
||||
|
|
Loading…
Reference in New Issue
Block a user