import { EggContext } from '@eggjs/tegg';
import { Static } from '@sinclair/typebox';
import { AbstractController } from './AbstractController';
import { TokenType } from '../../core/entity/Token';
declare const TokenOptionsRule: import("@sinclair/typebox").TObject<{
    password: import("@sinclair/typebox").TString;
    readonly: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
    automation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
    cidr_whitelist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
}>;
type TokenOptions = Static<typeof TokenOptionsRule>;
declare const GranularTokenOptionsRule: import("@sinclair/typebox").TObject<{
    automation: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
    readonly: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
    cidr_whitelist: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
    name: import("@sinclair/typebox").TString;
    description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    allowedScopes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
    allowedPackages: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
    expires: import("@sinclair/typebox").TNumber;
}>;
type GranularTokenOptions = Static<typeof GranularTokenOptionsRule>;
export declare class TokenController extends AbstractController {
    private readonly authAdapter;
    createToken(ctx: EggContext, tokenOptions: TokenOptions): Promise<{
        token: string | undefined;
        key: string;
        cidr_whitelist: string[];
        readonly: boolean;
        automation: boolean;
        created: Date;
        updated: Date;
    }>;
    removeToken(ctx: EggContext, tokenKey: string): Promise<{
        ok: boolean;
    }>;
    listTokens(ctx: EggContext): Promise<{
        objects: {
            token: string;
            key: string;
            cidr_whitelist: string[];
            readonly: boolean;
            automation: boolean;
            created: Date;
            lastUsedAt: Date | null;
            updated: Date;
        }[];
        total: number;
        urls: {};
    }>;
    private ensureWebUser;
    createGranularToken(ctx: EggContext, tokenOptions: GranularTokenOptions): Promise<{
        name: string | undefined;
        token: string | undefined;
        key: string;
        cidr_whitelist: string[];
        readonly: boolean;
        automation: boolean;
        allowedPackages: string[] | undefined;
        allowedScopes: string[] | undefined;
        created: Date;
        updated: Date;
    }>;
    listGranularTokens(): Promise<{
        objects: {
            name: string | undefined;
            description: string | undefined;
            allowedPackages: string[] | undefined;
            allowedScopes: string[] | undefined;
            lastUsedAt: Date | null;
            expiredAt: Date | undefined;
            token: string;
            key: string;
            cidr_whitelist: string[];
            readonly: boolean;
            created: Date;
            updated: Date;
            type: TokenType | undefined;
        }[];
        total: number;
        urls: {};
    }>;
    removeGranularToken(tokenKey: string): Promise<void>;
}
export {};
