@molecule/app-auth 1.1.2 → 1.2.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.
package/LICENSE CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  Apache License
2
3
  Version 2.0, January 2004
3
4
  http://www.apache.org/licenses/
@@ -34,21 +35,33 @@
34
35
 
35
36
  "Work" shall mean the work of authorship, whether in Source or
36
37
  Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work.
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
38
40
 
39
41
  "Derivative Works" shall mean any work, whether in Source or Object
40
42
  form, that is based on (or derived from) the Work and for which the
41
43
  editorial revisions, annotations, elaborations, or other modifications
42
- represent, as a whole, an original work of authorship.
43
-
44
- "Contribution" shall mean any work of authorship, including the
45
- original version of the Work and any modifications or additions
46
- to that Work, that is intentionally submitted to the Licensor for
47
- inclusion in the Work by the copyright owner or by an individual or
48
- Legal Entity authorized to submit on behalf of the copyright owner.
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
49
62
 
50
63
  "Contributor" shall mean Licensor and any individual or Legal Entity
51
- on behalf of whom a Contribution has been received by the Licensor and
64
+ on behalf of whom a Contribution has been received by Licensor and
52
65
  subsequently incorporated within the Work.
53
66
 
54
67
  2. Grant of Copyright License. Subject to the terms and conditions of
@@ -61,8 +74,18 @@
61
74
  3. Grant of Patent License. Subject to the terms and conditions of
62
75
  this License, each Contributor hereby grants to You a perpetual,
63
76
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
- patent license to make, have made, use, offer to sell, sell, import,
65
- and otherwise transfer the Work.
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
66
89
 
67
90
  4. Redistribution. You may reproduce and distribute copies of the
68
91
  Work or Derivative Works thereof in any medium, with or without
@@ -84,23 +107,87 @@
84
107
  (d) If the Work includes a "NOTICE" text file as part of its
85
108
  distribution, then any Derivative Works that You distribute must
86
109
  include a readable copy of the attribution notices contained
87
- within such NOTICE file.
88
-
89
- 5. Submission of Contributions.
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
90
138
 
91
139
  6. Trademarks. This License does not grant permission to use the trade
92
- names, trademarks, service marks, or product names of the Licensor.
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
93
143
 
94
144
  7. Disclaimer of Warranty. Unless required by applicable law or
95
- agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
-
98
- 8. Limitation of Liability. In no event and under no legal theory shall
99
- any Contributor be liable to You for damages.
100
-
101
- 9. Accepting Warranty or Additional Liability.
102
-
103
- Copyright 2026 Molecule Dev, Inc.
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
104
191
 
105
192
  Licensed under the Apache License, Version 2.0 (the "License");
106
193
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-08-14T16:52:48.579Z
6
+ Generated: 2026-10-16T00:48:55.816Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-auth
@@ -50,6 +50,203 @@ npm install @molecule/app-auth @molecule/app-bond @molecule/app-i18n @molecule/a
50
50
 
51
51
  ### Interfaces
52
52
 
