UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

198 lines (197 loc) 8.64 kB
import type { AuthActionResponse } from "../../auth/api/AuthController"; import type { AuthResponse, SafeUser, AuthStrategy } from "../.."; import { type BaseModuleApiOptions, ModuleApi } from "../../modules/ModuleApi"; export type AuthApiOptions = BaseModuleApiOptions & { onTokenUpdate?: (token?: string, verified?: boolean) => void | Promise<void>; credentials?: "include" | "same-origin" | "omit"; }; export declare class AuthApi extends ModuleApi<AuthApiOptions> { protected getDefaultOptions(): Partial<AuthApiOptions>; login(strategy: string, input: any): Promise<import("../..").ResponseObject<AuthResponse, AuthResponse>>; register(strategy: string, input: any): Promise<import("../..").ResponseObject<AuthResponse, AuthResponse>>; actionSchema(strategy: string, action: string): Promise<import("../..").ResponseObject<AuthStrategy<import("jsonv-ts").Schema<import("jsonv-ts").ISchemaOptions, unknown, unknown>>, AuthStrategy<import("jsonv-ts").Schema<import("jsonv-ts").ISchemaOptions, unknown, unknown>>>>; action(strategy: string, action: string, input: any): Promise<import("../..").ResponseObject<AuthActionResponse, AuthActionResponse>>; /** * @deprecated use login("password", ...) instead * @param input */ loginWithPassword(input: any): Promise<import("../..").ResponseObject<AuthResponse, AuthResponse>>; /** * @deprecated use register("password", ...) instead * @param input */ registerWithPassword(input: any): Promise<import("../..").ResponseObject<AuthResponse, AuthResponse>>; me(): import("../..").FetchPromise<import("../..").ResponseObject<{ user: SafeUser | null; }, { user: SafeUser | null; }>>; strategies(): import("../..").FetchPromise<import("../..").ResponseObject<Pick<{ [x: string]: unknown; allow_register?: boolean | undefined; default_role_register?: string | undefined; guard?: { [x: string]: unknown; enabled?: boolean | undefined; } | undefined; roles?: { [x: string]: { permissions?: string[] | { effect?: "allow" | "deny" | undefined; policies?: { description?: string | undefined; filter?: import("../../core/object/query/object-query").ObjectQuery | undefined; effect?: "filter" | "allow" | "deny" | undefined; condition?: import("../../core/object/query/object-query").ObjectQuery | undefined; }[] | undefined; permission: string; }[] | undefined; is_default?: boolean | undefined; implicit_allow?: boolean | undefined; }; } | undefined; enabled: boolean; basepath: string; entity_name: string; strategies: { [x: string]: { enabled?: boolean | undefined; type: "password" | "oauth" | "custom_oauth"; config: { minLength?: number | undefined; rounds?: number | undefined; hashing: "plain" | "sha256" | "bcrypt"; } | { [x: string]: unknown; name: "google" | "github"; type: "oidc" | "oauth2"; client: { client_id: string; client_secret: string; }; } | { name: string; type: "oidc" | "oauth2"; client: { [x: string]: unknown; client_id: string; client_secret: string; token_endpoint_auth_method: "client_secret_basic"; }; as: { code_challenge_methods_supported?: "S256" | undefined; scopes_supported?: string[] | undefined; scope_separator?: string | undefined; authorization_endpoint?: string | undefined; token_endpoint?: string | undefined; userinfo_endpoint?: string | undefined; issuer: string; }; }; }; }; jwt: { alg?: "HS256" | "HS384" | "HS512" | undefined; expires?: number | undefined; issuer?: string | undefined; secret: string; fields: string[]; }; cookie: { path?: string | undefined; expires?: number | undefined; domain?: string | undefined; sameSite?: "strict" | "lax" | "none" | undefined; secure?: boolean | undefined; httpOnly?: boolean | undefined; partitioned?: boolean | undefined; renew?: boolean | undefined; pathSuccess?: string | undefined; pathLoggedOut?: string | undefined; }; }, "basepath" | "strategies">, Pick<{ [x: string]: unknown; allow_register?: boolean | undefined; default_role_register?: string | undefined; guard?: { [x: string]: unknown; enabled?: boolean | undefined; } | undefined; roles?: { [x: string]: { permissions?: string[] | { effect?: "allow" | "deny" | undefined; policies?: { description?: string | undefined; filter?: import("../../core/object/query/object-query").ObjectQuery | undefined; effect?: "filter" | "allow" | "deny" | undefined; condition?: import("../../core/object/query/object-query").ObjectQuery | undefined; }[] | undefined; permission: string; }[] | undefined; is_default?: boolean | undefined; implicit_allow?: boolean | undefined; }; } | undefined; enabled: boolean; basepath: string; entity_name: string; strategies: { [x: string]: { enabled?: boolean | undefined; type: "password" | "oauth" | "custom_oauth"; config: { minLength?: number | undefined; rounds?: number | undefined; hashing: "plain" | "sha256" | "bcrypt"; } | { [x: string]: unknown; name: "google" | "github"; type: "oidc" | "oauth2"; client: { client_id: string; client_secret: string; }; } | { name: string; type: "oidc" | "oauth2"; client: { [x: string]: unknown; client_id: string; client_secret: string; token_endpoint_auth_method: "client_secret_basic"; }; as: { code_challenge_methods_supported?: "S256" | undefined; scopes_supported?: string[] | undefined; scope_separator?: string | undefined; authorization_endpoint?: string | undefined; token_endpoint?: string | undefined; userinfo_endpoint?: string | undefined; issuer: string; }; }; }; }; jwt: { alg?: "HS256" | "HS384" | "HS512" | undefined; expires?: number | undefined; issuer?: string | undefined; secret: string; fields: string[]; }; cookie: { path?: string | undefined; expires?: number | undefined; domain?: string | undefined; sameSite?: "strict" | "lax" | "none" | undefined; secure?: boolean | undefined; httpOnly?: boolean | undefined; partitioned?: boolean | undefined; renew?: boolean | undefined; pathSuccess?: string | undefined; pathLoggedOut?: string | undefined; }; }, "basepath" | "strategies">>>; logout(): Promise<void | undefined>; }