@clerk/electron 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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/dist/cjs/index.js +172 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/preload/index.js +39 -0
  6. package/dist/cjs/preload/index.js.map +1 -0
  7. package/dist/cjs/react/index.js +76 -0
  8. package/dist/cjs/react/index.js.map +1 -0
  9. package/dist/cjs/storage/index.js +133 -0
  10. package/dist/cjs/storage/index.js.map +1 -0
  11. package/dist/esm/chunk-WJNPPS7B.js +14 -0
  12. package/dist/esm/chunk-WJNPPS7B.js.map +1 -0
  13. package/dist/esm/index.js +157 -0
  14. package/dist/esm/index.js.map +1 -0
  15. package/dist/esm/preload/index.js +24 -0
  16. package/dist/esm/preload/index.js.map +1 -0
  17. package/dist/esm/react/index.js +68 -0
  18. package/dist/esm/react/index.js.map +1 -0
  19. package/dist/esm/storage/index.js +127 -0
  20. package/dist/esm/storage/index.js.map +1 -0
  21. package/dist/types/index.d.ts +3 -0
  22. package/dist/types/index.d.ts.map +1 -0
  23. package/dist/types/main/create-clerk-bridge.d.ts +10 -0
  24. package/dist/types/main/create-clerk-bridge.d.ts.map +1 -0
  25. package/dist/types/main/ipc-handlers.d.ts +3 -0
  26. package/dist/types/main/ipc-handlers.d.ts.map +1 -0
  27. package/dist/types/main/oauth-transport.d.ts +7 -0
  28. package/dist/types/main/oauth-transport.d.ts.map +1 -0
  29. package/dist/types/preload/index.d.ts +8 -0
  30. package/dist/types/preload/index.d.ts.map +1 -0
  31. package/dist/types/react/create-clerk-instance.d.ts +5 -0
  32. package/dist/types/react/create-clerk-instance.d.ts.map +1 -0
  33. package/dist/types/react/index.d.ts +12 -0
  34. package/dist/types/react/index.d.ts.map +1 -0
  35. package/dist/types/shared/ipc.d.ts +10 -0
  36. package/dist/types/shared/ipc.d.ts.map +1 -0
  37. package/dist/types/shared/types.d.ts +45 -0
  38. package/dist/types/shared/types.d.ts.map +1 -0
  39. package/dist/types/storage/index.d.ts +47 -0
  40. package/dist/types/storage/index.d.ts.map +1 -0
  41. package/package.json +121 -0
