keys

Functions related to the fetching and handling of keys

Methods

# (static) fetchHKP(identifier, keyserverDomainopt) → {openpgp.key.Key}

Fetch a public key using keyservers

Parameters:
Name Type Attributes Default Description
identifier string

Fingerprint or email address

keyserverDomain string <optional>
keys.openpgp.org

Domain of the keyserver

Returns:
Type
openpgp.key.Key
Example
const key1 = doip.keys.fetchHKP('alice@domain.tld');
const key2 = doip.keys.fetchHKP('123abc123abc');

# (static) fetchKeybase(username, fingerprint) → {openpgp.key.Key}

Fetch a public key from Keybase

Parameters:
Name Type Description
username string

Keybase username

fingerprint string

Fingerprint of key

Returns:
Type
openpgp.key.Key
Example
const key = doip.keys.fetchKeybase('alice', '123abc123abc');

# (static) fetchPlaintext(rawKeyContent) → {openpgp.key.Key}

Get a public key from plaintext data

Parameters:
Name Type Description
rawKeyContent string

Plaintext ASCII-formatted public key data

Returns:
Type
openpgp.key.Key
Example
const plainkey = `-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBF0mIsIBEADacleiyiV+z6FIunvLWrO6ZETxGNVpqM+WbBQKdW1BVrJBBolg
[...]
=6lib
-----END PGP PUBLIC KEY BLOCK-----`
const key = doip.keys.fetchPlaintext(plainkey);

# (static) fetchURI(uri) → {openpgp.key.Key}

Fetch a public key using an URI

Parameters:
Name Type Description
uri string

URI that defines the location of the key

Returns:
Type
openpgp.key.Key
Example
const key1 = doip.keys.fetchURI('hkp:alice@domain.tld');
const key2 = doip.keys.fetchURI('hkp:123abc123abc');
const key3 = doip.keys.fetchURI('wkd:alice@domain.tld');

# (static) fetchWKD(identifier) → {openpgp.key.Key}

Fetch a public key using Web Key Directory

Parameters:
Name Type Description
identifier string

Identifier of format 'username@domain.tld`

Returns:
Type
openpgp.key.Key
Example
const key = doip.keys.fetchWKD('alice@domain.tld');

# (static) process(publicKey) → {object}

Process a public key to get user data and claims

Parameters:
Name Type Description
publicKey openpgp.key.Key

The public key to process

Returns:
Type
object
Example
const key = doip.keys.fetchURI('hkp:alice@domain.tld');
const data = doip.keys.process(key);
data.users[0].claims.forEach(claim => {
  console.log(claim.uri);
});