mirror of
https://github.com/directus/directus.git
synced 2026-02-13 01:05:05 -05:00
36 lines
762 B
TypeScript
36 lines
762 B
TypeScript
import { PasswordsHandler } from './handlers/passwords';
|
|
|
|
export type AuthCredentials = {
|
|
email: string;
|
|
password: string;
|
|
otp?: string;
|
|
};
|
|
|
|
export type AuthToken = string;
|
|
|
|
export type AuthResult = {
|
|
access_token: string;
|
|
expires: number;
|
|
refresh_token?: string | null;
|
|
};
|
|
|
|
export type AuthLoginOptions = {
|
|
refresh?: AuthRefreshOptions;
|
|
};
|
|
|
|
export type AuthRefreshOptions = {
|
|
auto?: boolean;
|
|
time?: number;
|
|
};
|
|
|
|
export interface IAuth {
|
|
readonly token: string | null;
|
|
readonly password: PasswordsHandler;
|
|
readonly expiring: boolean;
|
|
|
|
login(credentials: AuthCredentials, options?: AuthLoginOptions): Promise<AuthResult>;
|
|
refresh(force?: boolean): Promise<AuthResult | false>;
|
|
static(token: AuthToken): Promise<boolean>;
|
|
logout(): Promise<void>;
|
|
}
|