@molecule/app-auth 3.0.0 → 3.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.
- package/README.md +23 -9
- package/package.json +3 -3
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-10-
|
|
6
|
+
Generated: 2026-10-26T04:14:38.335Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-auth
|
|
@@ -1362,7 +1362,10 @@ forwards a profile type copies `AuthProfileConstraint` (see
|
|
|
1362
1362
|
{@link AuthClientConfig}'s migration note).
|
|
1363
1363
|
|
|
1364
1364
|
```typescript
|
|
1365
|
-
function createJWTAuthClient
|
|
1365
|
+
function createJWTAuthClient<
|
|
1366
|
+
T extends AuthProfileConstraint<T> = UserProfile,
|
|
1367
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1368
|
+
>(config?: NoInfer<AuthClientConfigOptions<T>>): AuthClient<T, TRegister>
|
|
1366
1369
|
```
|
|
1367
1370
|
|
|
1368
1371
|
- `config` — Auth client configuration including endpoints, storage, and refresh settings.
|
|
@@ -1375,7 +1378,10 @@ Registers an auth client as the active singleton. Called by bond
|
|
|
1375
1378
|
packages during application startup.
|
|
1376
1379
|
|
|
1377
1380
|
```typescript
|
|
1378
|
-
function setClient
|
|
1381
|
+
function setClient<
|
|
1382
|
+
T = UserProfile,
|
|
1383
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1384
|
+
>(client: AuthClient<T, TRegister>): void
|
|
1379
1385
|
```
|
|
1380
1386
|
|
|
1381
1387
|
- `client` — The auth client implementation to bond.
|
|
@@ -1385,7 +1391,10 @@ function setClient(client: AuthClient<T, TRegister>): void
|
|
|
1385
1391
|
Retrieves the bonded auth client, throwing if none is configured.
|
|
1386
1392
|
|
|
1387
1393
|
```typescript
|
|
1388
|
-
function getClient
|
|
1394
|
+
function getClient<
|
|
1395
|
+
T extends AuthProfileConstraint<T> = UserProfile,
|
|
1396
|
+
TRegister extends RegisterExtraShape<TRegister> = Record<never, never>,
|
|
1397
|
+
>(): AuthClient<T, TRegister>
|
|
1389
1398
|
```
|
|
1390
1399
|
|
|
1391
1400
|
**Returns:** The bonded auth client.
|
|
@@ -1407,7 +1416,7 @@ storage or a custom `StorageAdapter`.
|
|
|
1407
1416
|
|
|
1408
1417
|
```typescript
|
|
1409
1418
|
function createTokenStorage(
|
|
1410
|
-
storage?:
|
|
1419
|
+
storage?: 'memory' | StorageAdapter,
|
|
1411
1420
|
prefix?: string,
|
|
1412
1421
|
tokenKey?: string,
|
|
1413
1422
|
): TokenStorage
|
|
@@ -1425,7 +1434,7 @@ Parses a JWT token payload without verification (base64-decodes
|
|
|
1425
1434
|
the payload segment).
|
|
1426
1435
|
|
|
1427
1436
|
```typescript
|
|
1428
|
-
function parseJWT(token: string): T | null
|
|
1437
|
+
function parseJWT<T = Record<string, unknown>>(token: string): T | null
|
|
1429
1438
|
```
|
|
1430
1439
|
|
|
1431
1440
|
- `token` — The raw JWT string (header.payload.signature).
|
|
@@ -1472,7 +1481,7 @@ function isAuthenticated(): boolean
|
|
|
1472
1481
|
Returns the current user profile, or `null` if not authenticated.
|
|
1473
1482
|
|
|
1474
1483
|
```typescript
|
|
1475
|
-
function getUser(): T | null
|
|
1484
|
+
function getUser<T extends AuthProfileConstraint<T> = UserProfile>(): T | null
|
|
1476
1485
|
```
|
|
1477
1486
|
|
|
1478
1487
|
**Returns:** The user profile, or `null` if not authenticated.
|
|
@@ -1482,7 +1491,9 @@ function getUser(): T | null
|
|
|
1482
1491
|
Logs in with the given credentials (email/username + password).
|
|
1483
1492
|
|
|
1484
1493
|
```typescript
|
|
1485
|
-
function login
|
|
1494
|
+
function login<T extends AuthProfileConstraint<T> = UserProfile>(
|
|
1495
|
+
credentials: LoginCredentials,
|
|
1496
|
+
): Promise<AuthResult<T>>
|
|
1486
1497
|
```
|
|
1487
1498
|
|
|
1488
1499
|
- `credentials` — Email/username and password.
|
|
@@ -1508,7 +1519,10 @@ The registration extra fields stay the FIRST type argument, exactly as before
|
|
|
1508
1519
|
second one (`register<{ username: string }, SessionUser>(data)`).
|
|
1509
1520
|
|
|
1510
1521
|
```typescript
|
|
1511
|
-
function register
|
|
1522
|
+
function register<
|
|
1523
|
+
TExtra extends RegisterExtraShape<TExtra> = Record<never, never>,
|
|
1524
|
+
T extends AuthProfileConstraint<T> = UserProfile,
|
|
1525
|
+
>(data: RegisterData<TExtra>): Promise<AuthResult<T>>
|
|
1512
1526
|
```
|
|
1513
1527
|
|
|
1514
1528
|
- `data` — Registration data (email, password, and any `TExtra` fields).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-auth",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Client-side authentication interface for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@molecule/app-logger": "^1.0.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@molecule/app-bond": "1.0.
|
|
37
|
-
"@molecule/app-i18n": "1.1.
|
|
36
|
+
"@molecule/app-bond": "1.0.4",
|
|
37
|
+
"@molecule/app-i18n": "1.1.1",
|
|
38
38
|
"@molecule/app-logger": "1.0.3",
|
|
39
39
|
"@types/node": "26.6.5",
|
|
40
40
|
"typescript": "6.0.3",
|