53
+ #### `UserProfile`
54
+
55
+ User profile information.
56
+
57
+ ```typescript
58
+ interface UserProfile {
59
+ /**
60
+ * Unique user identifier.
61
+ */
62
+ id: string
63
+
64
+ /**
65
+ * User's email address.
66
+ */
67
+ email?: string
68
+
69
+ /**
70
+ * User's display name.
71
+ */
72
+ name?: string
73
+
74
+ /**
75
+ * User's avatar/profile image URL.
76
+ */
77
+ avatar?: string
78
+
79
+ /**
80
+ * User's roles or permissions.
81
+ */
82
+ roles?: string[]
83
+
84
+ /**
85
+ * Additional metadata.
86
+ */
87
+ metadata?: Record<string, unknown>
88
+ }
89
+ ```
90
+
91
+ #### `LoginCredentials`
92
+
93
+ Email/password login credentials with optional "remember me" flag.
94
+
95
+ ```typescript
96
+ interface LoginCredentials {
97
+ /**
98
+ * Email or username.
99
+ */
100
+ email: string
101
+
102
+ /**
103
+ * Password.
104
+ */
105
+ password: string
106
+
107
+ /**
108
+ * Whether to remember the session.
109
+ */
110
+ remember?: boolean
111
+
112
+ /**
113
+ * Time-based one-time password (TOTP) from the user's authenticator app.
114
+ * Required when the account has two-factor auth enabled — the server
115
+ * answers `{ twoFactorRequired: true }` (HTTP 206) until a valid token
116
+ * is supplied.
117
+ */
118
+ twoFactorToken?: string
119
+ }
120
+ ```
121
+
122
+ #### `RegisterData`
123
+
124
+ New user registration payload (email, password, optional name and metadata).
125
+
126
+ ```typescript
127
+ interface RegisterData {
128
+ /**
129
+ * Email address.
130
+ */
131
+ email: string
132
+
133
+ /**
134
+ * Password.
135
+ */
136
+ password: string
137
+
138
+ /**
139
+ * Display name.
140
+ */
141
+ name?: string
142
+
143
+ /**
144
+ * Additional registration fields.
145
+ */
146
+ metadata?: Record<string, unknown>
147
+ }
148
+ ```
149
+
150
+ #### `AuthResult`
151
+
152
+ Successful authentication result containing the user, access/refresh tokens, and expiration.
153
+
154
+ ```typescript
155
+ interface AuthResult<T = UserProfile> {
156
+ /**
157
+ * Authenticated user.
158
+ */
159
+ user: T
160
+
161
+ /**
162
+ * Access token (for token-based auth).
163
+ */
164
+ accessToken?: string
165
+
166
+ /**
167
+ * Refresh token (for token-based auth).
168
+ */
169
+ refreshToken?: string
170
+
171
+ /**
172
+ * Token expiration time (Unix timestamp).
173
+ */
174
+ expiresAt?: number
175
+
176
+ /**
177
+ * Set (with HTTP 206) when the account has two-factor auth enabled and the
178
+ * login did not include a valid `twoFactorToken`. No tokens or user are
179
+ * issued until login is retried with the TOTP — callers must check this
180
+ * flag BEFORE treating the result as a successful authentication.
181
+ */
182
+ twoFactorRequired?: boolean
183
+ }
184
+ ```
185
+
186
+ #### `PasswordResetRequest`
187
+
188
+ Password reset request data.
189
+
190
+ ```typescript
191
+ interface PasswordResetRequest {
192
+ /**
193
+ * Email address.
194
+ */
195
+ email: string
196
+ }
197
+ ```
198
+
199
+ #### `PasswordResetConfirm`
200
+
201
+ Password reset confirmation data.
202
+
203
+ ```typescript
204
+ interface PasswordResetConfirm {
205
+ /**
206
+ * Reset token.
207
+ */
208
+ token: string
209
+
210
+ /**
211
+ * New password.
212
+ */
213
+ password: string
214
+ }
215
+ ```
216
+
217
+ #### `AuthState`
218
+
219
+ Reactive authentication state snapshot (initialized, authenticated, user, loading, and error).
220
+
221
+ ```typescript
222
+ interface AuthState<T = UserProfile> {
223
+ /**
224
+ * Whether auth state has been initialized.
225
+ */
226
+ initialized: boolean
227
+
228
+ /**
229
+ * Whether the user is authenticated.
230
+ */
231
+ authenticated: boolean
232
+
233
+ /**
234
+ * Current user (if authenticated).
235
+ */
236
+ user: T | null
237
+
238
+ /**
239
+ * Whether an auth operation is in progress.
240
+ */
241
+ loading: boolean
242
+
243
+ /**
244
+ * Last auth error (if any).
245
+ */
246
+ error: string | null
247
+ }
248
+ ```
249
+
53
250
  #### `AuthClient`
54
251
 
55
252
  Auth client interface that all auth bond packages must implement.
@@ -172,6 +369,19 @@ interface AuthClient<T = UserProfile> {
172
369
  }
