/// <reference types="node" />
import crypto from 'crypto';
import { Scope } from "./types";
import { CarteSource } from "./caller";
import { MoeraNode } from "./node";
/**
 * Error obtaining valid cartes.
 */
export declare class MoeraCartesError extends Error {
    /**
     * @param {string} message - error message
     */
    constructor(message: string);
}
/**
 * Class that gets cartes from the given node, caches them and supplies them for authentication.
 */
export declare class MoeraCarteSource implements CarteSource {
    private readonly node;
    private readonly clientScope;
    private readonly adminScope;
    private readonly targetNodeName;
    private cartes;
    /**
     * @param {MoeraNode} node node to get cartes from
     * @param {Scope[] | null} clientScope permissions to be granted to the cartes; if not set, all permissions of
     * the cartes' owner are granted
     * @param {Scope[] | null} adminScope additional administrative permissions (of those granted to the cartes' owner
     * by the target node) to be granted to the cartes
     * @param {string | null} targetNodeName if set, the cartes are valid for authentication on the specified node only
     */
    constructor(node: MoeraNode, clientScope?: Scope[] | null, adminScope?: Scope[] | null, targetNodeName?: string | null);
    /**
     * Force renewing the cached list of cartes.
     */
    renew(): Promise<void>;
    /**
     * Get a valid carte. Use one of the cached ones, if possible.
     *
     * @return {Promise<string>} the carte
     */
    getCarte(): Promise<string>;
}
interface GenerateCarteOptions {
    /** length of the carte's life, in seconds */
    ttl?: number;
    /** if set, the carte is valid for authentication from the given IP address only */
    address?: string | null;
    /** if set, the carte is valid for authentication on the specified node only */
    nodeName?: string | null;
    /** list of permissions granted to the carte */
    clientScope?: Scope[] | number;
    /**
     * list of additional administrative permissions (of those granted to the carte's owner by the target node) granted
     * to the carte
     */
    adminScope?: Scope[] | number;
}
/**
 * Generate a carte with the given parameters and sign it with the provided private signing key.
 *
 * @param {string | null} ownerName - name of the node authenticating with the carte
 * @param {crypto.KeyObject} signingKey - the private signing key to sign the carte
 * @param {number} beginning - timestamp of the beginning of the carte's life
 * @param {GenerateCarteOptions} options - carte options
 * @return {Promise<string>} the carte
 */
export declare function generateCarte(ownerName: string | null, signingKey: crypto.KeyObject, beginning: number, { ttl, address, nodeName, clientScope, adminScope }?: GenerateCarteOptions): Promise<string>;
export {};
//# sourceMappingURL=cartes.d.ts.map