@authly/sdk 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/globals/clients/AuthlyClient.d.ts +91 -58
  2. package/dist/globals/clients/AuthlyClient.js +255 -17
  3. package/dist/globals/configuration/AuthlyConfiguration.d.ts +40 -0
  4. package/dist/globals/configuration/AuthlyConfiguration.js +43 -0
  5. package/dist/globals/{clients → internal}/HttpClient.d.ts +7 -7
  6. package/dist/globals/{clients → internal}/HttpClient.js +7 -7
  7. package/dist/globals/internal/JWTVerifier.d.ts +37 -0
  8. package/dist/globals/internal/JWTVerifier.js +71 -0
  9. package/dist/globals/internal/PKCEUtils.d.ts +23 -0
  10. package/dist/globals/internal/PKCEUtils.js +59 -0
  11. package/dist/index.d.ts +25 -2
  12. package/dist/index.js +25 -2
  13. package/dist/models/builders/process-errors/base/AuthlyError.d.ts +11 -0
  14. package/dist/models/builders/process-errors/base/AuthlyError.js +18 -0
  15. package/dist/models/builders/process-errors/base/AuthlyTokenError.d.ts +12 -0
  16. package/dist/models/builders/process-errors/base/AuthlyTokenError.js +19 -0
  17. package/dist/models/builders/process-errors/tokens/AuthlyTokenExpiredError.d.ts +13 -0
  18. package/dist/models/builders/process-errors/tokens/AuthlyTokenExpiredError.js +20 -0
  19. package/dist/models/builders/process-errors/tokens/AuthlyTokenInvalidError.d.ts +16 -0
  20. package/dist/models/builders/process-errors/tokens/AuthlyTokenInvalidError.js +23 -0
  21. package/dist/models/globals/clients/interfaces/IAuthlyClientOptions.d.ts +62 -0
  22. package/dist/models/globals/clients/interfaces/IAuthlyStorage.d.ts +22 -0
  23. package/dist/models/globals/clients/interfaces/IAuthlyStorage.js +2 -0
  24. package/dist/models/globals/clients/interfaces/IAuthorizeUrlOptions.d.ts +36 -0
  25. package/dist/models/globals/clients/interfaces/IAuthorizeUrlOptions.js +2 -0
  26. package/dist/models/globals/clients/interfaces/IDecodedTokenClaim.d.ts +68 -0
  27. package/dist/models/globals/clients/interfaces/IDecodedTokenClaim.js +2 -0
  28. package/dist/models/globals/clients/interfaces/ITokenResponse.d.ts +29 -0
  29. package/dist/models/globals/clients/interfaces/ITokenResponse.js +2 -0
  30. package/dist/models/globals/clients/interfaces/IUserProfile.d.ts +42 -0
  31. package/dist/models/globals/clients/interfaces/IUserProfile.js +2 -0
  32. package/dist/models/globals/clients/internal/interfaces/IJWTVerifierOptions.d.ts +33 -0
  33. package/dist/models/globals/clients/internal/interfaces/IJWTVerifierOptions.js +2 -0
  34. package/dist/react/AuthlyCallback.d.ts +20 -0
  35. package/dist/react/AuthlyCallback.js +45 -0
  36. package/dist/react/AuthlyContext.d.ts +16 -0
  37. package/dist/react/AuthlyContext.js +14 -0
  38. package/dist/react/AuthlyProvider.d.ts +8 -0
  39. package/dist/react/AuthlyProvider.js +54 -0
  40. package/dist/react/index.d.ts +3 -0
  41. package/dist/react/index.js +19 -0
  42. package/package.json +27 -4
  43. package/dist/config.d.ts +0 -3
  44. package/dist/config.js +0 -6
  45. package/dist/exceptions/index.d.ts +0 -27
  46. package/dist/exceptions/index.js +0 -46
  47. package/dist/globals/clients/internal/JWTVerifier.d.ts +0 -26
  48. package/dist/globals/clients/internal/JWTVerifier.js +0 -55
  49. package/dist/models/Claims.d.ts +0 -48
  50. /package/dist/models/{Claims.js → globals/clients/interfaces/IAuthlyClientOptions.js} +0 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @summary Interface for the token response.
