@openpgp/hkp-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

HKP Client

This libary implements a client for the OpenPGP HTTP Keyserver Protocol (HKP) in order to lookup and upload keys on standard public key servers.

Examples

Lookup public key on HKP server

import HKP from '@openpgp/hkp-client';
import { readKey } from 'openpgp';

(async () => {
  const hkp = new HKP(); // Defaults to https://keyserver.ubuntu.com, or pass another keyserver URL as a string
  const publicKeyArmored = await hkp.lookup({
      query: 'alice@example.com'
  });
  const publicKey = await readKey({
    armoredKey: publicKeyArmored
  });
})();

Upload public key to HKP server

import HKP from '@openpgp/hkp-client';
(async () => {
  const hkp = new HKP('https://pgp.mit.edu');

  const publicKeyArmored = `-----BEGIN PGP PUBLIC KEY BLOCK-----
...
-----END PGP PUBLIC KEY BLOCK-----`;

  await hkp.upload(publicKeyArmored);
})();

Dependencies (1)

Dev Dependencies (2)

Package Sidebar

Install

npm i @openpgp/hkp-client

Weekly Downloads

171

Version

0.0.3

License

LGPL-3.0+

Unpacked Size

22.4 kB

Total Files

6

Last publish

Collaborators

  • larabr
  • twiss
  • bartbutler