import { type TransportClient, READY_STATE } from "@tensamin/ttp-core"; import { createSchema } from "./schema"; import type { z, ZodObject } from "zod"; /** * @param identifier Your app's domain. * @param redirectUrl The URL should point to the TAuth HTTP Server at http://hostname:port/callback * @param frontendUrl The URL of the frontend the user interacts with. Only used in development. * @param appData A Zod schema defining the shape of the app data you want to load/save for each user. * @param saveSession A function that saves the session ID for a given user ID. This is called after a successful authentication. * @param httpServer Optional configuration for the TAuth HTTP Server. Defaults to { port: 7878, hostname: "localhost" }. * @param htmlSuccessPage Optional HTML string or path to an HTML file to be served upon successful authentication. */ export declare class TAuthClient { frontendUrl: string; identifier: string; privateKey: string; publicKey: string; saveSession: (userId: number, sessionId: number) => Promise | void; redirectUrl: URL; schema: ReturnType; httpServer: { port: number; hostname: string; }; clientMap: Map; response: z.ZodObject<{ challenge: z.ZodBase64; public_key: z.ZodBase64; }, z.core.$strip>; }; challenge_response: { request: z.ZodObject<{ challenge: z.ZodBase64; }, z.core.$strip>; response: z.ZodObject<{}, z.core.$strip>; }; load_app_data: { request: z.ZodObject<{}, z.core.$strip>; response: z.ZodObject<{ app_data: z.ZodString; }, z.core.$strip>; }; save_app_data: { request: z.ZodObject<{ app_data: z.ZodString; }, z.core.$strip>; response: z.ZodObject<{}, z.core.$strip>; }; }>>; private appData; constructor({ frontendUrl, identifier, privateKey, publicKey, saveSession, redirectUrl, appData, httpServer, htmlSuccessPage, }: { frontendUrl: string; identifier: string; privateKey: string; publicKey: string; saveSession: (userId: number, sessionId: number) => Promise | void; redirectUrl: string; appData: ZodObject; httpServer?: { port: number; hostname: string; }; htmlSuccessPage?: string; }); generateChallenge(userId: number): Promise; solveChallenge(userId: number, challenge: string): Promise; createTTP(userId: number, sessionId: number, omikronUrl: string): Promise>; loadData(userId: number, sessionId: number): Promise>; saveData(userId: number, sessionId: number, data: any): Promise; private createTemporaryTTPConnection; generateLink(challenge?: string): string; } export declare function getFriendlyReadyState(stateIndex: number): keyof typeof READY_STATE; export declare function generateKeyPair(): { private: string; public: string; }; export * from "./crypto"; export * from "./schema"; export * from "./user";