import type { ConnectionOptions } from "./types";
/**
 * @type {}
 */
export type NoAuth = void;
/**
 * @type {auth_token: string} the user token
 */
export interface TokenAuth {
    "auth_token": string;
}
/**
 * @type {user: string, pass?: string} the username and
 * optional password if the server requires.
 */
export interface UserPass {
    user: string;
    pass?: string;
}
/**
 * @type {nkey: string, sig: string} the public nkey for the user,
 * and a base64 encoded string for the calculated signature of the
 * challenge nonce.
 */
export interface NKeyAuth {
    nkey: string;
    sig: string;
}
/**
 * @type {jwt: string, nkey?: string, sig?: string} the user JWT,
 * and if not a bearer token also the public nkey for the user,
 * and a base64 encoded string for the calculated signature of the
 * challenge nonce.
 */
export interface JwtAuth {
    jwt: string;
    nkey?: string;
    sig?: string;
}
/**
 * @type NoAuth|TokenAuth|UserPass|NKeyAuth|JwtAuth
 */
export type Auth = NoAuth | TokenAuth | UserPass | NKeyAuth | JwtAuth;
/**
 * Authenticator is an interface that returns credentials.
 * @type function(nonce?: string) => Auth
 */
export interface Authenticator {
    (nonce?: string): Auth;
}
export declare function buildAuthenticator(opts: ConnectionOptions): Authenticator;
export declare function noAuthFn(): Authenticator;
/**
 * Returns a user/pass authenticator for the specified user and optional password
 * @param { string | () => string } user
 * @param {string | () => string } pass
 * @return {UserPass}
 */
export declare function usernamePasswordAuthenticator(user: string | (() => string), pass?: string | (() => string)): Authenticator;
/**
 * Returns a token authenticator for the specified token
 * @param { string | () => string } token
 * @return {TokenAuth}
 */
export declare function tokenAuthenticator(token: string | (() => string)): Authenticator;
/**
 * Returns an Authenticator that returns a NKeyAuth based that uses the
 * specified seed or function returning a seed.
 * @param {Uint8Array | (() => Uint8Array)} seed - the nkey seed
 * @return {NKeyAuth}
 */
export declare function nkeyAuthenticator(seed?: Uint8Array | (() => Uint8Array)): Authenticator;
/**
 * Returns an Authenticator function that returns a JwtAuth.
 * If a seed is provided, the public key, and signature are
 * calculated.
 *
 * @param {string | ()=>string} ajwt - the jwt
 * @param {Uint8Array | ()=> Uint8Array } seed - the optional nkey seed
 * @return {Authenticator}
 */
export declare function jwtAuthenticator(ajwt: string | (() => string), seed?: Uint8Array | (() => Uint8Array)): Authenticator;
/**
 * Returns an Authenticator function that returns a JwtAuth.
 * This is a convenience Authenticator that parses the
 * specifid creds and delegates to the jwtAuthenticator.
 * @param {Uint8Array | () => Uint8Array } creds - the contents of a creds file or a function that returns the creds
 * @returns {JwtAuth}
 */
export declare function credsAuthenticator(creds: Uint8Array | (() => Uint8Array)): Authenticator;
