@thunderid/node 0.0.1

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 (48) hide show
  1. package/LICENSE +201 -0
  2. package/dist/ThunderIDNodeClient.d.ts +29 -0
  3. package/dist/ThunderIDNodeClient.d.ts.map +1 -0
  4. package/dist/__legacy__/client.d.ts +355 -0
  5. package/dist/__legacy__/client.d.ts.map +1 -0
  6. package/dist/__legacy__/constants/index.d.ts +20 -0
  7. package/dist/__legacy__/constants/index.d.ts.map +1 -0
  8. package/dist/__legacy__/constants/logger-config.d.ts +32 -0
  9. package/dist/__legacy__/constants/logger-config.d.ts.map +1 -0
  10. package/dist/__legacy__/constants/uuid-config.d.ts +19 -0
  11. package/dist/__legacy__/constants/uuid-config.d.ts.map +1 -0
  12. package/dist/__legacy__/core/authentication.d.ts +46 -0
  13. package/dist/__legacy__/core/authentication.d.ts.map +1 -0
  14. package/dist/__legacy__/core/index.d.ts +19 -0
  15. package/dist/__legacy__/core/index.d.ts.map +1 -0
  16. package/dist/__legacy__/models/index.d.ts +20 -0
  17. package/dist/__legacy__/models/index.d.ts.map +1 -0
  18. package/dist/__legacy__/models/session-data.d.ts +23 -0
  19. package/dist/__legacy__/models/session-data.d.ts.map +1 -0
  20. package/dist/__legacy__/models/url-callback.d.ts +19 -0
  21. package/dist/__legacy__/models/url-callback.d.ts.map +1 -0
  22. package/dist/__legacy__/stores/index.d.ts +19 -0
  23. package/dist/__legacy__/stores/index.d.ts.map +1 -0
  24. package/dist/__legacy__/stores/memory-cache-store.d.ts +24 -0
  25. package/dist/__legacy__/stores/memory-cache-store.d.ts.map +1 -0
  26. package/dist/__legacy__/utils/crypto-utils.d.ts +32 -0
  27. package/dist/__legacy__/utils/crypto-utils.d.ts.map +1 -0
  28. package/dist/__legacy__/utils/index.d.ts +20 -0
  29. package/dist/__legacy__/utils/index.d.ts.map +1 -0
  30. package/dist/__legacy__/utils/logger-utils.d.ts +26 -0
  31. package/dist/__legacy__/utils/logger-utils.d.ts.map +1 -0
  32. package/dist/__legacy__/utils/session-utils.d.ts +25 -0
  33. package/dist/__legacy__/utils/session-utils.d.ts.map +1 -0
  34. package/dist/cjs/index.cjs +773 -0
  35. package/dist/constants/CookieConfig.d.ts +28 -0
  36. package/dist/constants/CookieConfig.d.ts.map +1 -0
  37. package/dist/index.d.ts +28 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +721 -0
  40. package/dist/models/config.d.ts +45 -0
  41. package/dist/models/config.d.ts.map +1 -0
  42. package/dist/models/cookies.d.ts +59 -0
  43. package/dist/models/cookies.d.ts.map +1 -0
  44. package/dist/utils/generateSessionId.d.ts +20 -0
  45. package/dist/utils/generateSessionId.d.ts.map +1 -0
  46. package/dist/utils/getSessionCookieOptions.d.ts +41 -0
  47. package/dist/utils/getSessionCookieOptions.d.ts.map +1 -0
  48. package/package.json +70 -0
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { Config } from '@thunderid/javascript';
19
+ /**
20
+ * Configuration type for the ThunderID Node.js SDK.
21
+ * Extends the base Config type from @thunderid/javascript with Node.js specific settings.
22
+ *
23
+ * @remarks
24
+ * This type is used to configure the Node.js SDK with settings like:
25
+ * - Server endpoints
26
+ * - Authentication parameters
27
+ * - Session management options
28
+ */
29
+ export type ThunderIDNodeConfig = Config & {
30
+ /**
31
+ * Session cookie lifetime in seconds. Determines how long the session cookie
32
+ * remains valid in the browser after sign-in.
33
+ *
34
+ * Resolution order (first defined value wins):
35
+ * 1. This field — set programmatically at SDK initialisation.
36
+ * 2. `ASGARDEO_SESSION_COOKIE_EXPIRY_TIME` environment variable.
37
+ * 3. Built-in default of 86400 seconds (24 hours).
38
+ *
39
+ * @example
40
+ * // 8-hour session cookie
41
+ * { sessionCookieExpiryTime: 28800 }
42
+ */
43
+ sessionCookieExpiryTime?: number;
44
+ };
45
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/models/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG;IACzC;;;;;;;;;;;;OAYG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ /**
19
+ * Configuration options for cookie settings
20
+ *
21
+ * @typeParam CookieOptions - Interface for cookie configuration options
22
+ *
23
+ * @remarks
24
+ * These options control how cookies are set and handled by the browser:
25
+ * - Use `httpOnly` to prevent JavaScript access
26
+ * - Set `secure` to true for HTTPS-only cookies
27
+ * - Configure `sameSite` for cross-origin request handling
28
+ * - Set `maxAge` to control cookie expiration
29
+ *
30
+ * @example
31
+ * Setting secure cookie options:
32
+ * ```ts
33
+ * const options: CookieOptions = {
34
+ * httpOnly: true,
35
+ * secure: true,
36
+ * sameSite: 'strict',
37
+ * maxAge: 3600 // 1 hour
38
+ * };
39
+ * ```
40
+ */
41
+ export interface CookieOptions {
42
+ /**
43
+ * When true, makes the cookie inaccessible through JavaScript
44
+ */
45
+ httpOnly?: boolean;
46
+ /**
47
+ * Maximum age of the cookie in seconds
48
+ */
49
+ maxAge?: number;
50
+ /**
51
+ * Controls how the cookie behaves with cross-site requests
52
+ */
53
+ sameSite?: boolean | 'lax' | 'strict' | 'none';
54
+ /**
55
+ * When true, cookie will only be sent over HTTPS
56
+ */
57
+ secure?: boolean;
58
+ }
59
+ //# sourceMappingURL=cookies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/models/cookies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ declare const generateSessionId: () => string;
19
+ export default generateSessionId;
20
+ //# sourceMappingURL=generateSessionId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateSessionId.d.ts","sourceRoot":"","sources":["../../src/utils/generateSessionId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,QAAA,MAAM,iBAAiB,QAAO,MAAqF,CAAC;AAEpH,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { CookieOptions } from '../models/cookies';
19
+ /**
20
+ * Creates a complete set of cookie options by merging provided options with defaults
21
+ *
22
+ * @param options - Partial cookie options to override defaults
23
+ *
24
+ * @returns Complete cookie options with all required fields
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * // Use defaults with only maxAge override
29
+ * const options = getSessionCookieOptions({ maxAge: 3600 });
30
+ *
31
+ * // Override multiple defaults
32
+ * const options = getSessionCookieOptions({
33
+ * maxAge: 3600,
34
+ * secure: true,
35
+ * sameSite: 'strict'
36
+ * });
37
+ * ```
38
+ */
39
+ declare const getSessionCookieOptions: (options: Partial<CookieOptions>) => CookieOptions;
40
+ export default getSessionCookieOptions;
41
+ //# sourceMappingURL=getSessionCookieOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSessionCookieOptions.d.ts","sourceRoot":"","sources":["../../src/utils/getSessionCookieOptions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,uBAAuB,GAAI,SAAS,OAAO,CAAC,aAAa,CAAC,KAAG,aAMjE,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@thunderid/node",
3
+ "version": "0.0.1",
4
+ "description": "Node.js runtime SDK for ThunderID",
5
+ "keywords": [
6
+ "thunderid",
7
+ "node.js",
8
+ "node",
9
+ "server"
10
+ ],
11
+ "homepage": "https://github.com/thunder-id/thunderid/tree/main/sdks/node#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/thunder-id/thunderid/issues"
14
+ },
15
+ "author": "WSO2",
16
+ "license": "Apache-2.0",
17
+ "type": "module",
18
+ "main": "dist/cjs/index.cjs",
19
+ "module": "dist/index.js",
20
+ "exports": {
21
+ "import": "./dist/index.js",
22
+ "require": "./dist/cjs/index.cjs"
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "types": "dist/index.d.ts",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/asgardeo/javascript",
33
+ "directory": "sdks/node"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "24.7.2",
37
+ "eslint": "9.39.4",
38
+ "prettier": "3.6.2",
39
+ "rimraf": "6.1.3",
40
+ "rolldown": "1.0.0-beta.45",
41
+ "typescript": "5.9.3",
42
+ "vitest": "4.1.3",
43
+ "@thunderid/eslint-plugin": "^0.0.0",
44
+ "@thunderid/prettier-config": "^0.0.0"
45
+ },
46
+ "dependencies": {
47
+ "base64url": "3.0.1",
48
+ "cross-fetch": "4.1.0",
49
+ "fast-sha256": "1.3.0",
50
+ "jose": "5.2.0",
51
+ "memory-cache": "0.2.0",
52
+ "secure-random-bytes": "5.0.1",
53
+ "tslib": "2.8.1",
54
+ "uuid": "11.1.0",
55
+ "@thunderid/javascript": "^0.0.0"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public"
59
+ },
60
+ "scripts": {
61
+ "build": "pnpm clean && rolldown -c rolldown.config.js && tsc -p tsconfig.lib.json --emitDeclarationOnly --outDir dist",
62
+ "clean": "rimraf dist",
63
+ "format:check": "prettier --check --cache .",
64
+ "format:fix": "prettier --write --cache .",
65
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
66
+ "lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx,.cjs,.mjs",
67
+ "test": "vitest --passWithNoTests",
68
+ "typecheck": "tsc -p tsconfig.lib.json"
69
+ }
70
+ }