import * as requestPromise from 'request-promise-native'; import { KeyStats } from './KeyStats'; import { Stats } from './Stats'; /** * Class representing a keyserver */ export declare class Keyserver { /** The keyserver's hostname */ hostName: string; /** Optional port to make requests on (default: 11371) */ port: number; /** Base path for the keyserver (where the `/pks` paths start), (default: '') */ basePath: string; /** Request options for a query to the keyserver */ private requestOptions; /** * Constructor for creating a new keyserver * * @param hostName hostname of the keyserver * @param port port of the keyserver * @param basePath base path where to find the keyserver (the path before `/pks`, usually nothing) */ constructor(hostName: string, port?: number, basePath?: string); /** * Retrieves the keyserver's html and returns it as Promise * * @param path relative path to request, usually starts with `/pks` */ private getKeyserverHtml; /** * Retrieves a key by a given query, throws NoKeyFoundError * * @param query query to look up */ lookup(query: string): Promise; /** * Checks whether a given input is a PGP key * * @param key input to check */ private static isPgpKey; /** * Uploads a public key onto a keyserver * * @param publicKey public key to upload */ upload(publicKey: string): requestPromise.RequestPromise; /** * Retrieves the keyserver's stats html and returns it as Promise */ private getStatsHtml; /** * Maps the keyserver's html to a generic promise * * @param transformFunction function to transform HTML into a generic object */ mapStatsToView(transformFunction: (html: string) => T): Promise; /** * Retrieves the server's stats and returns a Promise, * uses the default parsing method (`parseStatsHtml`) */ getStats(): Promise; /** * Retrieves the server's key stats and returns a Promise, * uses the default parsing method (`parseKeyStatsHtml`) */ getKeyStats(): Promise; /** * Parses given html into a Stats object, throws ParseError * * @param html HTML to parse, usually from a keyserver's stats page */ static parseStatsHtml(html: string): Stats; /** * Parses given html into a KeyStats object, throws ParseError * * @param html HTML to parse, usually from a keyserver's stats page */ static parseKeyStatsHtml(html: string): KeyStats; }