import type { Model } from '@pondoknusa/database'; import type { PondoknusaRequest } from '@pondoknusa/http'; import type { Constructor } from '@pondoknusa/container'; import type { Policy } from './policy.js'; export interface Authenticatable { getAuthIdentifier(): string | number; getAuthPassword(): string; } export type UserModelConstructor = new (attributes?: Record) => Model & Authenticatable; export interface SessionGuardConfig { driver: 'session'; provider: string; } export interface TokenGuardConfig { driver: 'token'; provider: string; hashKey?: string; } export type GuardConfig = SessionGuardConfig | TokenGuardConfig; export interface EloquentUserProviderConfig { driver: 'eloquent'; model: UserModelConstructor; } export interface PasswordBrokerConfig { provider: string; table: string; expireMinutes: number; connection?: string; } export interface OAuthProviderConfig { clientId: string; clientSecret: string; redirectUri: string; scopes?: string[]; driver?: string; /** Self-hosted instance root, e.g. `https://gitlab.example.com` (GitLab driver). */ baseUrl?: string; teamId?: string; keyId?: string; privateKey?: string; } export type SessionDriver = 'array' | 'database' | 'redis'; export interface AuthSessionConfig { driver?: SessionDriver; cookie: string; lifetimeMinutes: number; secure?: boolean; sameSite?: 'Lax' | 'Strict' | 'None'; table?: string; connection?: string; redisConnection?: string; prefix?: string; } export interface AuthConfig { defaults: { guard: string; }; guards: Record; providers: Record; session: AuthSessionConfig; passwords?: Record; oauth?: { providers: Record; accountsTable?: string; connection?: string; }; policies?: Record; tokens?: TokenRepositoryConfig; } export interface Guard { readonly name: string; setRequest(request: PondoknusaRequest): void; user(): Authenticatable | null; id(): string | number | null; check(): boolean | Promise; } export type PolicyConstructor = Constructor; export interface CreateTokenOptions { expiresIn?: string | number | Date; ipWhitelist?: string[]; } export interface NewAccessToken { id: number; plainTextToken: string; tokenPrefix: string; name: string; abilities: string[]; expiresAt: Date | null; } export interface TokenRepositoryConfig { table: string; connection?: string; prefix?: string; prefixLength?: number; } //# sourceMappingURL=types.d.ts.map