import type { AccountOwnedId } from './AccountOwnedId.js';
export interface AuthKeyConfig {
    auth: {
        key: string;
    };
}
/**
 * TODO: Better factoring of Key, AuthKey, AuthKeyDetail and UserKey
 */
export interface Key {
    /** Key identity */
    readonly keyid: string;
    /**
     * @returns {boolean} `false` if the auth key does not correspond to this key
     */
    matches(authKey: AuthKey): boolean;
}
/**
 * An authorisation key with app, keyid and secret components
 */
export declare class AuthKey implements Key {
    static fromString(keyStr: string): AuthKey;
    readonly appId: string;
    readonly keyid: string;
    readonly secret: string;
    constructor({ appId, keyid, secret }: {
        appId: string;
        keyid: string;
        secret: string;
    });
    toString(): string;
    toConfig(): AuthKeyConfig;
    matches(that: AuthKey): boolean;
}
/**
 * Full details of an authorisation key
 */
export interface KeyDetail<K extends Key = Key> {
    /** The comparable key */
    key: K;
    /** Account name */
    name: string;
    /** The revocation status */
    revoked: boolean;
}
export type GetAuthorisedTsIds = () => Promise<AccountOwnedId[]>;
/**
 * A persistent store of keys
 */
export interface KeyStore {
    /**
     * Mint a new authorisation key with the given friendly name.
     * @param name Friendly name for reference
     * @returns the key details
     */
    mintKey(name: string): Promise<KeyDetail<AuthKey>>;
    /**
     * Ping the given authorisation keyid. This operation checks that the key
     * exists, and may update its privileges; it returns the key details.
     * @param keyid
     * @param getAuthorisedTsIds callback to get authorised Timesheet IDs for the
     * requested key, if this key store supports fine-grained privileges
     * @returns the key details, or `undefined` if this keystore does not store them
     */
    pingKey(keyid: string, getAuthorisedTsIds?: GetAuthorisedTsIds): Promise<KeyDetail | undefined>;
}
