@basaltkit/auth 1.6.3 → 1.7.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.
package/README.md CHANGED
@@ -350,6 +350,8 @@ const app = await createApp({
350
350
  }).boot()
351
351
  ```
352
352
 
353
+ `apiKeysPlugin` claims the `scopes` key in the adapters' boot-time guarded-meta check, so a route declaring `meta.scopes` **without** the plugin registered fails loud at boot (`UnguardedRouteMetaError`) instead of serving unchecked.
354
+
353
355
  The key is presented in the `Authorization: Bearer mk_live_...` or `x-api-key` header. A **scope** is a granular permission on the key (e.g. `reports:read`); `*` means all. After authenticating, `ctx().apiKey` contains `{ id, scopes, tenantId?, userId? }`.
354
356
 
355
357
  ### Brute-force lockout (LoginThrottle)
@@ -51,6 +51,9 @@ export function apiKeysPlugin(options = {}) {
51
51
  }
52
52
  };
53
53
  metadata.add('http:guards', guard);
54
+ // Claim `meta.scopes` for the adapters' boot-time guarded-meta check —
55
+ // a scope-gated route without this plugin would serve unchecked.
56
+ metadata.add('http:guarded-meta', 'scopes');
54
57
  },
55
58
  });
56
59
  }
package/dist/plugin.js CHANGED
@@ -39,6 +39,9 @@ export function authPlugin(options) {
39
39
  throw new AuthRequiredError();
40
40
  };
41
41
  metadata.add('http:guards', guard);
42
+ // Claim `meta.auth` so the adapters' boot check knows this key is
43
+ // enforced (routes declaring it without this plugin fail loud at boot).
44
+ metadata.add('http:guarded-meta', 'auth');
42
45
  },
43
46
  });
44
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basaltkit/auth",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "description": "Authentication for Basalt: password hashing, JWT with refresh rotation and reuse detection, sessions, ready-made /auth routes and route guards.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,8 +14,8 @@
14
14
  "dist"
15
15
  ],
16
16
  "dependencies": {
17
- "@basaltkit/core": "^1.1.2",
18
- "@basaltkit/http": "^1.9.1"
17
+ "@basaltkit/core": "^1.3.0",
18
+ "@basaltkit/http": "^1.13.0"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "zod": "^3.24.0 || ^4.0.0"
@@ -25,7 +25,7 @@
25
25
  "typescript": "^7.0.2",
26
26
  "vitest": "^4.1.11",
27
27
  "zod": "^3.24.0 || ^4.0.0",
28
- "@basaltkit/fastify": "^1.6.1",
28
+ "@basaltkit/fastify": "^1.8.0",
29
29
  "@basaltkit/tsconfig": "^0.24.0"
30
30
  },
31
31
  "publishConfig": {