From 0e87a9df8ba9000dd58a5a6fa7a6b9e4d6ee2a00 Mon Sep 17 00:00:00 2001 From: Alois Date: Tue, 14 Apr 2026 01:43:58 +0200 Subject: [PATCH] (fix): better explentations --- README.md | 5 ++--- dist/index.d.ts | 6 ++++++ dist/index.js | 6 ++++++ src/index.ts | 6 ++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a02d29c..2425471 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,7 @@ import z from "zod"; import { TAuthClient } from "@tensamin/tauth-sdk"; const client = new TAuthClient({ - frontendUrl: "http://localhost:3000", - identifier: "your-app-identifier", + identifier: "my.cool.app", privateKey: "", publicKey: "", saveSession: async (userId, sessionId) => { @@ -48,7 +47,7 @@ const client = new TAuthClient({ // Treat the session id like a password! console.log("Save session", { userId, sessionId }); }, - redirectUrl: "http://localhost:7878/callback", + redirectUrl: "https://my.cool.app/callback", // This should be a public link proxying http://localhost:7878/callback appData: z.object({ my: z.string(), cool: z.string(), diff --git a/dist/index.d.ts b/dist/index.d.ts index f996ee6..5a80261 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -2,7 +2,13 @@ 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; diff --git a/dist/index.js b/dist/index.js index d09aa92..c6d51f8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6,7 +6,13 @@ import { get } from "./user"; import { decrypt, encrypt, getSharedSecret } from "./crypto"; import { readFile } from "node:fs/promises"; /** + * @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 class TAuthClient { frontendUrl; diff --git a/src/index.ts b/src/index.ts index afa19ce..22cd520 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,13 @@ import { decrypt, encrypt, getSharedSecret } from "./crypto"; import { readFile } from "node:fs/promises"; /** + * @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 class TAuthClient { frontendUrl: string;