Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Keyserver

Class representing a keyserver

Hierarchy

  • Keyserver

Index

Constructors

constructor

  • new Keyserver(hostName: string, port?: number, basePath?: string): Keyserver
  • Constructor for creating a new keyserver

    Parameters

    • hostName: string

      hostname of the keyserver

    • Default value port: number = 11371

      port of the keyserver

    • Default value basePath: string = ""

      base path where to find the keyserver (the path before /pks, usually nothing)

    Returns Keyserver

Properties

basePath

basePath: string

Base path for the keyserver (where the /pks paths start), (default: '')

hostName

hostName: string

The keyserver's hostname

port

port: number

Optional port to make requests on (default: 11371)

Private requestOptions

requestOptions: RequestPromiseOptions

Request options for a query to the keyserver

Methods

getKeyStats

  • Retrieves the server's key stats and returns a Promise, uses the default parsing method (parseKeyStatsHtml)

    Returns Promise<KeyStats>

Private getKeyserverHtml

  • getKeyserverHtml(path: string): Promise<string>
  • Retrieves the keyserver's html and returns it as Promise

    Parameters

    • path: string

      relative path to request, usually starts with /pks

    Returns Promise<string>

getStats

  • getStats(): Promise<Stats>
  • Retrieves the server's stats and returns a Promise, uses the default parsing method (parseStatsHtml)

    Returns Promise<Stats>

Private getStatsHtml

  • getStatsHtml(): Promise<string>
  • Retrieves the keyserver's stats html and returns it as Promise

    Returns Promise<string>

lookup

  • lookup(query: string): Promise<string>
  • Retrieves a key by a given query, throws NoKeyFoundError

    Parameters

    • query: string

      query to look up

    Returns Promise<string>

mapStatsToView

  • mapStatsToView<T>(transformFunction: function): Promise<T>
  • Maps the keyserver's html to a generic promise

    Type parameters

    • T

    Parameters

    • transformFunction: function

      function to transform HTML into a generic object

        • (html: string): T
        • Parameters

          • html: string

          Returns T

    Returns Promise<T>

upload

  • upload(publicKey: string): RequestPromise
  • Uploads a public key onto a keyserver

    Parameters

    • publicKey: string

      public key to upload

    Returns RequestPromise

Static Private isPgpKey

  • isPgpKey(key: string): boolean
  • Checks whether a given input is a PGP key

    Parameters

    • key: string

      input to check

    Returns boolean

Static parseKeyStatsHtml

  • parseKeyStatsHtml(html: string): KeyStats
  • Parses given html into a KeyStats object, throws ParseError

    Parameters

    • html: string

      HTML to parse, usually from a keyserver's stats page

    Returns KeyStats

Static parseStatsHtml

  • parseStatsHtml(html: string): Stats
  • Parses given html into a Stats object, throws ParseError

    Parameters

    • html: string

      HTML to parse, usually from a keyserver's stats page

    Returns Stats

Generated using TypeDoc