(fix): better explentations
This commit is contained in:
parent
a8fabbf0a0
commit
0e87a9df8b
4 changed files with 20 additions and 3 deletions
|
|
@ -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: "<APP_PRIVATE_KEY_BASE64>",
|
||||
publicKey: "<APP_PUBLIC_KEY_BASE64>",
|
||||
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(),
|
||||
|
|
|
|||
6
dist/index.d.ts
vendored
6
dist/index.d.ts
vendored
|
|
@ -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;
|
||||
|
|
|
|||
6
dist/index.js
vendored
6
dist/index.js
vendored
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue