@geekmidas/auth 9.0.2 → 10.0.0-alpha.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 (101) hide show
  1. package/dist/cacheTokenStorage-B7sOoysu.d.cts.map +1 -1
  2. package/dist/{cacheTokenStorage-_tq4Kmhc.d.mts → cacheTokenStorage-DaqxdNxI.d.mts} +1 -1
  3. package/dist/cacheTokenStorage-DaqxdNxI.d.mts.map +1 -0
  4. package/dist/cacheTokenStorage.d.mts +1 -1
  5. package/dist/client.d.mts +1 -1
  6. package/dist/cookies-Bc6gUjb6.cjs +30 -0
  7. package/dist/cookies-Bc6gUjb6.cjs.map +1 -0
  8. package/dist/cookies-C80f8JtE.mjs +24 -0
  9. package/dist/cookies-C80f8JtE.mjs.map +1 -0
  10. package/dist/cookies.cjs +3 -0
  11. package/dist/cookies.d.cts +14 -0
  12. package/dist/cookies.d.cts.map +1 -0
  13. package/dist/cookies.d.mts +14 -0
  14. package/dist/cookies.d.mts.map +1 -0
  15. package/dist/cookies.mjs +3 -0
  16. package/dist/hono/jwt.cjs +4 -7
  17. package/dist/hono/jwt.cjs.map +1 -1
  18. package/dist/hono/jwt.d.cts.map +1 -1
  19. package/dist/hono/jwt.d.mts +1 -1
  20. package/dist/hono/jwt.d.mts.map +1 -1
  21. package/dist/hono/jwt.mjs +5 -7
  22. package/dist/hono/jwt.mjs.map +1 -1
  23. package/dist/hono/oidc.cjs +4 -7
  24. package/dist/hono/oidc.cjs.map +1 -1
  25. package/dist/hono/oidc.d.cts.map +1 -1
  26. package/dist/hono/oidc.d.mts +2 -2
  27. package/dist/hono/oidc.d.mts.map +1 -1
  28. package/dist/hono/oidc.mjs +5 -7
  29. package/dist/hono/oidc.mjs.map +1 -1
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.mts +2 -2
  32. package/dist/index.mjs +1 -1
  33. package/dist/{jwt-D88cPJyT.mjs → jwt-bZR2_t8F.mjs} +1 -1
  34. package/dist/{jwt-D88cPJyT.mjs.map → jwt-bZR2_t8F.mjs.map} +1 -1
  35. package/dist/{jwt-Bo_eACEi.cjs → jwt-clq6I6vG.cjs} +1 -1
  36. package/dist/{jwt-Bo_eACEi.cjs.map → jwt-clq6I6vG.cjs.map} +1 -1
  37. package/dist/{jwt-BqLlRkw-.d.mts → jwt-kejix7rd.d.mts} +1 -1
  38. package/dist/{jwt-BqLlRkw-.d.mts.map → jwt-kejix7rd.d.mts.map} +1 -1
  39. package/dist/jwt.cjs +1 -1
  40. package/dist/jwt.d.mts +1 -1
  41. package/dist/jwt.mjs +1 -1
  42. package/dist/lambda/jwt.cjs +4 -5
  43. package/dist/lambda/jwt.cjs.map +1 -1
  44. package/dist/lambda/jwt.d.cts.map +1 -1
  45. package/dist/lambda/jwt.d.mts +1 -1
  46. package/dist/lambda/jwt.d.mts.map +1 -1
  47. package/dist/lambda/jwt.mjs +5 -5
  48. package/dist/lambda/jwt.mjs.map +1 -1
  49. package/dist/lambda/oidc.cjs +4 -5
  50. package/dist/lambda/oidc.cjs.map +1 -1
  51. package/dist/lambda/oidc.d.cts.map +1 -1
  52. package/dist/lambda/oidc.d.mts +2 -2
  53. package/dist/lambda/oidc.d.mts.map +1 -1
  54. package/dist/lambda/oidc.mjs +5 -5
  55. package/dist/lambda/oidc.mjs.map +1 -1
  56. package/dist/{oidc-KA30gMlx.mjs → oidc-BYHREHir.mjs} +1 -1
  57. package/dist/{oidc-KA30gMlx.mjs.map → oidc-BYHREHir.mjs.map} +1 -1
  58. package/dist/{oidc-DTRgBBl6.d.mts → oidc-Ca7GYwmM.d.mts} +2 -2
  59. package/dist/{oidc-DTRgBBl6.d.mts.map → oidc-Ca7GYwmM.d.mts.map} +1 -1
  60. package/dist/{oidc-C0KyYaAK.cjs → oidc-jdMfVyyC.cjs} +1 -1
  61. package/dist/{oidc-C0KyYaAK.cjs.map → oidc-jdMfVyyC.cjs.map} +1 -1
  62. package/dist/oidc.cjs +1 -1
  63. package/dist/oidc.d.mts +2 -2
  64. package/dist/oidc.mjs +1 -1
  65. package/dist/server.cjs +1 -1
  66. package/dist/server.d.mts +2 -2
  67. package/dist/server.mjs +1 -1
  68. package/dist/{tokenManager-Ci2Tgxp8.mjs → tokenManager-BbylTW7F.mjs} +1 -1
  69. package/dist/{tokenManager-Ci2Tgxp8.mjs.map → tokenManager-BbylTW7F.mjs.map} +1 -1
  70. package/dist/{tokenManager-RrwjL0y-.d.mts → tokenManager-CosB7J0i.d.mts} +1 -1
  71. package/dist/{tokenManager-RrwjL0y-.d.mts.map → tokenManager-CosB7J0i.d.mts.map} +1 -1
  72. package/dist/{tokenManager-CvEMgxOp.cjs → tokenManager-PQ-OI_NU.cjs} +1 -1
  73. package/dist/{tokenManager-CvEMgxOp.cjs.map → tokenManager-PQ-OI_NU.cjs.map} +1 -1
  74. package/dist/tokenManager.cjs +1 -1
  75. package/dist/tokenManager.d.mts +1 -1
  76. package/dist/tokenManager.mjs +1 -1
  77. package/package.json +6 -3
  78. package/CHANGELOG.md +0 -60
  79. package/dist/cacheTokenStorage-_tq4Kmhc.d.mts.map +0 -1
  80. package/src/__tests__/cacheTokenStorage.spec.ts +0 -213
  81. package/src/__tests__/client.spec.ts +0 -465
  82. package/src/__tests__/hono-jwt.spec.ts +0 -232
  83. package/src/__tests__/hono-oidc.spec.ts +0 -605
  84. package/src/__tests__/jwt.spec.ts +0 -197
  85. package/src/__tests__/lambda-jwt.spec.ts +0 -278
  86. package/src/__tests__/lambda-oidc.spec.ts +0 -624
  87. package/src/__tests__/oidc.spec.ts +0 -405
  88. package/src/__tests__/tokenManager.spec.ts +0 -259
  89. package/src/cacheTokenStorage.ts +0 -43
  90. package/src/client.ts +0 -220
  91. package/src/hono/jwt.ts +0 -142
  92. package/src/hono/oidc.ts +0 -170
  93. package/src/index.ts +0 -3
  94. package/src/jwt.ts +0 -106
  95. package/src/lambda/jwt.ts +0 -210
  96. package/src/lambda/oidc.ts +0 -203
  97. package/src/oidc.ts +0 -156
  98. package/src/server.ts +0 -8
  99. package/src/tokenManager.ts +0 -106
  100. package/tsconfig.json +0 -10
  101. package/tsdown.config.ts +0 -3