3
+ */
4
+ export interface ITokenResponse {
5
+ /**
6
+ * @summary The access token.
7
+ */
8
+ access_token: string;
9
+ /**
10
+ * @summary The token type.
11
+ */
12
+ token_type: string;
13
+ /**
14
+ * @summary The expiration time in seconds.
15
+ */
16
+ expires_in: number;
17
+ /**
18
+ * @summary The refresh token.
19
+ */
20
+ refresh_token?: string;
21
+ /**
22
+ * @summary The ID token.
23
+ */
24
+ id_token?: string;
25
+ /**
26
+ * @summary The scope of the token.
27
+ */
28
+ scope?: string;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @summary Represents the user profile information returned by Authly.
3
+ */
4
+ export interface IUserProfile {
5
+ /**
6
+ * @summary The unique identifier for the user.
7
+ */
8
+ sub: string;
9
+ /**
10
+ * @summary The user's email address.
11
+ */
12
+ email?: string;
13
+ /**
14
+ * @summary Whether the user's email address has been verified.
15
+ */
16
+ email_verified?: boolean;
17
+ /**
18
+ * @summary The user's full name.
19
+ */
20
+ name?: string;
21
+ /**
22
+ * @summary The user's given (first) name.
23
+ */
24
+ given_name?: string;
25
+ /**
26
+ * @summary The user's family (last) name.
27
+ */
28
+ family_name?: string;
29
+ /**
30
+ * @summary The user's preferred username.
31
+ */
32
+ preferred_username?: string;
33
+ /**
34
+ * @summary The user's permissions in Authly.
35
+ * @description A record where keys are resource names and values are bitmask integers.
36
+ */
37
+ permissions?: Record<string, number>;
38
+ /**
39
+ * @summary Additional custom claims.
40
+ */
41
+ [key: string]: unknown;
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import type { JWTVerifyGetKey } from "jose";
2
+ /**
3
+ * @summary Options for the JWTVerifier class.
4
+ */
5
+ interface IJWTVerifierOptions {
6
+ /**
7
+ * @summary The issuer of the token.
8
+ * @example "https://auth.example.com"
9
+ */
10
+ readonly issuer: string;
11
+ /**
12
+ * @summary The audience of the token.
13
+ * @example "https://app.example.com"
14
+ */
15
+ readonly audience: string;
16
+ /**
17
+ * @summary The URL of the JWKS endpoint.
18
+ * @example "https://auth.example.com/.well-known/jwks.json"
19
+ */
20
+ readonly jwksUrl: string;
21
+ /**
22
+ * @summary The algorithms to use for the token.
23
+ * @example ["RS256", "ES256"]
24
+ * @default ["RS256"]
25
+ */
26
+ readonly algorithms?: string[];
27
+ /**
28
+ * @summary The JWKS to use for the token.
29
+ * @example async () => publicKey
30
+ */
31
+ readonly jwks?: JWTVerifyGetKey;
32
+ }
33
+ export type { IJWTVerifierOptions };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import React from "react";
2
+ interface AuthlyCallbackProps {
3
+ /**
4
+ * @summary The URL to redirect to after successful login.
5
+ * @default "/"
6
+ */
7
+ onSuccess?: string;
8
+ /**
9
+ * @summary The URL to redirect to after failed login.
10
+ * @default "/login"
11
+ */
12
+ onFailure?: string;
13
+ /**
14
+ * @summary Optional custom navigation function (e.g. router.push from Next.js or navigate from React Router).
15
+ * @description If not provided, window.location.href will be used.
16
+ */
17
+ navigate?: (path: string) => void;
18
+ }
19
+ export declare const AuthlyCallback: React.FC<AuthlyCallbackProps>;
20
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthlyCallback = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const AuthlyContext_1 = require("./AuthlyContext");
7
+ const AuthlyCallback = ({ onSuccess = "/", onFailure = "/login", navigate }) => {
8
+ const { client, refresh } = (0, AuthlyContext_1.useAuthly)();
9
+ const processedRef = (0, react_1.useRef)(false);
10
+ (0, react_1.useEffect)(() => {
11
+ const handleCallback = async () => {
12
+ if (processedRef.current)
13
+ return;
14
+ processedRef.current = true;
15
+ const params = new URLSearchParams(window.location.search);
16
+ const code = params.get("code");
17
+ const state = params.get("state");
18
+ if (!code || !state) {
19
+ return;
20
+ }
21
+ try {
22
+ await client.exchangeToken(params);
23
+ await refresh();
24
+ if (navigate) {
25
+ navigate(onSuccess);
26
+ }
27
+ else {
28
+ window.location.href = onSuccess;
29
+ }
30
+ }
31
+ catch (error) {
32
+ console.error("Authly callback failed:", error);
33
+ if (navigate) {
34
+ navigate(onFailure);
35
+ }
36
+ else {
37
+ window.location.href = onFailure;
38
+ }
39
+ }
40
+ };
41
+ handleCallback();
42
+ }, [client, onSuccess, onFailure, navigate, refresh]);
43
+ return ((0, jsx_runtime_1.jsx)("div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: (0, jsx_runtime_1.jsx)("p", { children: "Authenticating..." }) }));
44
+ };
45
+ exports.AuthlyCallback = AuthlyCallback;
@@ -0,0 +1,16 @@
1
+ import type { AuthlyClient } from "../globals/clients/AuthlyClient";
2
+ import type { IUserProfile } from "../models/globals/clients/interfaces/IUserProfile";
3
+ export interface IAuthlyContext {
4
+ isAuthenticated: boolean;
5
+ isLoading: boolean;
6
+ user: IUserProfile | null;
7
+ login: (options?: Parameters<AuthlyClient["authorize"]>[0]) => Promise<void>;
8
+ logout: () => Promise<void>;
9
+ /**
10
+ * @summary Manually refresh the session state (e.g. after callback).
11
+ */
12
+ refresh: () => Promise<void>;
13
+ client: AuthlyClient;
14
+ }
15
+ export declare const AuthlyContext: import("react").Context<IAuthlyContext | undefined>;
16
+ export declare const useAuthly: () => IAuthlyContext;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useAuthly = exports.AuthlyContext = void 0;
5
+ const react_1 = require("react");
6
+ exports.AuthlyContext = (0, react_1.createContext)(undefined);
7
+ const useAuthly = () => {
8
+ const context = (0, react_1.useContext)(exports.AuthlyContext);
9
+ if (!context) {
10
+ throw new Error("useAuthly must be used within an AuthlyProvider");
11
+ }
12
+ return context;
13
+ };
14
+ exports.useAuthly = useAuthly;
@@ -0,0 +1,8 @@
1
+ import React, { ReactNode } from "react";
2
+ import type { AuthlyClient } from "../globals/clients/AuthlyClient";
3
+ interface AuthlyProviderProps {
4
+ client: AuthlyClient;
5
+ children: ReactNode;
6
+ }
7
+ export declare const AuthlyProvider: React.FC<AuthlyProviderProps>;
8
+ export {};
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.AuthlyProvider = void 0;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const AuthlyContext_1 = require("./AuthlyContext");
8
+ const AuthlyProvider = ({ client, children }) => {
9
+ const [isAuthenticated, setIsAuthenticated] = (0, react_1.useState)(false);
10
+ const [isLoading, setIsLoading] = (0, react_1.useState)(true);
11
+ const [user, setUser] = (0, react_1.useState)(null);
12
+ const checkSession = (0, react_1.useCallback)(async () => {
13
+ try {
14
+ const authenticated = await client.isAuthenticated();
15
+ setIsAuthenticated(authenticated);
16
+ if (authenticated) {
17
+ const profile = await client.getUser();
18
+ setUser(profile);
19
+ if (!profile) {
20
+ setIsAuthenticated(false);
21
+ }
22
+ }
23
+ else {
24
+ setUser(null);
25
+ }
26
+ }
27
+ catch (error) {
28
+ console.error("Authly session check failed:", error);
29
+ setIsAuthenticated(false);
30
+ setUser(null);
31
+ }
32
+ finally {
33
+ setIsLoading(false);
34
+ }
35
+ }, [client]);
36
+ (0, react_1.useEffect)(() => {
37
+ checkSession();
38
+ }, [checkSession]);
39
+ const login = (0, react_1.useCallback)(async (options) => {
40
+ const url = await client.authorize(options);
41
+ if (typeof window !== "undefined") {
42
+ window.location.href = url;
43
+ }
44
+ }, [client]);
45
+ const logout = (0, react_1.useCallback)(async () => {
46
+ await client.logout();
47
+ setIsAuthenticated(false);
48
+ setUser(null);
49
+ if (typeof window !== "undefined") {
50
+ }
51
+ }, [client]);
52
+ return ((0, jsx_runtime_1.jsx)(AuthlyContext_1.AuthlyContext.Provider, { value: { isAuthenticated, isLoading, user, login, logout, refresh: checkSession, client }, children: children }));
53
+ };
54
+ exports.AuthlyProvider = AuthlyProvider;
@@ -0,0 +1,3 @@
1
+ export * from "./AuthlyContext";
2
+ export * from "./AuthlyProvider";
3
+ export * from "./AuthlyCallback";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AuthlyContext"), exports);
18
+ __exportStar(require("./AuthlyProvider"), exports);
19
+ __exportStar(require("./AuthlyCallback"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authly/sdk",
3
3
  "description": "A library for building authentication systems using Authly.",
4
- "version": "1.1.1",
4
+ "version": "1.2.0",
5
5
  "author": {
6
6
  "name": "Anvoria",
7
7
  "url": "https://github.com/Anvoria"
@@ -27,6 +27,16 @@
27
27
  },
28
28
  "main": "dist/index.js",
29
29
  "types": "dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./react": {
36
+ "types": "./dist/react/index.d.ts",
37
+ "default": "./dist/react/index.js"
38
+ }
39
+ },
30
40
  "files": [
31
41
  "dist"
32
42
  ],
@@ -57,18 +67,31 @@
57
67
  "@eslint/json": "^0.14.0",
58
68
  "@eslint/markdown": "^7.5.1",
59
69
  "@types/bun": "^1.3.4",
60
- "@types/node": "^25.0.3",
70
+ "@types/node": "^25.0.9",
71
+ "@types/react": "^19.2.8",
61
72
  "eslint": "^9.39.2",
62
- "globals": "^16.5.0",
73
+ "globals": "^17.0.0",
63
74
  "husky": "^9.1.7",
64
75
  "jiti": "^2.6.1",
65
76
  "lint-staged": "^16.2.7",
66
77
  "prettier": "^3.7.4",
78
+ "react-dom": "^19.2.3",
67
79
  "tsx": "^4.21.0",
68
80
  "typescript": "^5.9.3",
69
81
  "typescript-eslint": "^8.50.0"
70
82
  },
71
83
  "dependencies": {
72
84
  "jose": "^6.1.3"
85
+ },
86
+ "peerDependencies": {
87
+ "react": ""
88
+ },
89
+ "peerDependenciesMeta": {
90
+ "react": {
91
+ "optional": true
92
+ },
93
+ "next": {
94
+ "optional": true
95
+ }
73
96
  }
74
- }
97
+ }
package/dist/config.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const DEFAULT_JWKS_PATH = "/.well-known/jwks.json";
2
- export declare const DEFAULT_AUTHORIZE_PATH = "/authorize";
3
- export declare const DEFAULT_ALGORITHMS: string[];
package/dist/config.js DELETED
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_ALGORITHMS = exports.DEFAULT_AUTHORIZE_PATH = exports.DEFAULT_JWKS_PATH = void 0;
4
- exports.DEFAULT_JWKS_PATH = "/.well-known/jwks.json";
5
- exports.DEFAULT_AUTHORIZE_PATH = "/authorize";
6
- exports.DEFAULT_ALGORITHMS = ["RS256"];
@@ -1,27 +0,0 @@
1
- /**
2
- * Base exception for all Authly errors.
3
- */
4
- export declare class AuthlyError extends Error {
5
- constructor(message: string);
6
- }
7
- /**
8
- * Base exception for all token errors.
9
- */
10
- export declare class TokenError extends AuthlyError {
11
- constructor(message: string);
12
- }
13
- /**
14
- * Exception raised when a token is invalid:
15
- * - bad signature
16
- * - bad format
17
- * - bad iss / aud
18
- */
19
- export declare class TokenInvalidError extends TokenError {
20
- constructor(message: string);
21
- }
22
- /**
23
- * Exception raised when a token is expired.
24
- */
25
- export declare class TokenExpiredError extends TokenError {
26
- constructor(message: string);
27
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenExpiredError = exports.TokenInvalidError = exports.TokenError = exports.AuthlyError = void 0;
4
- /**
5
- * Base exception for all Authly errors.
6
- */
7
- class AuthlyError extends Error {
8
- constructor(message) {
9
- super(message);
10
- this.name = "AuthlyError";
11
- }
12
- }
13
- exports.AuthlyError = AuthlyError;
14
- /**
15
- * Base exception for all token errors.
16
- */
17
- class TokenError extends AuthlyError {
18
- constructor(message) {
19
- super(message);
20
- this.name = "TokenError";
21
- }
22
- }
23
- exports.TokenError = TokenError;
24
- /**
25
- * Exception raised when a token is invalid:
26
- * - bad signature
27
- * - bad format
28
- * - bad iss / aud
29
- */
30
- class TokenInvalidError extends TokenError {
31
- constructor(message) {
32
- super(message);
33
- this.name = "TokenInvalidError";
34
- }
35
- }
36
- exports.TokenInvalidError = TokenInvalidError;
37
- /**
38
- * Exception raised when a token is expired.
39
- */
40
- class TokenExpiredError extends TokenError {
41
- constructor(message) {
42
- super(message);
43
- this.name = "TokenExpiredError";
44
- }
45
- }
46
- exports.TokenExpiredError = TokenExpiredError;
@@ -1,26 +0,0 @@
1
- import type { JWTVerifyGetKey } from "jose";
2
- import type { Claims } from "../../../models/Claims";
3
- /**
4
- * Internal class for verifying JWT tokens using jose.
5
- */
6
- export declare class JWTVerifier {
7
- private readonly issuer;
8
- private readonly audience;
9
- private readonly algorithms;
10
- private readonly JWKS;
11
- constructor(params: {
12
- issuer: string;
13
- audience: string;
14
- jwksUrl: string;
15
- algorithms?: string[];
16
- jwks?: JWTVerifyGetKey;
17
- });
18
- /**
19
- * Verify the JWT token and return its claims.
20
- * @param token - The encoded JWT token string.
21
- * @returns The decoded claims from the token.
22
- * @throws {TokenExpiredError} If the token's exp claim is in the past.
23
- * @throws {TokenInvalidError} If the token is otherwise invalid.
24
- */
25
- verify(token: string): Promise<Claims>;
26
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JWTVerifier = void 0;
4
- const jose_1 = require("jose");
5
- const config_1 = require("../../../config");
6
- const exceptions_1 = require("../../../exceptions");
7
- /**
8
- * Internal class for verifying JWT tokens using jose.
9
- */
10
- class JWTVerifier {
11
- issuer;
12
- audience;
13
- algorithms;
14
- JWKS;
15
- constructor(params) {
16
- this.issuer = params.issuer;
17
- this.audience = params.audience;
18
- this.algorithms = params.algorithms || config_1.DEFAULT_ALGORITHMS;
19
- this.JWKS = params.jwks || (0, jose_1.createRemoteJWKSet)(new URL(params.jwksUrl));
20
- }
21
- /**
22
- * Verify the JWT token and return its claims.
23
- * @param token - The encoded JWT token string.
24
- * @returns The decoded claims from the token.
25
- * @throws {TokenExpiredError} If the token's exp claim is in the past.
26
- * @throws {TokenInvalidError} If the token is otherwise invalid.
27
- */
28
- async verify(token) {
29
- try {
30
- const options = {
31
- issuer: this.issuer,
32
- audience: this.audience,
33
- algorithms: this.algorithms,
34
- };
35
- const { payload } = await (0, jose_1.jwtVerify)(token, this.JWKS, options);
36
- return payload;
37
- }
38
- catch (error) {
39
- if (error instanceof Error) {
40
- const code = error.code;
41
- if (code === "ERR_JWT_EXPIRED") {
42
- throw new exceptions_1.TokenExpiredError("Token has expired");
43
- }
44
- if (code === "ERR_JWT_CLAIM_VALIDATION_FAILED" ||
45
- code === "ERR_JWS_SIGNATURE_VERIFICATION_FAILED" ||
46
- code === "ERR_JWS_INVALID" ||
47
- code === "ERR_JWT_INVALID") {
48
- throw new exceptions_1.TokenInvalidError(error.message || "Token validation failed");
49
- }
50
- }
51
- throw new exceptions_1.TokenInvalidError("Invalid token");
52
- }
53
- }
54
- }
55
- exports.JWTVerifier = JWTVerifier;
@@ -1,48 +0,0 @@
1
- /**
2
- * Decoded JWT claims found in an Authly token.
3
- *
4
- * This interface contains both standard OIDC claims and Authly-specific claims
5
- * like session ID (sid) and permissions.
6
- */
7
- export interface Claims {
8
- /**
9
- * Subject identifier - the unique ID of the user.
10
- */
11
- sub: string;
12
- /**
13
- * Issuer identifier - the URL of the identity provider.
14
- */
15
- iss: string;
16
- /**
17
- * Audience(s) for which the token is intended.
18
- */
19
- aud: string | string[];
20
- /**
21
- * Expiration time (Unix timestamp).
22
- */
23
- exp: number;
24
- /**
25
- * Issued at time (Unix timestamp).
26
- */
27
- iat: number;
28
- /**
29
- * Session ID identifier.
30
- */
31
- sid: string;
32
- /**
33
- * Dictionary of permissions granted to the user, where keys are resource names and values are permission levels.
34
- */
35
- permissions: Record<string, number>;
36
- /**
37
- * Permission version.
38
- */
39
- pver?: number;
40
- /**
41
- * Space-separated list of scopes.
42
- */
43
- scope?: string;
44
- /**
45
- * Allow additional claims.
46
- */
47
- [key: string]: unknown;
48
- }