openpgp

Description:
  • Functions related to OpenPGP Profiles

Source:

Functions related to OpenPGP Profiles

Methods

(static) fetch(identifier) → {Promise.<Profile>}

Description:
  • Fetch a public key

    This function will attempt to detect the identifier and fetch the key accordingly. If the identifier is an email address, it will first try and fetch the key using WKD and then HKP. Otherwise, it will try HKP only.

    This function will also try and parse the input as a plaintext key

Source:
Example
const key1 = doip.keys.fetch('alice@domain.tld');
const key2 = doip.keys.fetch('123abc123abc');
Parameters:
Name Type Description
identifier string

URI that defines the location of the key

Returns:

The profile from the fetched OpenPGP key

Type
Promise.<Profile>

(static) fetchHKP(identifier, keyserverDomainopt) → {Promise.<Profile>}

Description:
  • Fetch a public key using keyservers

Source:
Example
const key1 = doip.keys.fetchHKP('alice@domain.tld');
const key2 = doip.keys.fetchHKP('123abc123abc');
const key3 = doip.keys.fetchHKP('123abc123abc', 'pgpkeys.eu');
Parameters:
Name Type Attributes Description
identifier string

Fingerprint or email address

keyserverDomain string <optional>

Domain of the keyserver

Returns:

The profile from the fetched OpenPGP key

Type
Promise.<Profile>

(static) fetchKeybase(username, fingerprint) → {Promise.<Profile>}

Description:
  • Fetch a public key from Keybase

Source:
Example
const key = doip.keys.fetchKeybase('alice', '123abc123abc');
Parameters:
Name Type Description
username string

Keybase username

fingerprint string

Fingerprint of key

Returns:

The profile from the fetched OpenPGP key

Type
Promise.<Profile>

(static) fetchPlaintext(rawKeyContent) → {Promise.<Profile>}

Description:
  • Get a public key from armored public key text data

Source:
Example
const plainkey = `-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBF0mIsIBEADacleiyiV+z6FIunvLWrO6ZETxGNVpqM+WbBQKdW1BVrJBBolg
[...]
=6lib
-----END PGP PUBLIC KEY BLOCK-----`
const key = doip.keys.fetchPlaintext(plainkey);
Parameters:
Name Type Description
rawKeyContent string

Plaintext ASCII-formatted public key data

Returns:

The profile from the armored public key

Type
Promise.<Profile>

(static) fetchURI(uri) → {Promise.<Profile>}

Description:
  • Fetch a public key using an URI

Source:
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');
Parameters:
Name Type Description
uri string

URI that defines the location of the key

Returns:

The profile from the fetched OpenPGP key

Type
Promise.<Profile>

(static) fetchWKD(identifier) → {Promise.<Profile>}

Description:
  • Fetch a public key using Web Key Directory

Source:
Example
const key = doip.keys.fetchWKD('alice@domain.tld');
Parameters:
Name Type Description
identifier string

Identifier of format 'username@domain.tld`

Returns:

The profile from the fetched OpenPGP key

Type
Promise.<Profile>

(static) parsePublicKey(publicKey) → {Promise.<Profile>}

Description:
  • Process a public key to get a profile

Source:
Example
const key = doip.keys.fetchURI('hkp:alice@domain.tld');
const profile = doip.keys.parsePublicKey(key);
profile.personas[0].claims.forEach(claim => {
  console.log(claim.uri);
});
Parameters:
Name Type Description
publicKey PublicKey

The public key to parse

Returns:

The profile from the processed OpenPGP key

Type
Promise.<Profile>