From f6ef500d7935e2f4c1cff65cd3704a58c488be69 Mon Sep 17 00:00:00 2001 From: Simon Hartcher Date: Wed, 11 Feb 2026 23:33:59 +1100 Subject: [PATCH] feat: AuthProvider and supporting types --- server/plugins/auth/types.ts | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 server/plugins/auth/types.ts diff --git a/server/plugins/auth/types.ts b/server/plugins/auth/types.ts new file mode 100644 index 00000000..292a5f35 --- /dev/null +++ b/server/plugins/auth/types.ts @@ -0,0 +1,50 @@ +import type ClientManager from "../../clientManager"; +import type Client from "../../client"; + +export interface GetValidUsersParams { + users: string[]; +} + +export interface AuthStartParams { + socketId: string; +} + +export interface AuthenticateParams { + manager: ClientManager; + client: Client | null; + username: string; + password: string; +} + +export interface LogoutParams { + sessionData?: Record; +} + +export interface DisconnectParams { + socketId: string; +} + +export interface AuthStartInfo { + authUrl?: string; +} + +export type AuthResult = + | {success: false} + | {success: true; username: string; sessionData?: Record}; + +export interface LogoutInfo { + logoutUrl?: string; +} + +export interface AuthProvider { + name: string; + canChangePassword: boolean; + + init(): Promise; + getValidUsers(params: GetValidUsersParams): Promise; + + authStart(params: AuthStartParams): AuthStartInfo; + authenticate(params: AuthenticateParams): Promise; + logout(params: LogoutParams): LogoutInfo; + disconnect(params: DisconnectParams): void; +}