interface Props { profile: string; provider: string; } export interface Profile { [provider: string]: Provider; } export declare namespace Profile { const get: (name: string) => Promise; } export interface Provider = Record> { metadata: Metadata; method: "api-key" | "api-token" | "oauth"; scopes?: string[]; } export declare namespace Provider { const get: = Record>(props: Props) => Promise | undefined>; const getWithCredentials: = Record>(props: Props) => Promise<{ provider: Provider; credentials: Credentials; }>; const set: = Record>(props: Props, provider: Provider) => Promise; const del: (props: Props) => Promise; } export type Credentials = Credentials.ApiKey | Credentials.ApiToken | Credentials.OAuth; export declare namespace Credentials { interface ApiKey { type: "api-key"; apiKey: string; email: string; } interface ApiToken { type: "api-token"; apiToken: string; } interface OAuth { type: "oauth"; access: string; refresh: string; expires: number; scopes: string[]; } /** * Gets the credentials file. * @param props The profile and provider of the credentials. */ const get: (props: Props) => Promise; /** * Sets the credentials file. * @param props The profile and provider of the credentials. * @param credentials The credentials to set. */ const set: (props: Props, credentials: Credentials) => Promise; /** * Deletes the credentials file. * @param props The profile and provider of the credentials. */ const del: (props: Props) => Promise; /** * Fetches OAuth credentials for the given provider and profile, refreshing them if they are expired. * @param props The properties of the credentials. * @param refresh The function to refresh the credentials. * @returns The refreshed credentials. */ const getRefreshed: (props: Props, refresh: (credentials: Credentials.OAuth) => Promise) => Promise; /** * Returns true if the given credentials are OAuth and expired. */ const isOAuthExpired: (credentials: Credentials, tolerance?: number) => credentials is Credentials.OAuth; } export {}; //# sourceMappingURL=auth.d.ts.map