Class HQSLOpenPGP

A verifier and signer class for HQSL, this object takes care of interfacing to key servers and working with public keys.

Constructors

  • You will generally want to use setup instead.

    Parameters

    • trustedKeys: PublicKey[]

      Array of public key objects to trust.

    • keyServers: string[]

      Array of key server URLs.

    • timeout: number

      Timeout on key server lookups.

    Returns HQSLOpenPGP

Properties

keyServers: string[] = []

List of key server URLs.

timeout: number

Timeout used when accessing key servers.

trustedKeys: PublicKey[]

Array of public keys to be trusted for certification.

Methods

  • Given a public key, identify a list of callsign/start/end triplets it is to be accepted for, and which key certified each triplet as such. While this is used internally when verifying, it is also useful when you wish to verify an arbitrary message signed by a HQSL signing key.

    Parameters

    • key: PublicKey

      Public key

    Returns Promise<CertificationRange[]>

    An array of CertificationRange in a promise.

  • Lookup a key on every HKP keyserver initialized into the instance. Will stop trying them in order the moment one returns a reply containing a public key.

    Parameters

    • query: string

      Query string. When seeking by key IDs, you may want to add "0x" yourself, if needed.

    Returns Promise<PublicKey[]>

    Parsed public keys.

    Throws

    Error if no key is found.

  • Publish a public key to the HKP key servers.

    Parameters

    • key: PublicKey

      The key to publish.

    • Optional targetKeyServer: string

      Will attempt to publish the key to ALL key servers known, unless this parameter is a key server URL.

    Returns Promise<void>

  • Sign a HQSL object.

    Parameters

    • qsl: HQSL

      The object to sign.

    • key: PrivateKey

      Private key object.

    • Optional passphrase: string

      Passphrase, required if the key is locked.

    • Optional signingDate: Date

      Signature date.

    Returns Promise<HQSL>

  • Verify a signed HQSL object.

    Parameters

    • qsl: HQSL

      The HQSL object to verify.

    Returns Promise<HQSL>

    object with the verification field containing verification results.

  • Create a new HQSL verifier and signer instance. You have to use this, instead of a straight constructor, because of the async operations involved.

    Parameters

    • trustedKeys: (string | PublicKey | Uint8Array)[]

      Array of certifier keys to be considered trustworthy. Can be ascii-armored, binary, or pre-loaded OpenPGP keys.

    • Optional keyServers: string[]

      Array of key server URLs. Key servers are assumed to be HKPS/HKP keyservers, so nothing but the domain name and the protocol (and optionally, port) should actually be present. If empty or omitted, the default hqsl.net keyserver will be used.

    • Optional timeout: number

      Key server request timeout. The default timeout is set at 1000ms.

    Returns Promise<HQSLOpenPGP>

    The instance you will be using.