173
370
  ```
174
371
 
372
+ #### `StorageAdapter`
373
+
374
+ Minimal key-value storage adapter used by the auth client for
375
+ persisting tokens and user data.
376
+
377
+ ```typescript
378
+ interface StorageAdapter {
379
+ getItem(key: string): string | null
380
+ setItem(key: string, value: string): void
381
+ removeItem(key: string): void
382
+ }
383
+ ```
384
+
175
385
  #### `AuthClientConfig`
176
386
 
177
387
  Configuration options for creating an auth client, including API
@@ -223,6 +433,32 @@ interface AuthClientConfig {
223
433
  */
224
434
  storagePrefix?: string
225
435
 
436
+ /**
437
+ * Scheme of the `Authorization` header the access token is sent with:
438
+ * `Bearer` (default), or e.g. `Token` for an API that reads
439
+ * `Authorization: Token <jwt>`.
440
+ */
441
+ authScheme?: string
442
+
443
+ /**
444
+ * Shape the login/register request body for an API that expects another
445
+ * envelope (default: the credentials as given). RealWorld, for example:
446
+ * `(kind, payload) => ({ user: payload })`.
447
+ * @param kind - Which request.
448
+ * @param payload - The credentials or registration data.
449
+ * @returns The JSON body to send.
450
+ */
451
+ requestBody?: (kind: 'login' | 'register', payload: Record<string, unknown>) => unknown
452
+
453
+ /**
454
+ * Turn the API's login/register answer into the client's
455
+ * `{ accessToken, refreshToken?, user }` (default: the answer as given).
456
+ * RealWorld, for example: `(data) => ({ accessToken: data.user.token, user: data.user })`.
457
+ * @param data - The parsed response body.
458
+ * @returns The auth result.
459
+ */
460
+ mapAuthResponse?: (data: unknown) => AuthResult<UserProfile>
461
+
226
462
  /**
227
463
  * Token storage type or custom storage adapter.
228
464
  * - 'memory': In-memory storage (lost on page refresh)
@@ -297,272 +533,93 @@ interface AuthClientConfig {
297
533
  }
298
534
  ````
299
535
 
300
- #### `AuthResult`
536
+ #### `TokenStorage`
301
537
 
302
- Successful authentication result containing the user, access/refresh tokens, and expiration.
538
+ Internal token storage interface for reading and writing access/refresh
539
+ tokens and user profile data.
303
540
 
304
541
  ```typescript
