import { DateTime } from "../types/index.js";
export type OAuth2Token = {
    accessToken?: string;
    refreshToken?: string;
    expiry?: Date | DateTime | string | number | null;
    tokenType?: string;
    [key: string]: unknown;
};
export declare class AuthUser {
    Expiry: DateTime;
    RawUser: Record<string, unknown>;
    Id: string;
    Name: string;
    Username: string;
    Email: string;
    AvatarURL: string;
    AccessToken: string;
    RefreshToken: string;
    AvatarUrl: string;
    constructor(data?: Partial<AuthUser>);
    toJSON(): Record<string, unknown>;
}
export type ProviderFactoryFunc = () => Provider;
export declare const Providers: Record<string, ProviderFactoryFunc>;
export declare function newProviderByName(name: string): Provider;
export interface Provider {
    Logo(): string;
    Order(): number;
    Context(): unknown;
    SetContext(ctx: unknown): void;
    PKCE(): boolean;
    SetPKCE(enable: boolean): void;
    DisplayName(): string;
    SetDisplayName(displayName: string): void;
    Scopes(): string[] | null;
    SetScopes(scopes: string[] | null): void;
    ClientId(): string;
    SetClientId(clientId: string): void;
    ClientSecret(): string;
    SetClientSecret(secret: string): void;
    RedirectURL(): string;
    SetRedirectURL(url: string): void;
    AuthURL(): string;
    SetAuthURL(url: string): void;
    TokenURL(): string;
    SetTokenURL(url: string): void;
    UserInfoURL(): string;
    SetUserInfoURL(url: string): void;
    Extra(): Record<string, unknown> | null;
    SetExtra(data: Record<string, unknown> | null): void;
    Client(token: OAuth2Token | null): (input: Request | URL | string, init?: RequestInit) => Promise<Response>;
    BuildAuthURL(state: string, ...opts: import("./oauth2.js").AuthCodeOption[]): string;
    FetchToken(code: string, ...opts: import("./oauth2.js").AuthCodeOption[]): Promise<OAuth2Token>;
    FetchRawUserInfo(token: OAuth2Token): Promise<Uint8Array>;
    FetchAuthUser(token: OAuth2Token): Promise<AuthUser>;
}
export declare function wrapFactory<T extends Provider>(factory: () => T): ProviderFactoryFunc;