@@ -0,0 +1,47 @@
1
+ import type { TokenStorage } from '../shared/types';
2
+ type StorageOptions = {
3
+ /**
4
+ * The name of the file (without extension) used to persist tokens.
5
+ *
6
+ * @default 'clerk-tokens'
7
+ */
8
+ name?: string;
9
+ /**
10
+ * The directory in which the token file is stored. Maps to `electron-store`'s `cwd` option.
11
+ * When omitted, the OS default user config directory is used.
12
+ */
13
+ path?: string;
14
+ /**
15
+ * When OS-level encryption is unavailable (e.g. a Linux machine without a keyring), tokens are
16
+ * not persisted by default, which signs the user out on the next app launch. Set this to `true`
17
+ * to instead persist tokens **unencrypted** in that scenario, keeping the user signed in across
18
+ * restarts at the cost of storing tokens in plaintext on disk.
19
+ *
20
+ * @default false
21
+ */
22
+ unencryptedFallback?: boolean;
23
+ };
24
+ /**
25
+ * Creates a secure {@link TokenStorage} adapter for the Electron main process.
26
+ *
27
+ * Tokens are persisted with `electron-store` and encrypted at rest using Electron's
28
+ * {@link safeStorage} API, which is backed by the OS keystore (Keychain on macOS, DPAPI on
29
+ * Windows, libsecret/kwallet on Linux). It uses Electron 42's async `safeStorage` API only when it
30
+ * reports itself available (which generally requires a code-signed app) and otherwise falls back to
31
+ * the synchronous API. Pass the result to `createClerkBridge({ storage: storage() })`.
32
+ *
33
+ * Behavior is secure by default: when OS encryption is unavailable the adapter does not persist
34
+ * tokens (the user will be signed out on restart) unless {@link StorageOptions.unencryptedFallback}
35
+ * is enabled. Undecryptable entries return `null`.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { createClerkBridge } from '@clerk/electron';
40
+ * import { storage } from '@clerk/electron/storage';
41
+ *
42
+ * createClerkBridge({ storage: storage({ name: 'my-app-tokens' }) });
43
+ * ```
44
+ */
45
+ export declare function storage(options?: StorageOptions): TokenStorage;
46
+ export {};
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,KAAK,cAAc,GAAG;IACpB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AA6EF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,YAAY,CAwGlE"}
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@clerk/electron",
3
+ "version": "0.0.1",
4
+ "description": "Clerk SDK for Electron",
5
+ "keywords": [
6
+ "clerk",
7
+ "electron",
8
+ "auth",
9
+ "authentication",
10
+ "session",
11
+ "jwt",
12
+ "desktop"
13
+ ],
14
+ "homepage": "https://clerk.com/",
15
+ "bugs": {
16
+ "url": "https://github.com/clerk/javascript/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/clerk/javascript.git",
21
+ "directory": "packages/electron"
22
+ },
23
+ "license": "MIT",
24
+ "author": "Clerk",
25
+ "sideEffects": false,
26
+ "exports": {
27
+ ".": {
28
+ "import": {
29
+ "types": "./dist/types/index.d.ts",
30
+ "default": "./dist/esm/index.js"
31
+ },
32
+ "require": {
33
+ "types": "./dist/types/index.d.ts",
34
+ "default": "./dist/cjs/index.js"
35
+ }
36
+ },
37
+ "./preload": {
38
+ "import": {
39
+ "types": "./dist/types/preload/index.d.ts",
40
+ "default": "./dist/esm/preload/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/types/preload/index.d.ts",
44
+ "default": "./dist/cjs/preload/index.js"
45
+ }
46
+ },
47
+ "./storage": {
48
+ "import": {
49
+ "types": "./dist/types/storage/index.d.ts",
50
+ "default": "./dist/esm/storage/index.js"
51
+ },
52
+ "require": {
53
+ "types": "./dist/types/storage/index.d.ts",
54
+ "default": "./dist/cjs/storage/index.js"
55
+ }
56
+ },
57
+ "./react": {
58
+ "import": {
59
+ "types": "./dist/types/react/index.d.ts",
60
+ "default": "./dist/esm/react/index.js"
61
+ },
62
+ "require": {
63
+ "types": "./dist/types/react/index.d.ts",
64
+ "default": "./dist/cjs/react/index.js"
65
+ }
66
+ },
67
+ "./package.json": "./package.json"
68
+ },
69
+ "main": "./dist/cjs/index.js",
70
+ "module": "./dist/esm/index.js",
71
+ "types": "./dist/types/index.d.ts",
72
+ "files": [
73
+ "dist",
74
+ "preload"
75
+ ],
76
+ "dependencies": {
77
+ "tslib": "2.8.1",
78
+ "@clerk/clerk-js": "^6.16.1",
79
+ "@clerk/ui": "^1.16.1",
80
+ "@clerk/react": "^6.9.1"
81
+ },
82
+ "devDependencies": {
83
+ "@types/node": "^22.19.17",
84
+ "electron": "^39.2.6",
85
+ "electron-store": "^8.2.0"
86
+ },
87
+ "peerDependencies": {
88
+ "electron": ">=28",
89
+ "electron-store": "^8.2.0",
90
+ "react": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0",
91
+ "react-dom": "^18.0.0 || ~19.0.3 || ~19.1.4 || ~19.2.3 || ~19.3.0-0"
92
+ },
93
+ "peerDependenciesMeta": {
94
+ "electron-store": {
95
+ "optional": true
96
+ },
97
+ "react-dom": {
98
+ "optional": true
99
+ }
100
+ },
101
+ "engines": {
102
+ "node": ">=20.9.0"
103
+ },
104
+ "publishConfig": {
105
+ "access": "public"
106
+ },
107
+ "scripts": {
108
+ "build": "tsup",
109
+ "build:declarations": "tsc -p tsconfig.declarations.json",
110
+ "clean": "rimraf ./dist",
111
+ "dev": "tsup --watch",
112
+ "format": "node ../../scripts/format-package.mjs",
113
+ "format:check": "node ../../scripts/format-package.mjs --check",
114
+ "lint": "eslint src",
115
+ "lint:attw": "attw --pack . --profile node16 --ignore-rules unexpected-module-syntax",
116
+ "lint:publint": "publint",
117
+ "test": "vitest run",
118
+ "test:ci": "vitest run --maxWorkers=70%",
119
+ "test:watch": "vitest"
120
+ }
121
+ }