@warlock.js/auth 4.4.0 → 4.6.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 (2) hide show
  1. package/CHANGELOG.md +54 -54
  2. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,54 +1,54 @@
1
- # Changelog — @warlock.js/auth
2
-
3
- All notable changes to `@warlock.js/auth` are documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
-
7
- ## 4.2.11
8
-
9
- ### Changed
10
-
11
- - Bumped `@mongez/reinforcements` to 3.3.0
12
-
13
- ## 4.2.10
14
-
15
- ### Fixed
16
-
17
- - `@mongez/copper`, `@mongez/events`, and `@mongez/reinforcements` are now regular `dependencies` instead of `peerDependencies` — matching every other framework package. They're framework-internal utilities your app never imports directly, so declaring them as peers forced consumers to install them and produced `unmet peer dependency` warnings on install. They now resolve transitively and silently.
18
-
19
- ## 4.2.0
20
-
21
- ### Added
22
-
23
- - `loginThrottleMiddleware` — failure-aware brute-force / credential-stuffing protection that counts only failed logins, resets on a successful one, locks per-account and per-IP, and rejects pre-controller with `429` (cache-backed, fails open on a cache outage). Adds `AuthErrorCodes.TooManyAttempts` (`EC004`).
24
- - `accessToken` / `refreshToken` configuration blocks, making a separate refresh-token secret first-class.
25
- - Overridable token storage — register a custom model under `config.auth.accessToken.model` / `config.auth.refreshToken.model` and `.extend()` the exported `accessTokenSchema` / `refreshTokenSchema` to add columns (e.g. a multi-tenant `organization_id`). Models own issuance through `issue()` and expose named statics, so the service hard-codes no column names.
26
- - `tokenType` (`access` | `refresh`) claim, stamped on issue and verified on read, so an access token can no longer be presented as a refresh token.
27
- - `expires_at` on access tokens; `warlock auth.cleanup` now purges expired access tokens as well as refresh tokens.
28
-
29
- ### Fixed
30
-
31
- - Default access-token lifetime was ~3.6 seconds (a numeric `expiresIn` interpreted as milliseconds) and is now **1 hour**.
32
- - Targeted revocation queried `userId` instead of the `user_id` column, so logout and refresh-token removal threw on Postgres and silently no-oped on MongoDB. The service now routes every token query through named model statics, so no column name is hard-coded.
33
- - Token deletions were fire-and-forget inside `Promise<void>` methods (false success for callers, uncatchable rejections) and are now awaited.
34
- - The route middleware matched on `userType` instead of the `user_type` column.
35
- - `revokeAllTokens` / `revokeTokenFamily` reported an empty set — a re-query on `revoked_at: null` after the update matched nothing — so the `token.revoked` / `token.familyRevoked` events never fired. The revoked rows are now captured before revocation.
36
- - A throwing synchronous auth-event listener no longer turns a completed login into a `500`.
37
-
38
- ### Security
39
-
40
- - `warlock jwt.generate` now derives `JWT_SECRET` / `JWT_REFRESH_SECRET` from a CSPRNG (`Random.token`) instead of `Math.random()`-backed `Random.string`.
41
- - Refresh-token rotation is atomic: a guarded conditional `UPDATE` means two concurrent rotations of the same token can never both succeed, and a replayed token revokes its entire family.
42
-
43
- ### Deprecated
44
-
45
- - The `auth.jwt.*` configuration block (`jwt: { secret, expiresIn, refresh }`). Use `accessToken` / `refreshToken` instead — the legacy shape is still read and mapped forward with a one-time deprecation warning.
46
-
47
- ### Removed
48
-
49
- - Unread `access_tokens` columns `is_active` and `last_access`.
50
- - The unused `auth.password.salt` configuration key.
51
-
52
- ## 4.1.15
53
-
54
- - Baseline — per-package changelog tracking starts at this version.
1
+ # Changelog — @warlock.js/auth
2
+
3
+ All notable changes to `@warlock.js/auth` are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
+
7
+ ## 4.2.11
8
+
9
+ ### Changed
10
+
11
+ - Bumped `@mongez/reinforcements` to 3.3.0
12
+
13
+ ## 4.2.10
14
+
15
+ ### Fixed
16
+
17
+ - `@mongez/copper`, `@mongez/events`, and `@mongez/reinforcements` are now regular `dependencies` instead of `peerDependencies` — they're framework-internal utilities your app never imports, so declaring them as peers produced `unmet peer dependency` warnings on install.
18
+
19
+ ## 4.2.0
20
+
21
+ ### Added
22
+
23
+ - `loginThrottleMiddleware` — failure-aware brute-force / credential-stuffing protection: counts only failed logins, locks per-account and per-IP, and rejects pre-controller with `429` (cache-backed, fails open). Adds `AuthErrorCodes.TooManyAttempts` (`EC004`).
24
+ - `accessToken` / `refreshToken` configuration blocks, making a separate refresh-token secret first-class.
25
+ - Overridable token storage — register a custom model under `config.auth.accessToken.model` / `refreshToken.model` and `.extend()` the exported schemas to add columns (e.g. a multi-tenant `organization_id`).
26
+ - `tokenType` (`access` | `refresh`) claim, stamped on issue and verified on read, so an access token can't be presented as a refresh token.
27
+ - `expires_at` on access tokens; `warlock auth.cleanup` now purges expired access tokens too.
28
+
29
+ ### Fixed
30
+
31
+ - Default access-token lifetime was ~3.6 seconds (a numeric `expiresIn` read as milliseconds) and is now **1 hour**.
32
+ - Targeted revocation queried `userId` instead of the `user_id` column, so logout / refresh-token removal threw on Postgres and silently no-oped on MongoDB; token queries now route through named model statics.
33
+ - Token deletions were fire-and-forget (false success for callers, uncatchable rejections) and are now awaited.
34
+ - The route middleware matched on `userType` instead of the `user_type` column.
35
+ - `revokeAllTokens` / `revokeTokenFamily` reported an empty set, so `token.revoked` / `token.familyRevoked` never fired; the revoked rows are now captured before revocation.
36
+ - A throwing synchronous auth-event listener no longer turns a completed login into a `500`.
37
+
38
+ ### Security
39
+
40
+ - `warlock jwt.generate` now derives `JWT_SECRET` / `JWT_REFRESH_SECRET` from a CSPRNG (`Random.token`) instead of `Math.random()`.
41
+ - Refresh-token rotation is atomic a guarded conditional `UPDATE` means two concurrent rotations can't both succeed, and a replayed token revokes its entire family.
42
+
43
+ ### Deprecated
44
+
45
+ - The `auth.jwt.*` configuration block. Use `accessToken` / `refreshToken` instead — the legacy shape is still read and mapped forward with a one-time deprecation warning.
46
+
47
+ ### Removed
48
+
49
+ - Unread `access_tokens` columns `is_active` and `last_access`.
50
+ - The unused `auth.password.salt` configuration key.
51
+
52
+ ## 4.1.15
53
+
54
+ - Baseline — per-package changelog tracking starts at this version.
package/package.json CHANGED
@@ -23,14 +23,14 @@
23
23
  "ms": "^2.1.3"
24
24
  },
25
25
  "peerDependencies": {
26
- "@warlock.js/fs": "4.4.0",
27
- "@warlock.js/cache": "4.4.0",
28
- "@warlock.js/cascade": "4.4.0",
29
- "@warlock.js/core": "4.4.0",
30
- "@warlock.js/logger": "4.4.0",
31
- "@warlock.js/seal": "4.4.0"
26
+ "@warlock.js/fs": "4.6.0",
27
+ "@warlock.js/cache": "4.6.0",
28
+ "@warlock.js/cascade": "4.6.0",
29
+ "@warlock.js/core": "4.6.0",
30
+ "@warlock.js/logger": "4.6.0",
31
+ "@warlock.js/seal": "4.6.0"
32
32
  },
33
- "version": "4.4.0",
33
+ "version": "4.6.0",
34
34
  "type": "module",
35
35
  "main": "./esm/index.mjs",
36
36
  "module": "./esm/index.mjs",