import { AccountOwnedId } from '../lib/index.js';
import type { Request } from 'restify';
import { Gateway, Who } from './Gateway.js';
import { Account } from './Account.js';
export interface AccessRequest {
    /** An ID for which access is requested */
    id: AccountOwnedId;
    /**
     * Type of the `id`, requested for write. If not specified, this request is
     * for read-only.
     */
    forWrite?: string;
}
export declare abstract class Authorization {
    static fromRequest(req: Request): JwtAuthorization | KeyAuthorization;
    /**
     * @param gateway
     * @param [access] a timesheet or project access request
     * @returns {}
     */
    abstract verifyUser(gateway: Gateway, access?: AccessRequest): Promise<{
        acc: Account;
        keyid: string;
    }>;
    protected getUserAccount(gateway: Gateway, user: string): Promise<Account>;
}
export declare class KeyAuthorization extends Authorization {
    private readonly user;
    private readonly key;
    /**
     * @param user
     * @param key an authorisation key associated with this Account
     */
    constructor(user: string, key: string);
    verifyUser(gateway: Gateway, access?: AccessRequest): Promise<{
        acc: Account;
        keyid: string;
    }>;
}
export declare class JwtAuthorization extends Authorization {
    private readonly jwt;
    /** @param jwt a JWT containing a keyid associated with this Account */
    constructor(jwt: string);
    verifyUser(gateway: Gateway, access?: AccessRequest): Promise<Who>;
}
