@aponiajs/auth 0.0.0-stage → 1.0.0-beta.65

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/llms.txt ADDED
@@ -0,0 +1,39 @@
1
+ # @aponiajs/auth
2
+
3
+ > JWT authentication, role and permission guards, request-scoped current user, refresh-token rotation, access-token revocation, and Bun-native password hashing for an AponiaJS application.
4
+
5
+ ## What this package exports
6
+
7
+ - `AuthModule.forRoot({ jwt | oidc, token?, refresh?, revocation?, isGlobal?, globalGuard? })`: the module an application imports; `register({...})` is the deprecated alias. `jwt` states a local secret; `oidc` states an issuer. It is global and registers `AuthGuard` as an `APP_GUARD` by default; `globalGuard: false` leaves the guard to routes. There is no `forRootAsync`: the verifier arm decides the provider list.
8
+ - `MODULE_OPTIONS_TOKEN` (`AUTH_MODULE_OPTIONS`): the options token the registration provides and exports.
9
+ - `CurrentUser(key?)` and `CurrentSession()`: parameter decorators reading the authenticated user and session; both answer `null` on a `@Public()` route.
10
+ - `JwtService`: `sign` and `verify`; `keys`/`activeKid` rotate signing secrets, `kid` is read from the token header, and an unknown kid is refused.
11
+ - `OidcService`: `discover`, `verify`, `clear`; reads `<issuer>/.well-known/openid-configuration` and verifies against the published key set.
12
+ - `AuthGuard`, `RolesGuard`, `PermissionsGuard`: the bearer/cookie, role, and permission guards.
13
+ - `AuthService`: `current()` returns the authenticated user for the request.
14
+ - `Roles`, `Permissions`, `Public`: authorization decorators.
15
+ - `PasswordService`: `hash` and `verify` through Bun's password API.
16
+ - `RefreshTokenService`: `issue`, `rotate`, `revoke`, `revokeFamily`, `clear`; stores only a token digest and consumes rotation atomically.
17
+ - Rotation reuse is `INVALID_REFRESH_TOKEN` and revokes the whole family; a custom store without `consume` gets the single-winner fallback only.
18
+ - `RevocationService`: `revoke(jti, expiresAt)`, `isRevoked(jti)`, `clear`.
19
+ - `MemoryRefreshTokenStore`, `MemoryRevocationStore`: bounded process-local stores, tombstones included.
20
+ - `AUTH_USER`: the request-context token the user is stored under.
21
+
22
+ ## Behavior a consumer can rely on
23
+
24
+ - The JWT secret must be at least 32 characters.
25
+ - A missing, invalid, or expired token answers `401`; a missing role or permission answers `403`.
26
+ - `Roles()` requires at least one named role; `Permissions()` requires every named permission.
27
+ - `Public()` bypasses authentication.
28
+ - The package mounts no route and reads no environment variable.
29
+ - `token.cookieName` adds a cookie transport; the Authorization header wins when both are present, and a cookie token needs CSRF protection.
30
+ - Rotating a refresh token consumes the previous one; replaying it answers `INVALID_REFRESH_TOKEN`.
31
+ - `AuthGuard` rejects a verified access token whose `jti` is revoked.
32
+ - `JwtService.sign()` mints a `jti` when none is supplied; a caller-supplied `jti` is preserved, and a token minted elsewhere without one is not revocation-checked.
33
+ - `refresh.store` and `revocation.store` accept shared-state implementations; the defaults are process-local and bounded.
34
+
35
+ ## Documentation
36
+
37
+ - [Package README](./README.md)
38
+ - [Agent surface](../../docs/agent/README.md)
39
+ - [npm](https://www.npmjs.com/package/@aponiajs/auth)
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@aponiajs/auth",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0-beta.65",
4
+ "description": "JWT authentication, role and permission guards, and Bun-native password hashing for AponiaJS.",
5
+ "keywords": [
6
+ "aponia",
7
+ "aponiajs",
8
+ "auth",
9
+ "bun",
10
+ "elysia",
11
+ "jwt",
12
+ "rbac",
13
+ "security"
14
+ ],
15
+ "homepage": "https://github.com/aponiajs/aponiajs#readme",
16
+ "bugs": {
17
+ "url": "https://github.com/aponiajs/aponiajs/issues"
18
+ },
19
+ "license": "MIT",
20
+ "author": "AponiaJS contributors",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/aponiajs/aponiajs.git",
24
+ "directory": "packages/auth"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "llms.txt"
29
+ ],
30
+ "type": "module",
31
+ "exports": {
32
+ ".": "./dist/index.mjs",
33
+ "./package.json": "./package.json"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "scripts": {
39
+ "build": "bunx --bun vp pack",
40
+ "dev": "bunx --bun vp pack --watch",
41
+ "test": "bun test",
42
+ "test:vite-plus": "vp test",
43
+ "check": "bunx --bun vp check",
44
+ "prepublishOnly": "bun run build"
45
+ },
46
+ "dependencies": {
47
+ "@aponiajs/common": "1.0.0-beta.65",
48
+ "@aponiajs/core": "1.0.0-beta.65",
49
+ "jose": "^6.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@aponiajs/core": "1.0.0-beta.65",
53
+ "@aponiajs/platform-elysia": "1.0.0-beta.65",
54
+ "@aponiajs/platform-h3": "1.0.0-beta.65",
55
+ "@aponiajs/platform-hono": "1.0.0-beta.65",
56
+ "@aponiajs/testing": "1.0.0-beta.65",
57
+ "elysia": "2.0.0-rc.4"
58
+ },
59
+ "engines": {
60
+ "bun": ">=1.4.4"
61
+ }
62
+ }