Skip to content

Client for the OpenPGP HTTP Keyserver Protocol (HKP) to lookup and upload keys

License

Notifications You must be signed in to change notification settings

openpgpjs/hkp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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: '[email protected]'
  });
  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);
})();

About

Client for the OpenPGP HTTP Keyserver Protocol (HKP) to lookup and upload keys

Resources

License

Stars

Watchers

Forks

Packages

No packages published