diff --git a/.changeset/fifty-radios-count.md b/.changeset/fifty-radios-count.md new file mode 100644 index 0000000..627ca4b --- /dev/null +++ b/.changeset/fifty-radios-count.md @@ -0,0 +1,6 @@ +--- +"@telegram-auth/server": patch +"@telegram-auth/react": patch +--- + +Updated docs diff --git a/examples/next-auth-app-router/app/api/auth/[...nextauth]/route.ts b/examples/next-auth-app-router/app/api/auth/[...nextauth]/route.ts index b333667..dead1f8 100644 --- a/examples/next-auth-app-router/app/api/auth/[...nextauth]/route.ts +++ b/examples/next-auth-app-router/app/api/auth/[...nextauth]/route.ts @@ -1,7 +1,8 @@ import NextAuth, { NextAuthOptions } from 'next-auth'; import CredentialsProvider from 'next-auth/providers/credentials'; -import { objectToAuthDataMap, AuthDataValidator } from '@telegram-auth/server'; +import { AuthDataValidator } from '@telegram-auth/server'; +import { objectToAuthDataMap } from '@telegram-auth/server/utils'; export type User = { id: string; diff --git a/examples/next-auth/pages/api/auth/[...nextauth].ts b/examples/next-auth/pages/api/auth/[...nextauth].ts index 4f64e61..f58c00c 100644 --- a/examples/next-auth/pages/api/auth/[...nextauth].ts +++ b/examples/next-auth/pages/api/auth/[...nextauth].ts @@ -1,6 +1,7 @@ import NextAuth, { NextAuthOptions } from 'next-auth'; import CredentialsProvider from 'next-auth/providers/credentials'; -import { objectToAuthDataMap, AuthDataValidator } from '@telegram-auth/server'; +import { AuthDataValidator } from '@telegram-auth/server'; +import { objectToAuthDataMap } from '@telegram-auth/server/utils'; export const authOptions: NextAuthOptions = { providers: [ diff --git a/examples/remix-basic/app/routes/auth.tsx b/examples/remix-basic/app/routes/auth.tsx index 1ddce50..9dc2ad0 100644 --- a/examples/remix-basic/app/routes/auth.tsx +++ b/examples/remix-basic/app/routes/auth.tsx @@ -1,6 +1,7 @@ import { redirect } from '@remix-run/node'; import type { LoaderFunction } from '@remix-run/node'; -import { urlStrToAuthDataMap, AuthDataValidator } from '@telegram-auth/server'; +import { AuthDataValidator } from '@telegram-auth/server'; +import { urlStrToAuthDataMap } from '@telegram-auth/server/utils'; import { getSession, commitSession } from '../sessions'; export const loader: LoaderFunction = async ({ request }) => { diff --git a/internal/eslint-config/package.json b/internal/eslint-config/package.json index ff65e37..3b0f1f4 100644 --- a/internal/eslint-config/package.json +++ b/internal/eslint-config/package.json @@ -22,8 +22,5 @@ "prettier": "^3.0.3", "react": "^18.2.0", "typescript": "^5.2.2" - }, - "publishConfig": { - "access": "public" } } diff --git a/package.json b/package.json index 9059b80..0773432 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "release:dev": "changeset publish --tag dev", "test": "turbo run test", "typecheck": "tsc --noEmit", - "version-packages": "changeset version", + "version-packages": "changeset version && pnpm -r run version", "version:dev": "changeset version --snapshot dev" }, "devDependencies": { diff --git a/packages/react/README.md b/packages/react/README.md index 5c8cec7..a2f6fc0 100644 --- a/packages/react/README.md +++ b/packages/react/README.md @@ -72,7 +72,8 @@ You can use [`@telegram-auth/server`](../server) server-side to validate the dat ```ts title=validate.ts -import { urlStrToAuthDataMap, AuthDataValidator } from '@telegram-auth/server'; +import { AuthDataValidator } from '@telegram-auth/server'; +import { urlStrToAuthDataMap } from '@telegram-auth/server/utils'; const validator = new AuthDataValidator({ botToken: process.env.BOT_TOKEN }); diff --git a/packages/react/docs/README.md b/packages/react/docs/README.md index 62c0eb5..b6a7d3e 100644 --- a/packages/react/docs/README.md +++ b/packages/react/docs/README.md @@ -4,17 +4,17 @@ ## Table of contents -### Functions - -- [LoginButton](README.md#loginbutton) -- [createScript](README.md#createscript) - ### Interfaces - [TelegramAuthData](interfaces/TelegramAuthData.md) - [LoginButtonProps](interfaces/LoginButtonProps.md) - [CreateScriptOptions](interfaces/CreateScriptOptions.md) +### Functions + +- [LoginButton](README.md#loginbutton) +- [createScript](README.md#createscript) + ## Functions ### LoginButton @@ -23,10 +23,6 @@ A React component that renders a Telegram login button. -**`See`** - -https://core.telegram.org/widgets/login - #### Parameters | Name | Type | Description | @@ -39,9 +35,13 @@ https://core.telegram.org/widgets/login A React component that renders the Telegram login button. +**`See`** + +https://core.telegram.org/widgets/login + #### Defined in -[LoginButton.tsx:23](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/LoginButton.tsx#L23) +[LoginButton.tsx:23](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/LoginButton.tsx#L23) ___ @@ -51,10 +51,6 @@ ___ It creates a script tag with the right attributes to load the Telegram widget -**`See`** - -https://core.telegram.org/widgets/login - #### Parameters | Name | Type | Description | @@ -67,6 +63,10 @@ https://core.telegram.org/widgets/login A script element +**`See`** + +https://core.telegram.org/widgets/login + #### Defined in -[createScript.ts:11](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/createScript.ts#L11) +[createScript.ts:11](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/createScript.ts#L11) diff --git a/packages/react/docs/interfaces/CreateScriptOptions.md b/packages/react/docs/interfaces/CreateScriptOptions.md index 33b700f..3e0f853 100644 --- a/packages/react/docs/interfaces/CreateScriptOptions.md +++ b/packages/react/docs/interfaces/CreateScriptOptions.md @@ -38,7 +38,7 @@ The username of the bot that will be used to authenticate the user. #### Defined in -[types.ts:25](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L25) +[types.ts:25](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L25) ___ @@ -54,7 +54,7 @@ The URL where the auth data from Telegram will be sent. #### Defined in -[types.ts:20](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L20) +[types.ts:20](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L20) ___ @@ -66,7 +66,9 @@ The size of the button. **`Default`** +```ts 'large' +``` #### Inherited from @@ -74,7 +76,7 @@ The size of the button. #### Defined in -[types.ts:32](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L32) +[types.ts:32](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L32) ___ @@ -90,7 +92,7 @@ The radius of the button corners. #### Defined in -[types.ts:37](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L37) +[types.ts:37](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L37) ___ @@ -102,7 +104,9 @@ The language of the button. **`Default`** +```ts "en" +``` #### Inherited from @@ -110,7 +114,7 @@ The language of the button. #### Defined in -[types.ts:44](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L44) +[types.ts:44](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L44) ___ @@ -140,7 +144,7 @@ The callback function that will be called when the user is authenticated. #### Defined in -[types.ts:49](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L49) +[types.ts:49](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L49) ___ @@ -152,7 +156,9 @@ The access level that the bot will request. **`Default`** +```ts "write" +``` #### Inherited from @@ -160,7 +166,7 @@ The access level that the bot will request. #### Defined in -[types.ts:56](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L56) +[types.ts:56](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L56) ___ @@ -172,7 +178,9 @@ Whether to show the user's avatar. **`Default`** +```ts true +``` #### Inherited from @@ -180,7 +188,7 @@ true #### Defined in -[types.ts:63](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L63) +[types.ts:63](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L63) ___ @@ -196,4 +204,4 @@ The version of the Telegram widget to deal with browser caching. #### Defined in -[types.ts:68](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L68) +[types.ts:68](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L68) diff --git a/packages/react/docs/interfaces/LoginButtonProps.md b/packages/react/docs/interfaces/LoginButtonProps.md index fb3a9cf..5591504 100644 --- a/packages/react/docs/interfaces/LoginButtonProps.md +++ b/packages/react/docs/interfaces/LoginButtonProps.md @@ -32,7 +32,7 @@ The username of the bot that will be used to authenticate the user. #### Defined in -[types.ts:25](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L25) +[types.ts:25](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L25) ___ @@ -44,7 +44,7 @@ The URL where the auth data from Telegram will be sent. #### Defined in -[types.ts:20](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L20) +[types.ts:20](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L20) ___ @@ -56,11 +56,13 @@ The size of the button. **`Default`** +```ts 'large' +``` #### Defined in -[types.ts:32](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L32) +[types.ts:32](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L32) ___ @@ -72,7 +74,7 @@ The radius of the button corners. #### Defined in -[types.ts:37](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L37) +[types.ts:37](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L37) ___ @@ -84,11 +86,13 @@ The language of the button. **`Default`** +```ts "en" +``` #### Defined in -[types.ts:44](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L44) +[types.ts:44](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L44) ___ @@ -114,7 +118,7 @@ The callback function that will be called when the user is authenticated. #### Defined in -[types.ts:49](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L49) +[types.ts:49](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L49) ___ @@ -126,11 +130,13 @@ The access level that the bot will request. **`Default`** +```ts "write" +``` #### Defined in -[types.ts:56](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L56) +[types.ts:56](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L56) ___ @@ -142,11 +148,13 @@ Whether to show the user's avatar. **`Default`** +```ts true +``` #### Defined in -[types.ts:63](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L63) +[types.ts:63](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L63) ___ @@ -158,4 +166,4 @@ The version of the Telegram widget to deal with browser caching. #### Defined in -[types.ts:68](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L68) +[types.ts:68](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L68) diff --git a/packages/react/docs/interfaces/TelegramAuthData.md b/packages/react/docs/interfaces/TelegramAuthData.md index 45db4ee..ac5e017 100644 --- a/packages/react/docs/interfaces/TelegramAuthData.md +++ b/packages/react/docs/interfaces/TelegramAuthData.md @@ -28,7 +28,7 @@ https://core.telegram.org/widgets/login#receiving-authorization-data #### Defined in -[types.ts:7](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L7) +[types.ts:7](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L7) ___ @@ -38,7 +38,7 @@ ___ #### Defined in -[types.ts:8](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L8) +[types.ts:8](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L8) ___ @@ -48,7 +48,7 @@ ___ #### Defined in -[types.ts:9](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L9) +[types.ts:9](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L9) ___ @@ -58,7 +58,7 @@ ___ #### Defined in -[types.ts:10](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L10) +[types.ts:10](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L10) ___ @@ -68,7 +68,7 @@ ___ #### Defined in -[types.ts:11](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L11) +[types.ts:11](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L11) ___ @@ -78,7 +78,7 @@ ___ #### Defined in -[types.ts:12](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L12) +[types.ts:12](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L12) ___ @@ -88,4 +88,4 @@ ___ #### Defined in -[types.ts:13](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/react/src/types.ts#L13) +[types.ts:13](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/react/src/types.ts#L13) diff --git a/packages/react/package.json b/packages/react/package.json index 7c68432..6eb9016 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -55,7 +55,8 @@ "prepublishOnly": "pnpm build", "test": "jest", "test:watch": "jest --watch", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit", + "version": "pnpm build:docs" }, "devDependencies": { "@telegram-auth/jest": "workspace:*", diff --git a/packages/react/src/LoginButton.tsx b/packages/react/src/LoginButton.tsx index 2c4a5e2..0a5c440 100644 --- a/packages/react/src/LoginButton.tsx +++ b/packages/react/src/LoginButton.tsx @@ -25,7 +25,7 @@ export function LoginButton(props: LoginButtonProps) { const scriptRef = useRef(); useEffect(() => { - // destry the existing script element + // destroy the existing script element scriptRef.current?.remove(); // init the global variable diff --git a/packages/react/tsconfig.build.json b/packages/react/tsconfig.build.json index d8201b2..5e8b298 100644 --- a/packages/react/tsconfig.build.json +++ b/packages/react/tsconfig.build.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "extends": "./tsconfig.json", "include": [ - // do not incldue tests in the build + // do not include tests in the build "src" ] } diff --git a/packages/react/typedoc.json b/packages/react/typedoc.json index 08c0f03..5bece73 100644 --- a/packages/react/typedoc.json +++ b/packages/react/typedoc.json @@ -1,4 +1,5 @@ { + "$schema": "https://typedoc.org/schema.json", "extends": ["../../typedoc.json"], "out": "docs", "entryPoints": ["src/index.ts"] diff --git a/packages/server/README.md b/packages/server/README.md index 935d655..66891cb 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -26,7 +26,8 @@ pnpm add @telegram-auth/server ```ts title=validate.ts -import { urlStrToAuthDataMap, AuthDataValidator } from '@telegram-auth/server'; +import { AuthDataValidator } from '@telegram-auth/server'; +import { urlStrToAuthDataMap } from '@telegram-auth/server/utils'; // initialize the validator with your bot token const validator = new AuthDataValidator({ botToken: process.env.BOT_TOKEN }); diff --git a/packages/server/docs/README.md b/packages/server/docs/README.md index 07a92e9..c252b1a 100644 --- a/packages/server/docs/README.md +++ b/packages/server/docs/README.md @@ -4,14 +4,18 @@ ## Table of contents +### Classes + +- [AuthDataValidator](classes/AuthDataValidator.md) + ### Interfaces - [AuthDataValidatorOptions](interfaces/AuthDataValidatorOptions.md) - [TelegramUserData](interfaces/TelegramUserData.md) -### Classes +### Type Aliases -- [AuthDataValidator](classes/AuthDataValidator.md) +- [AuthDataMap](README.md#authdatamap) ### Functions @@ -20,9 +24,17 @@ - [objectToAuthDataMap](README.md#objecttoauthdatamap) - [urlStrToAuthDataMap](README.md#urlstrtoauthdatamap) -### Type Aliases +## Type Aliases -- [AuthDataMap](README.md#authdatamap) +### AuthDataMap + +Ƭ **AuthDataMap**: [`Map`]( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map )<`string`, `string` \| `number`\> + +Shape of the data to be passed AuthDataValidator.validate(). + +#### Defined in + +[utils/types.ts:4](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L4) ## Functions @@ -46,7 +58,7 @@ A Uint8Array of the hexString. #### Defined in -[utils/hexStringToArrayBuffer.ts:7](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/hexStringToArrayBuffer.ts#L7) +[utils/hexStringToArrayBuffer.ts:7](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/hexStringToArrayBuffer.ts#L7) ___ @@ -71,7 +83,7 @@ A new Map object with the entries from the searchParams object. #### Defined in -[utils/searchParamsToAuthDataMap.ts:10](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/searchParamsToAuthDataMap.ts#L10) +[utils/searchParamsToAuthDataMap.ts:10](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/searchParamsToAuthDataMap.ts#L10) ___ @@ -85,7 +97,7 @@ It takes an object and returns auth data Map | Name | Type | Description | | :------ | :------ | :------ | -| `data` | `Record`<`string`, `string` \| `number`\> | The object to convert to a Map | +| `data` | [`Record`]( https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type )<`string`, `string` \| `number`\> | The object to convert to a Map | #### Returns @@ -95,7 +107,7 @@ A new Map object with the entries of the object passed in. #### Defined in -[utils/objectToAuthDataMap.ts:9](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/objectToAuthDataMap.ts#L9) +[utils/objectToAuthDataMap.ts:9](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/objectToAuthDataMap.ts#L9) ___ @@ -120,16 +132,4 @@ A Map object with the key/value pairs from the URL's query string. #### Defined in -[utils/urlStrToAuthDataMap.ts:8](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/urlStrToAuthDataMap.ts#L8) - -## Type Aliases - -### AuthDataMap - -Ƭ **AuthDataMap**: [`Map`]( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map )<`string`, `string` \| `number`\> - -Shape of the data to be passed AuthDataValidator.validate(). - -#### Defined in - -[utils/types.ts:4](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L4) +[utils/urlStrToAuthDataMap.ts:8](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/urlStrToAuthDataMap.ts#L8) diff --git a/packages/server/docs/classes/AuthDataValidator.md b/packages/server/docs/classes/AuthDataValidator.md index b64fa5e..5a81373 100644 --- a/packages/server/docs/classes/AuthDataValidator.md +++ b/packages/server/docs/classes/AuthDataValidator.md @@ -37,7 +37,7 @@ https://core.telegram.org/widgets/login#checking-authorization #### Defined in -[AuthDataValidator.ts:55](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L55) +[AuthDataValidator.ts:56](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L56) ## Methods @@ -59,7 +59,7 @@ Sets the bot token to be used for validating the data #### Defined in -[AuthDataValidator.ts:96](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L96) +[AuthDataValidator.ts:97](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L97) ___ @@ -81,7 +81,7 @@ Sets the crypto to be used for validating the data #### Defined in -[AuthDataValidator.ts:107](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L107) +[AuthDataValidator.ts:108](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L108) ___ @@ -103,7 +103,7 @@ Sets the encoder to be used for encoding the data #### Defined in -[AuthDataValidator.ts:118](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L118) +[AuthDataValidator.ts:119](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L119) ___ @@ -126,7 +126,7 @@ which is the number of seconds after which the data is considered invalid. #### Defined in -[AuthDataValidator.ts:131](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L131) +[AuthDataValidator.ts:132](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L132) ___ @@ -148,7 +148,7 @@ This function sets the throwIfEmptyData property of the class. #### Defined in -[AuthDataValidator.ts:142](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L142) +[AuthDataValidator.ts:143](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L143) ___ @@ -158,10 +158,6 @@ ___ It takes a map of auth data received from Telegram, and returns the data if it's valid -**`See`** - -https://core.telegram.org/widgets/login#checking-authorization - #### Type parameters | Name | Type | @@ -180,6 +176,10 @@ https://core.telegram.org/widgets/login#checking-authorization The validated data. +**`See`** + +https://core.telegram.org/widgets/login#checking-authorization + #### Defined in -[AuthDataValidator.ts:156](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L156) +[AuthDataValidator.ts:157](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L157) diff --git a/packages/server/docs/interfaces/AuthDataValidatorOptions.md b/packages/server/docs/interfaces/AuthDataValidatorOptions.md index ffe0adb..a8f0d12 100644 --- a/packages/server/docs/interfaces/AuthDataValidatorOptions.md +++ b/packages/server/docs/interfaces/AuthDataValidatorOptions.md @@ -24,7 +24,7 @@ If you don't pass this here, you'll need to set it later using `setBotToken()`. #### Defined in -[AuthDataValidator.ts:10](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L10) +[AuthDataValidator.ts:10](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L10) ___ @@ -40,7 +40,7 @@ https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto #### Defined in -[AuthDataValidator.ts:17](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L17) +[AuthDataValidator.ts:17](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L17) ___ @@ -52,7 +52,7 @@ The encoder to be used for encoding the data #### Defined in -[AuthDataValidator.ts:22](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L22) +[AuthDataValidator.ts:22](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L22) ___ @@ -64,11 +64,19 @@ The time in seconds after which the data should be considered invalid **`Default`** +```ts 86400 (1 day) +``` + +**`Default Value`** + +```ts +86400 (1 day) +``` #### Defined in -[AuthDataValidator.ts:29](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L29) +[AuthDataValidator.ts:30](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L30) ___ @@ -80,8 +88,10 @@ Whether to throw an error if the data is empty/incomplete **`Default`** +```ts true +``` #### Defined in -[AuthDataValidator.ts:36](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/AuthDataValidator.ts#L36) +[AuthDataValidator.ts:37](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/AuthDataValidator.ts#L37) diff --git a/packages/server/docs/interfaces/TelegramUserData.md b/packages/server/docs/interfaces/TelegramUserData.md index 801d236..72ce40b 100644 --- a/packages/server/docs/interfaces/TelegramUserData.md +++ b/packages/server/docs/interfaces/TelegramUserData.md @@ -29,7 +29,7 @@ https://core.telegram.org/widgets/login#receiving-authorization-data #### Defined in -[utils/types.ts:12](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L12) +[utils/types.ts:12](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L12) ___ @@ -39,7 +39,7 @@ ___ #### Defined in -[utils/types.ts:13](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L13) +[utils/types.ts:13](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L13) ___ @@ -49,7 +49,7 @@ ___ #### Defined in -[utils/types.ts:14](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L14) +[utils/types.ts:14](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L14) ___ @@ -59,7 +59,7 @@ ___ #### Defined in -[utils/types.ts:15](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L15) +[utils/types.ts:15](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L15) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[utils/types.ts:16](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L16) +[utils/types.ts:16](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L16) ___ @@ -79,7 +79,7 @@ ___ #### Defined in -[utils/types.ts:18](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L18) +[utils/types.ts:18](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L18) ___ @@ -89,7 +89,7 @@ ___ #### Defined in -[utils/types.ts:19](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L19) +[utils/types.ts:19](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L19) ___ @@ -99,4 +99,4 @@ ___ #### Defined in -[utils/types.ts:20](https://github.com/manzoorwanijk/telegram-auth/blob/063fb29/packages/server/src/utils/types.ts#L20) +[utils/types.ts:20](https://github.com/manzoorwanijk/telegram-auth/blob/5d7eb0c/packages/server/src/utils/types.ts#L20) diff --git a/packages/server/package.json b/packages/server/package.json index 495d162..0752809 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -23,6 +23,17 @@ ".": { "import": "./dist/esm/index.js", "require": "./dist/cjs/index.js" + }, + "./utils": { + "import": "./dist/esm/utils/index.js", + "require": "./dist/cjs/utils/index.js" + } + }, + "typesVersions": { + "*": { + "utils": [ + "./dist/cjs/utils/index.d.ts" + ] } }, "files": [ @@ -57,7 +68,8 @@ "test:cf": "jest --env=miniflare", "test:node": "jest --env=node", "test:watch": "jest --watch", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit", + "version": "pnpm build:docs" }, "devDependencies": { "@telegram-auth/jest": "workspace:*", diff --git a/packages/server/tsconfig.build.json b/packages/server/tsconfig.build.json index d8201b2..5e8b298 100644 --- a/packages/server/tsconfig.build.json +++ b/packages/server/tsconfig.build.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/tsconfig", "extends": "./tsconfig.json", "include": [ - // do not incldue tests in the build + // do not include tests in the build "src" ] } diff --git a/packages/server/typedoc.json b/packages/server/typedoc.json index 08c0f03..5bece73 100644 --- a/packages/server/typedoc.json +++ b/packages/server/typedoc.json @@ -1,4 +1,5 @@ { + "$schema": "https://typedoc.org/schema.json", "extends": ["../../typedoc.json"], "out": "docs", "entryPoints": ["src/index.ts"] diff --git a/typedoc.json b/typedoc.json index 74104ab..075631b 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,4 +1,5 @@ { + "$schema": "https://typedoc.org/schema.json", "sort": ["required-first"], "excludeInternal": true, "excludeProtected": true,