package/CHANGELOG.md DELETED
@@ -1,60 +0,0 @@
1
- # @geekmidas/auth
2
-
3
- ## 9.0.2
4
-
5
- ### Patch Changes
6
-
7
- - [#12](https://github.com/geekmidas/toolbox/pull/12) [`d53863a`](https://github.com/geekmidas/toolbox/commit/d53863a84db2e4ab5420e08f79128b637043fc42) Thanks [@geekmidas](https://github.com/geekmidas)! - Align every published package on a single version and keep them in step.
8
-
9
- All packages now share one version, enforced by a changesets `fixed` group. The
10
- baseline is 9.0.1 — @geekmidas/client's published version — so nothing moves
11
- backwards; this release takes the whole set to 9.0.2 together.
12
-
13
- Independent versions made "which version of the docs applies to me"
14
- unanswerable: a reader on constructs@7 and cli@2 was on no version at all. One
15
- number per release makes versioned documentation possible, and lets 9 freeze as
16
- the current paradigm while the constructs rework is developed against it.
17
-
18
- Every release now publishes every package, and a major anywhere is a major
19
- everywhere. Peer ranges get simpler in return.
20
-
21
- - Updated dependencies [[`d53863a`](https://github.com/geekmidas/toolbox/commit/d53863a84db2e4ab5420e08f79128b637043fc42)]:
22
- - @geekmidas/cache@9.0.2
23
-
24
- ## 2.0.2
25
-
26
- ### Patch Changes
27
-
28
- - 🐛 [#11](https://github.com/geekmidas/toolbox/pull/11) [`40f4dc0`](https://github.com/geekmidas/toolbox/commit/40f4dc095911b2223a255029d8f776caf7781309) Thanks [@geekmidas](https://github.com/geekmidas)! - Patch release across all packages to realign published versions with the
29
- registry. The previous release only published the four packages that had
30
- version bumps; the remaining packages failed with "cannot publish over the
31
- previously published versions" because their versions were unchanged.
32
- - Updated dependencies [[`40f4dc0`](https://github.com/geekmidas/toolbox/commit/40f4dc095911b2223a255029d8f776caf7781309)]:
33
- - @geekmidas/cache@1.1.2
34
-
35
- ## 2.0.1
36
-
37
- ### Patch Changes
38
-
39
- - 🐛 [`d70c6c0`](https://github.com/geekmidas/toolbox/commit/d70c6c0aeb8a79da2473ac77dbd8255a4a2f5651) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix `package.json` exports so TypeScript declarations resolve correctly under NodeNext/Bundler module resolution. Each subpath export now nests `types` inside its `import`/`require` condition, pointing at the `.d.mts` and `.d.cts` files that `tsdown` actually emits (previously the exports referenced non-existent `.d.ts` files, causing type-resolution failures for consumers). Both ESM (`.mjs`) and CJS (`.cjs`) runtime entry points are preserved. Additionally, `@geekmidas/ui` had `import` paths pointing at `.js` files that were never emitted — those are corrected to `.mjs`.
40
-
41
- - Updated dependencies [[`d70c6c0`](https://github.com/geekmidas/toolbox/commit/d70c6c0aeb8a79da2473ac77dbd8255a4a2f5651)]:
42
- - @geekmidas/cache@1.1.1
43
-
44
- ## 2.0.0
45
-
46
- ### Patch Changes
47
-
48
- - Updated dependencies [[`be4f7a9`](https://github.com/geekmidas/toolbox/commit/be4f7a9bd5de7f08adbca582916d6902e0c24de2)]:
49
- - @geekmidas/cache@1.1.0
50
-
51
- ## 1.0.0
52
-
53
- ### Major Changes
54
-
55
- - [`ff7b115`](https://github.com/geekmidas/toolbox/commit/ff7b11599f60f84ac6cdc73714c853ecf786b2e8) Thanks [@geekmidas](https://github.com/geekmidas)! - Version 1 Stable release
56
-
57
- ### Patch Changes
58
-
59
- - Updated dependencies [[`ff7b115`](https://github.com/geekmidas/toolbox/commit/ff7b11599f60f84ac6cdc73714c853ecf786b2e8)]:
60
- - @geekmidas/cache@1.0.0
@@ -1 +0,0 @@
1
- {"version":3,"file":"cacheTokenStorage-_tq4Kmhc.d.mts","names":[],"sources":["../src/client.ts","../src/cacheTokenStorage.ts"],"sourcesContent":[],"mappings":";;;UAAiB,YAAA;oBACE;+CAC2B;EAF7B,eAAY,EAAA,EAGT,OAHS,CAAA,MAAA,GAAA,IAAA,CAAA,GAAA,MAAA,GAAA,IAAA;EAAA,eAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,CAAA,EAAA,MAAA,CAAA,EAIkB,OAJlB,CAA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AAA,CAAA,EDyFpB,kBCzFoB;EAAY,cAAA,CAAA,CAAA,EDgG7B,OChG6B,CAAA,MAAA,GAAA,IAAA,CAAA;qBDoG5B;kGAStB;iBAOkB;;qCAiBc;mBAYZ;yBA0CM;uBAkBF,QAAQ;4BAKH,QAAQ;;;;cClN5B,iBAAA,YAA6B;EDHzB,QAAA,KAAA;EAAY,QAAA,cAAA;EAAA,QACV,eAAA;EAAO,WACoB,CAAA,KAAA,ECOrC,KDPqC,EAAA,cAAA,CAAA,EAAA,MAAA,EAAA,eAAA,CAAA,EAAA,MAAA;EAAO,cACjC,CAAA,CAAA,ECeK,ODfL,CAAA,MAAA,GAAA,IAAA,CAAA;EAAO,cACoB,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,CAAA,EAAA,MAAA,CAAA,ECmBK,ODnBL,CAAA,IAAA,CAAA;EAAO,eACtC,CAAA,CAAA,ECsBU,ODtBV,CAAA,MAAA,GAAA,IAAA,CAAA;EAAO,eAAA,CAAA,KAAA,EAAA,MAAA,EAAA,GAAA,CAAA,EAAA,MAAA,CAAA,EC2B8B,OD3B9B,CAAA,IAAA,CAAA;EAGV,WAAA,CAAA,CAAA,EC4BS,OD5BT,CAAA,IAAyB,CAAA;AAuCtC;AA0BA"}
@@ -1,213 +0,0 @@
1
- import type { Cache } from '@geekmidas/cache';
2
- import { InMemoryCache } from '@geekmidas/cache/memory';
3
- import { beforeEach, describe, expect, it } from 'vitest';
4
- import { CacheTokenStorage } from '../cacheTokenStorage.ts';
5
-
6
- describe('CacheTokenStorage', () => {
7
- let storage: CacheTokenStorage;
8
- let cache: Cache<string>;
9
-
10
- beforeEach(() => {
11
- cache = new InMemoryCache<string>();
12
- storage = new CacheTokenStorage(cache);
13
- });
14
-
15
- describe('access token operations', () => {
16
- it('should store and retrieve access token', async () => {
17
- await storage.setAccessToken('test-access-token');
18
-
19
- const token = await storage.getAccessToken();
20
-
21
- expect(token).toBe('test-access-token');
22
- });
23
-
24
- it('should return null when no access token exists', async () => {
25
- const token = await storage.getAccessToken();
26
-
27
- expect(token).toBeNull();
28
- });
29
-
30
- it('should store access token with TTL', async () => {
31
- await storage.setAccessToken('test-access-token', 3600);
32
-
33
- const token = await storage.getAccessToken();
34
-
35
- expect(token).toBe('test-access-token');
36
- });
37
-
38
- it('should overwrite existing access token', async () => {
39
- await storage.setAccessToken('first-token');
40
- await storage.setAccessToken('second-token');
41
-
42
- const token = await storage.getAccessToken();
43
-
44
- expect(token).toBe('second-token');
45
- });
46
- });
47
-
48
- describe('refresh token operations', () => {
49
- it('should store and retrieve refresh token', async () => {
50
- await storage.setRefreshToken('test-refresh-token');
51
-
52
- const token = await storage.getRefreshToken();
53
-
54
- expect(token).toBe('test-refresh-token');
55
- });
56
-
57
- it('should return null when no refresh token exists', async () => {
58
- const token = await storage.getRefreshToken();
59
-
60
- expect(token).toBeNull();
61
- });
62
-
63
- it('should store refresh token with TTL', async () => {
64
- await storage.setRefreshToken('test-refresh-token', 7200);
65
-
66
- const token = await storage.getRefreshToken();
67
-
68
- expect(token).toBe('test-refresh-token');
69
- });
70
-
71
- it('should overwrite existing refresh token', async () => {
72
- await storage.setRefreshToken('first-refresh-token');
73
- await storage.setRefreshToken('second-refresh-token');
74
-
75
- const token = await storage.getRefreshToken();
76
-
77
- expect(token).toBe('second-refresh-token');
78
- });
79
- });
80
-
81
- describe('token lifecycle', () => {
82
- it('should store both tokens independently', async () => {
83
- await storage.setAccessToken('access-token');
84
- await storage.setRefreshToken('refresh-token');
85
-
86
- const accessToken = await storage.getAccessToken();
87
- const refreshToken = await storage.getRefreshToken();
88
-
89
- expect(accessToken).toBe('access-token');
90
- expect(refreshToken).toBe('refresh-token');
91
- });
92
-
93
- it('should clear both tokens', async () => {
94
- await storage.setAccessToken('access-token');
95
- await storage.setRefreshToken('refresh-token');
96
-
97
- await storage.clearTokens();
98
-
99
- const accessToken = await storage.getAccessToken();
100
- const refreshToken = await storage.getRefreshToken();
101
-
102
- expect(accessToken).toBeNull();
103
- expect(refreshToken).toBeNull();
104
- });
105
-
106
- it('should clear tokens when some are missing', async () => {
107
- await storage.setAccessToken('access-token');
108
-
109
- await storage.clearTokens();
110
-
111
- const accessToken = await storage.getAccessToken();
112
- const refreshToken = await storage.getRefreshToken();
113
-
114
- expect(accessToken).toBeNull();
115
- expect(refreshToken).toBeNull();
116
- });
117
- });
118
-
119
- describe('custom storage keys', () => {
120
- it('should use custom keys for token storage', async () => {
121
- const customStorage = new CacheTokenStorage(
122
- cache,
123
- 'custom_access_key',
124
- 'custom_refresh_key',
125
- );
126
-
127
- await customStorage.setAccessToken('access-token');
128
- await customStorage.setRefreshToken('refresh-token');
129
-
130
- const accessToken = await customStorage.getAccessToken();
131
- const refreshToken = await customStorage.getRefreshToken();
132
-
133
- expect(accessToken).toBe('access-token');
134
- expect(refreshToken).toBe('refresh-token');
135
- });
136
-
137
- it('should isolate tokens between different storage instances', async () => {
138
- const defaultStorage = new CacheTokenStorage(cache);
139
- const customStorage = new CacheTokenStorage(
140
- cache,
141
- 'custom_access',
142
- 'custom_refresh',
143
- );
144
-
145
- await defaultStorage.setAccessToken('default-access');
146
- await customStorage.setAccessToken('custom-access');
147
-
148
- const defaultToken = await defaultStorage.getAccessToken();
149
- const customToken = await customStorage.getAccessToken();
150
-
151
- expect(defaultToken).toBe('default-access');
152
- expect(customToken).toBe('custom-access');
153
- });
154
-
155
- it('should clear tokens independently with custom keys', async () => {
156
- const defaultStorage = new CacheTokenStorage(cache);
157
- const customStorage = new CacheTokenStorage(
158
- cache,
159
- 'custom_access',
160
- 'custom_refresh',
161
- );
162
-
163
- await defaultStorage.setAccessToken('default-access');
164
- await customStorage.setAccessToken('custom-access');
165
-
166
- await defaultStorage.clearTokens();
167
-
168
- const defaultToken = await defaultStorage.getAccessToken();
169
- const customToken = await customStorage.getAccessToken();
170
-
171
- expect(defaultToken).toBeNull();
172
- expect(customToken).toBe('custom-access');
173
- });
174
- });
175
-
176
- describe('integration with real cache', () => {
177
- it('should work with multiple cache instances', async () => {
178
- const cache1 = new InMemoryCache<string>();
179
- const cache2 = new InMemoryCache<string>();
180
-
181
- const storage1 = new CacheTokenStorage(cache1);
182
- const storage2 = new CacheTokenStorage(cache2);
183
-
184
- await storage1.setAccessToken('token-1');
185
- await storage2.setAccessToken('token-2');
186
-
187
- const token1 = await storage1.getAccessToken();
188
- const token2 = await storage2.getAccessToken();
189
-
190
- expect(token1).toBe('token-1');
191
- expect(token2).toBe('token-2');
192
- });
193
-
194
- it('should maintain token state across operations', async () => {
195
- await storage.setAccessToken('initial-access');
196
- await storage.setRefreshToken('initial-refresh');
197
-
198
- let accessToken = await storage.getAccessToken();
199
- let refreshToken = await storage.getRefreshToken();
200
-
201
- expect(accessToken).toBe('initial-access');
202
- expect(refreshToken).toBe('initial-refresh');
203
-
204
- await storage.setAccessToken('updated-access');
205
-
206
- accessToken = await storage.getAccessToken();
207
- refreshToken = await storage.getRefreshToken();
208
-
209
- expect(accessToken).toBe('updated-access');
210
- expect(refreshToken).toBe('initial-refresh');
211
- });
212
- });
213
- });