305
- interface AuthResult<T = UserProfile> {
306
- /**
307
- * Authenticated user.
308
- */
309
- user: T
542
+ interface TokenStorage {
543
+ getAccessToken(): string | null
544
+ setAccessToken(token: string | null): void
545
+ getRefreshToken(): string | null
546
+ setRefreshToken(token: string | null): void
547
+ getUser<T = UserProfile>(): T | null
548
+ setUser<T = UserProfile>(user: T | null): void
549
+ clear(): void
550
+ }
551
+ ```
310
552
 
311
- /**
312
- * Access token (for token-based auth).
313
- */
314
- accessToken?: string
553
+ ### Types
315
554
 
316
- /**
317
- * Refresh token (for token-based auth).
318
- */
319
- refreshToken?: string
555
+ #### `AuthEvent`
320
556
 
321
- /**
322
- * Token expiration time (Unix timestamp).
323
- */
324
- expiresAt?: number
325
-
326
- /**
327
- * Set (with HTTP 206) when the account has two-factor auth enabled and the
328
- * login did not include a valid `twoFactorToken`. No tokens or user are
329
- * issued until login is retried with the TOTP — callers must check this
330
- * flag BEFORE treating the result as a successful authentication.
331
- */
332
- twoFactorRequired?: boolean
333
- }
334
- ```
335
-
336
- #### `AuthState`
337
-
338
- Reactive authentication state snapshot (initialized, authenticated, user, loading, and error).
557
+ Auth event types.
339
558
 
340
559
  ```typescript
341
- interface AuthState<T = UserProfile> {
342
- /**
343
- * Whether auth state has been initialized.
344
- */
345
- initialized: boolean
346
-
347
- /**
348
- * Whether the user is authenticated.
349
- */
350
- authenticated: boolean
351
-
352
- /**
353
- * Current user (if authenticated).
354
- */
355
- user: T | null
356
-
357
- /**
358
- * Whether an auth operation is in progress.
359
- */
360
- loading: boolean
361
-
362
- /**
363
- * Last auth error (if any).
364
- */
365
- error: string | null
366
- }
367
- ```
368
-
369
- #### `LoginCredentials`
370
-
371
- Email/password login credentials with optional "remember me" flag.
372
-
373
- ```typescript
374
- interface LoginCredentials {
375
- /**
376
- * Email or username.
377
- */
378
- email: string
379
-
380
- /**
381
- * Password.
382
- */
383
- password: string
384
-
385
- /**
386
- * Whether to remember the session.
387
- */
388
- remember?: boolean
389
-
390
- /**
391
- * Time-based one-time password (TOTP) from the user's authenticator app.
392
- * Required when the account has two-factor auth enabled — the server
393
- * answers `{ twoFactorRequired: true }` (HTTP 206) until a valid token
394
- * is supplied.
395
- */
396
- twoFactorToken?: string
397
- }
398
- ```
399
-
400
- #### `PasswordResetConfirm`
401
-
402
- Password reset confirmation data.
403
-
404
- ```typescript
405
- interface PasswordResetConfirm {
406
- /**
407
- * Reset token.
408
- */
409
- token: string
410
-
411
- /**
412
- * New password.
413
- */
414
- password: string
415
- }
560
+ type AuthEvent =
561
+ | { type: 'login'; user: UserProfile }
562
+ | { type: 'logout' }
563
+ | { type: 'register'; user: UserProfile }
564
+ | { type: 'refresh' }
565
+ | { type: 'error'; error: string }
416
566
  ```
417
567
 
418
- #### `PasswordResetRequest`
568
+ #### `AuthEventListener`
419
569
 
420
- Password reset request data.
570
+ Callback invoked when an authentication event occurs (login, logout, etc.).
421
571
 
422
572
  ```typescript
423
- interface PasswordResetRequest {
424
- /**
425
- * Email address.
426
- */
427
- email: string
428
- }
573
+ type AuthEventListener = (event: AuthEvent) => void
429
574
  ```
430
575
 
431
- #### `RegisterData`
432
-
433
- New user registration payload (email, password, optional name and metadata).
434
-
435
- ```typescript
436
- interface RegisterData {
437
- /**
438
- * Email address.
439
- */
440
- email: string
441
-
442
- /**
443
- * Password.
444
- */
445
- password: string
446
-
447
- /**
448
- * Display name.
449
- */
450
- name?: string
576
+ ### Functions
451
577
 
452
- /**
453
- * Additional registration fields.
454
- */
455
- metadata?: Record<string, unknown>
456
- }
457
- ```
578
+ #### `createJWTAuthClient(config)`
458
579
 
459
- #### `StorageAdapter`
580
+ Creates a simple JWT-based auth client.
460
581
 
461
- Minimal key-value storage adapter used by the auth client for
462
- persisting tokens and user data.
582
+ This is a basic implementation that can be extended or replaced
583
+ with more sophisticated auth providers.
463
584
 
464
585
  ```typescript
465
- interface StorageAdapter {
466
- getItem(key: string): string | null
467
- setItem(key: string, value: string): void
468
- removeItem(key: string): void
469
- }
586
+ function createJWTAuthClient(config?: AuthClientConfig): AuthClient<T>
470
587
  ```
471
588
 
472
- #### `TokenStorage`
473
-
474
- Internal token storage interface for reading and writing access/refresh
475
- tokens and user profile data.
589
+ - `config` — Auth client configuration including endpoints, storage, and refresh settings.
476
590
 
477
- ```typescript
478
- interface TokenStorage {
479
- getAccessToken(): string | null
480
- setAccessToken(token: string | null): void
481
- getRefreshToken(): string | null
482
- setRefreshToken(token: string | null): void
483
- getUser<T = UserProfile>(): T | null
484
- setUser<T = UserProfile>(user: T | null): void
485
- clear(): void
486
- }
487
- ```
591
+ **Returns:** A fully configured `AuthClient` instance.
488
592
 
489
- #### `UserProfile`
593
+ #### `setClient(client)`
490
594
 
491
- User profile information.
595
+ Registers an auth client as the active singleton. Called by bond
596
+ packages during application startup.
492
597
 
493
598
  ```typescript
494
- interface UserProfile {
495
- /**
496
- * Unique user identifier.
497
- */
498
- id: string
499
-
500
- /**
501
- * User's email address.
502
- */
503
- email?: string
504
-
505
- /**
506
- * User's display name.
507
- */
508
- name?: string
509
-
510
- /**
511
- * User's avatar/profile image URL.
512
- */
513
- avatar?: string
514
-
515
- /**
516
- * User's roles or permissions.
517
- */
518
- roles?: string[]
519
-
520
- /**
521
- * Additional metadata.
522
- */
523
- metadata?: Record<string, unknown>
524
- }
599
+ function setClient(client: AuthClient<UserProfile>): void
525
600
  ```
526
601
 
527
- ### Types
528
-
529
- #### `AuthEvent`
530
-
531
- Auth event types.
532
-
533
- ```typescript
534
- type AuthEvent =
535
- | { type: 'login'; user: UserProfile }
536
- | { type: 'logout' }
537
- | { type: 'register'; user: UserProfile }
538
- | { type: 'refresh' }
539
- | { type: 'error'; error: string }
540
- ```
602
+ - `client` — The auth client implementation to bond.
541
603
 
542
- #### `AuthEventListener`
604
+ #### `getClient()`
543
605
 
544
- Callback invoked when an authentication event occurs (login, logout, etc.).
606
+ Retrieves the bonded auth client, throwing if none is configured.
545
607
 
546
608
  ```typescript
547
- type AuthEventListener = (event: AuthEvent) => void
609
+ function getClient(): AuthClient<T>
548
610
  ```
549
611
 
550
- ### Functions
551
-
552
- #### `createJWTAuthClient(config)`
612
+ **Returns:** The bonded auth client.
553
613
 
554
- Creates a simple JWT-based auth client.
614
+ #### `hasClient()`
555
615
 
556
- This is a basic implementation that can be extended or replaced
557
- with more sophisticated auth providers.
616
+ Checks whether an auth client is currently bonded.
558
617
 
559
618
  ```typescript
560
- function createJWTAuthClient(config?: AuthClientConfig): AuthClient<T>
619
+ function hasClient(): boolean
561
620
  ```
562
621
 
563
- - `config` — Auth client configuration including endpoints, storage, and refresh settings.
564
-
565
- **Returns:** A fully configured `AuthClient` instance.
622
+ **Returns:** `true` if an auth client is bonded.
566
623
 
567
624
  #### `createTokenStorage(storage, prefix)`
568
625
 
@@ -578,47 +635,43 @@ function createTokenStorage(storage?: 'memory' | StorageAdapter, prefix?: string
578
635
 
579
636
  **Returns:** A `TokenStorage` instance.
580
637
 
581
- #### `getClient()`
638
+ #### `parseJWT(token)`
582
639
 
583
- Retrieves the bonded auth client, throwing if none is configured.
640
+ Parses a JWT token payload without verification (base64-decodes
641
+ the payload segment).
584
642
 
585
643
  ```typescript
586
- function getClient(): AuthClient<T>
644
+ function parseJWT(token: string): T | null
587
645
  ```
588
646
 
589
- **Returns:** The bonded auth client.
647
+ - `token` — The raw JWT string (header.payload.signature).
590
648
 
591
- #### `getTokenExpiration(token)`
649
+ **Returns:** The decoded payload object, or `null` if parsing fails.
592
650
 
593
- Returns the expiration timestamp of a JWT token in milliseconds.
651
+ #### `isTokenExpired(token, bufferSeconds)`
652
+
653
+ Checks if a JWT token is expired (or will expire within the buffer window).
594
654
 
595
655
  ```typescript
596
- function getTokenExpiration(token: string): number | null
656
+ function isTokenExpired(token: string, bufferSeconds?: number): boolean
597
657
  ```
598
658
 
599
659
  - `token` — The raw JWT string.
660
+ - `bufferSeconds` — Seconds before actual expiry to consider the token expired (default: 0).
600
661
 
601
- **Returns:** The expiration time in ms since epoch, or `null` if the token has no `exp` claim.
662
+ **Returns:** `true` if the token is expired or lacks an `exp` claim.
602
663
 
603
- #### `getUser()`
664
+ #### `getTokenExpiration(token)`
604
665
 
605
- Returns the current user profile, or `null` if not authenticated.
666
+ Returns the expiration timestamp of a JWT token in milliseconds.
606
667
 
607
668
  ```typescript
608
- function getUser(): T | null
669
+ function getTokenExpiration(token: string): number | null
609
670
  ```
610
671
 
611
- **Returns:** The user profile, or `null` if not authenticated.
612
-
613
- #### `hasClient()`
614
-
615
- Checks whether an auth client is currently bonded.
616
-
617
- ```typescript
618
- function hasClient(): boolean
619
- ```
672
+ - `token` — The raw JWT string.
620
673
 
621
- **Returns:** `true` if an auth client is bonded.
674
+ **Returns:** The expiration time in ms since epoch, or `null` if the token has no `exp` claim.
622
675
 
623
676
  #### `isAuthenticated()`
624
677
 
@@ -630,18 +683,15 @@ function isAuthenticated(): boolean
630
683
 
631
684
  **Returns:** `true` if the user has an active session.
632
685
 
633
- #### `isTokenExpired(token, bufferSeconds)`
686
+ #### `getUser()`
634
687
 
635
- Checks if a JWT token is expired (or will expire within the buffer window).
688
+ Returns the current user profile, or `null` if not authenticated.
636
689
 
637
690
  ```typescript
638
- function isTokenExpired(token: string, bufferSeconds?: number): boolean
691
+ function getUser(): T | null
639
692
  ```
640
693
 
641
- - `token` — The raw JWT string.
642
- - `bufferSeconds` — Seconds before actual expiry to consider the token expired (default: 0).
643
-
644
- **Returns:** `true` if the token is expired or lacks an `exp` claim.
694
+ **Returns:** The user profile, or `null` if not authenticated.
645
695
 
646
696
  #### `login(credentials)`
647
697
 
@@ -665,19 +715,6 @@ function logout(): Promise<void>
665
715
 
666
716
  **Returns:** A promise that resolves when logout completes.
667
717
 
668
- #### `parseJWT(token)`
669
-
670
- Parses a JWT token payload without verification (base64-decodes
671
- the payload segment).
672
-
673
- ```typescript
674
- function parseJWT(token: string): T | null
675
- ```
676
-
677
- - `token` — The raw JWT string (header.payload.signature).
678
-
679
- **Returns:** The decoded payload object, or `null` if parsing fails.
680
-
681
718
  #### `register(data)`
682
719
 
683
720
  Registers a new user account.
@@ -690,17 +727,6 @@ function register(data: RegisterData): Promise<AuthResult<UserProfile>>
690
727
 
691
728
  **Returns:** The auth result containing tokens and user profile.
692
729
 
693
- #### `setClient(client)`
694
-
695
- Registers an auth client as the active singleton. Called by bond
696
- packages during application startup.
697
-
698
- ```typescript
699
- function setClient(client: AuthClient<UserProfile>): void
700
- ```
701
-
702
- - `client` — The auth client implementation to bond.
703
-
704
730
  ## Injection Notes
705
731
 
706
732
  ### Requirements
@@ -717,6 +743,11 @@ Peer dependencies:
717
743
  - `@molecule/app-i18n`
718
744
  - `@molecule/app-logger`
719
745
 
746
+ - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
747
+ login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
748
+ token and user out of the answer (`(d) => ({ accessToken: d.user.token, user: d.user })`),
749
+ and `authScheme: 'Token'` sends `Authorization: Token <jwt>`. Do not hand-write an
750
+ auth client for a spec like RealWorld.
720
751
  - **A page reload "logging the user out" is the config default, not a bug.**
721
752
  Token storage defaults to `'memory'` (the secure default — a localStorage
722
753
  bearer token is XSS-exfiltratable). Staying signed in across reloads works
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAShB,WAAW,EACZ,MAAM,YAAY,CAAA;AA4CnB;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EACrE,SAAQ,gBAAqB,KAC5B,UAAU,CAAC,CAAC,CAkbd,CAAA"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAShB,WAAW,EACZ,MAAM,YAAY,CAAA;AA4CnB;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,WAAW,GAAG,WAAW,EACrE,SAAQ,gBAAqB,KAC5B,UAAU,CAAC,CAAC,CAgcd,CAAA"}
package/dist/client.js CHANGED
@@ -105,6 +105,9 @@ export const createJWTAuthClient = (config = {}) => {
105
105
  });
106
106
  }, refreshTime);
107
107
  };
108
+ // An API with its own auth envelope (config.requestBody / mapAuthResponse).
109
+ const shapeBody = (kind, payload) => config.requestBody ? config.requestBody(kind, payload) : payload;
110
+ const mapResult = (data) => (config.mapAuthResponse ? config.mapAuthResponse(data) : data);
108
111
  const fetchAPI = async (endpoint, options = {}) => {
109
112
  const url = baseURL + endpoint;
110
113
  const headers = {
@@ -113,7 +116,7 @@ export const createJWTAuthClient = (config = {}) => {
113
116
  };
114
117
  const token = tokenStorage.getAccessToken();
115
118
  if (token) {
116
- headers['Authorization'] = `Bearer ${token}`;
119
+ headers['Authorization'] = `${config.authScheme ?? 'Bearer'} ${token}`;
117
120
  }
118
121
  // 'include' so httpOnly session cookies flow when the API is on another
119
122
  // origin (fetch defaults to 'same-origin', which silently DROPS the login
@@ -184,7 +187,11 @@ export const createJWTAuthClient = (config = {}) => {
184
187
  }
185
188
  catch (_error) {
186
189
  // No valid session cookie (401) or no current-user endpoint — remain
187
- // logged out. This is an expected path for anonymous visitors.
190
+ // logged out. This is an expected path for anonymous visitors. Drop the
191
+ // presence hint: a stale hint (server-side session expired, or a DB
192
+ // reset) would otherwise re-fire a guaranteed-401 probe on every load.
193
+ // The next real login re-sets it alongside the fresh cookie.
194
+ clearSessionHintCookie();
188
195
  }
189
196
  return null;
190
197
  };
@@ -204,10 +211,10 @@ export const createJWTAuthClient = (config = {}) => {
204
211
  async login(credentials) {
205
212
  setState({ loading: true, error: null });
206
213
  try {
207
- const result = await fetchAPI(loginEndpoint, {
214
+ const result = mapResult(await fetchAPI(loginEndpoint, {
208
215
  method: 'POST',
209
- body: JSON.stringify(credentials),
210
- });
216
+ body: JSON.stringify(shapeBody('login', credentials)),
217
+ }));
211
218
  // Two-factor gate: the server answered 206 `{ twoFactorRequired: true }`
212
219
  // — no tokens/user issued. Surface the result WITHOUT marking the
213
220
  // session authenticated; the caller re-prompts for the TOTP and retries.
@@ -276,10 +283,10 @@ export const createJWTAuthClient = (config = {}) => {
276
283
  async register(data) {
277
284
  setState({ loading: true, error: null });
278
285
  try {
279
- const result = await fetchAPI(registerEndpoint, {
286
+ const result = mapResult(await fetchAPI(registerEndpoint, {
280
287
  method: 'POST',
281
- body: JSON.stringify(data),
282
- });
288
+ body: JSON.stringify(shapeBody('register', data)),
289
+ }));
283
290
  tokenStorage.setAccessToken(result.accessToken || null);
284
291
  tokenStorage.setRefreshToken(result.refreshToken || null);
285
292
  tokenStorage.setUser(result.user);
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAenF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,uBAAuB,GAAG,GAAY,EAAE;IAC5C,IAAI,CAAC;QACH,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,GAAG,CAAA;IACpE,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,4EAA4E;QAC5E,6EAA6E;QAC7E,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAG,GAAS,EAAE;IACxC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAM;IAC3C,MAAM,YAAY,GAAG,uBAAuB,EAAE,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC5F,QAAQ,CAAC,MAAM,GAAG,+BAA+B,YAAY,EAAE,CAAA;AACjE,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,SAA2B,EAAE,EACd,EAAE;IACjB,MAAM,EACJ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IAAI,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAA;wBAChD,YAAY,CAAC,KAAK,EAAE,CAAA;oBACtB,CAAC;gBACH,CAAC;YACH,CAAC;YAED,0EAA0E;YAC1E,0EAA0E;YAC1E,MAAM,wBAAwB,EAAE,CAAA;YAChC,QAAQ,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;QACjC,CAAC;QAED,SAAS,CAAC,QAAuC;YAC/C,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAC5B,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC9C,CAAC;QAED,YAAY,CAAC,QAAuC;YAClD,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAC5B,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC9C,CAAC;QAED,QAAQ;YACN,OAAO,YAAY,CAAC,cAAc,EAAE,CAAA;QACtC,CAAC;QAED,gBAAgB,CAAC,QAA2B;YAC1C,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YAC5B,OAAO,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC9C,CAAC;QAED,OAAO;YACL,IAAI,YAAY,EAAE,CAAC;gBACjB,YAAY,CAAC,YAAY,CAAC,CAAA;gBAC1B,YAAY,GAAG,IAAI,CAAA;YACrB,CAAC;YACD,cAAc,CAAC,KAAK,EAAE,CAAA;YACtB,cAAc,CAAC,KAAK,EAAE,CAAA;QACxB,CAAC;KACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -9,6 +9,11 @@
9
9
  * same client.
10
10
  *
11
11
  * @remarks
12
+ * - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
13
+ * login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
14
+ * token and user out of the answer (`(d) => ({ accessToken: d.user.token, user: d.user })`),
15
+ * and `authScheme: 'Token'` sends `Authorization: Token <jwt>`. Do not hand-write an
16
+ * auth client for a spec like RealWorld.
12
17
  * - **A page reload "logging the user out" is the config default, not a bug.**
13
18
  * Token storage defaults to `'memory'` (the secure default — a localStorage
14
19
  * bearer token is XSS-exfiltratable). Staying signed in across reloads works
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -9,6 +9,11 @@
9
9
  * same client.
10
10
  *
11
11
  * @remarks
12
+ * - **An API with its own auth envelope keeps this client.** `requestBody` wraps the
13
+ * login/register payload (`(kind, p) => ({ user: p })`), `mapAuthResponse` reads the
14
+ * token and user out of the answer (`(d) => ({ accessToken: d.user.token, user: d.user })`),
15
+ * and `authScheme: 'Token'` sends `Authorization: Token <jwt>`. Do not hand-write an
16
+ * auth client for a spec like RealWorld.
12
17
  * - **A page reload "logging the user out" is the config default, not a bug.**
13
18
  * Token storage defaults to `'memory'` (the secure default — a localStorage
14
19
  * bearer token is XSS-exfiltratable). Staying signed in across reloads works
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AAEH,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/types.d.ts CHANGED
@@ -321,6 +321,29 @@ export interface AuthClientConfig {
321
321
  * Storage key prefix.
322
322
  */
323
323
  storagePrefix?: string;
324
+ /**
325
+ * Scheme of the `Authorization` header the access token is sent with:
326
+ * `Bearer` (default), or e.g. `Token` for an API that reads
327
+ * `Authorization: Token <jwt>`.
328
+ */
329
+ authScheme?: string;
330
+ /**
331
+ * Shape the login/register request body for an API that expects another
332
+ * envelope (default: the credentials as given). RealWorld, for example:
333
+ * `(kind, payload) => ({ user: payload })`.
334
+ * @param kind - Which request.
335
+ * @param payload - The credentials or registration data.
336
+ * @returns The JSON body to send.
337
+ */
338
+ requestBody?: (kind: 'login' | 'register', payload: Record<string, unknown>) => unknown;
339
+ /**
340
+ * Turn the API's login/register answer into the client's
341
+ * `{ accessToken, refreshToken?, user }` (default: the answer as given).
342
+ * RealWorld, for example: `(data) => ({ accessToken: data.user.token, user: data.user })`.
343
+ * @param data - The parsed response body.
344
+ * @returns The auth result.
345
+ */
346
+ mapAuthResponse?: (data: unknown) => AuthResult<UserProfile>;
324
347
  /**
325
348
  * Token storage type or custom storage adapter.
326
349
  * - 'memory': In-memory storage (lost on page refresh)
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,WAAW;IACzC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAA;IAEP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AAM,CAAA;IAE9B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAE/B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IAEzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,IAAI,MAAM,GAAG,IAAI,CAAA;IAC/B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAC1C,eAAe,IAAI,MAAM,GAAG,IAAI,CAAA;IAChC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAC3C,OAAO,CAAC,CAAC,GAAG,WAAW,KAAK,CAAC,GAAG,IAAI,CAAA;IACpC,OAAO,CAAC,CAAC,GAAG,WAAW,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;IAC9C,KAAK,IAAI,IAAI,CAAA;CACd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-auth",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "Client-side authentication interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",