@mano8/astro-auth-m8 1.4.1 → 2.0.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/CHANGELOG.md +116 -0
- package/README.md +70 -3
- package/dist/src/integration.d.ts.map +1 -1
- package/dist/src/integration.js +3 -1
- package/dist/src/integration.js.map +1 -1
- package/dist/src/runtime/api/apiKeys.d.ts +3 -1
- package/dist/src/runtime/api/apiKeys.d.ts.map +1 -1
- package/dist/src/runtime/api/apiKeys.js +9 -1
- package/dist/src/runtime/api/apiKeys.js.map +1 -1
- package/dist/src/runtime/api/index.d.ts +1 -0
- package/dist/src/runtime/api/index.d.ts.map +1 -1
- package/dist/src/runtime/api/index.js +1 -0
- package/dist/src/runtime/api/index.js.map +1 -1
- package/dist/src/runtime/api/ops.d.ts +2 -1
- package/dist/src/runtime/api/ops.d.ts.map +1 -1
- package/dist/src/runtime/api/ops.js +6 -1
- package/dist/src/runtime/api/ops.js.map +1 -1
- package/dist/src/runtime/api/security.d.ts +8 -0
- package/dist/src/runtime/api/security.d.ts.map +1 -0
- package/dist/src/runtime/api/security.js +23 -0
- package/dist/src/runtime/api/security.js.map +1 -0
- package/dist/src/runtime/api/users.d.ts +2 -2
- package/dist/src/runtime/api/users.d.ts.map +1 -1
- package/dist/src/runtime/api/users.js +2 -2
- package/dist/src/runtime/api/users.js.map +1 -1
- package/dist/src/runtime/authEvents.d.ts +25 -0
- package/dist/src/runtime/authEvents.d.ts.map +1 -0
- package/dist/src/runtime/authEvents.js +26 -0
- package/dist/src/runtime/authEvents.js.map +1 -0
- package/dist/src/runtime/authorization.d.ts +80 -0
- package/dist/src/runtime/authorization.d.ts.map +1 -0
- package/dist/src/runtime/authorization.js +109 -0
- package/dist/src/runtime/authorization.js.map +1 -0
- package/dist/src/runtime/browserAdapter.d.ts +18 -0
- package/dist/src/runtime/browserAdapter.d.ts.map +1 -0
- package/dist/src/runtime/browserAdapter.js +50 -0
- package/dist/src/runtime/browserAdapter.js.map +1 -0
- package/dist/src/runtime/compatibility.d.ts +6 -6
- package/dist/src/runtime/compatibility.d.ts.map +1 -1
- package/dist/src/runtime/compatibility.js +35 -5
- package/dist/src/runtime/compatibility.js.map +1 -1
- package/dist/src/runtime/errors.d.ts +39 -0
- package/dist/src/runtime/errors.d.ts.map +1 -1
- package/dist/src/runtime/errors.js +79 -0
- package/dist/src/runtime/errors.js.map +1 -1
- package/dist/src/runtime/hooks/index.d.ts +1 -0
- package/dist/src/runtime/hooks/index.d.ts.map +1 -1
- package/dist/src/runtime/hooks/index.js +1 -0
- package/dist/src/runtime/hooks/index.js.map +1 -1
- package/dist/src/runtime/hooks/useApiKeys.d.ts +69 -0
- package/dist/src/runtime/hooks/useApiKeys.d.ts.map +1 -1
- package/dist/src/runtime/hooks/useApiKeys.js +38 -1
- package/dist/src/runtime/hooks/useApiKeys.js.map +1 -1
- package/dist/src/runtime/hooks/useSecurity.d.ts +70 -0
- package/dist/src/runtime/hooks/useSecurity.d.ts.map +1 -0
- package/dist/src/runtime/hooks/useSecurity.js +60 -0
- package/dist/src/runtime/hooks/useSecurity.js.map +1 -0
- package/dist/src/runtime/hooks/useUsers.d.ts +4 -15
- package/dist/src/runtime/hooks/useUsers.d.ts.map +1 -1
- package/dist/src/runtime/hooks/useUsers.js +18 -4
- package/dist/src/runtime/hooks/useUsers.js.map +1 -1
- package/dist/src/runtime/queryKeys.d.ts +2 -0
- package/dist/src/runtime/queryKeys.d.ts.map +1 -1
- package/dist/src/runtime/queryKeys.js +3 -1
- package/dist/src/runtime/queryKeys.js.map +1 -1
- package/dist/src/runtime/react/AuthProvider.d.ts.map +1 -1
- package/dist/src/runtime/react/AuthProvider.js +24 -0
- package/dist/src/runtime/react/AuthProvider.js.map +1 -1
- package/dist/src/runtime/react/RequireRole.d.ts.map +1 -1
- package/dist/src/runtime/react/RequireRole.js +3 -2
- package/dist/src/runtime/react/RequireRole.js.map +1 -1
- package/dist/src/runtime/react/index.d.ts +1 -0
- package/dist/src/runtime/react/index.d.ts.map +1 -1
- package/dist/src/runtime/react/index.js +4 -0
- package/dist/src/runtime/react/index.js.map +1 -1
- package/dist/src/runtime/schemas.d.ts +186 -1
- package/dist/src/runtime/schemas.d.ts.map +1 -1
- package/dist/src/runtime/schemas.js +74 -3
- package/dist/src/runtime/schemas.js.map +1 -1
- package/package.json +18 -12
- package/registry/r/account-crud.json +1 -1
- package/registry/r/account-dashboard.json +1 -1
- package/registry/r/admin-users-panel.json +1 -1
- package/registry/r/api-keys-panel.json +1 -1
- package/registry/r/registry.json +6 -0
- package/registry/r/security-panel.json +27 -0
- package/registry/r/sessions-panel.json +1 -1
- package/registry.json +22 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@mano8/astro-auth-m8` are documented here.
|
|
4
|
+
|
|
5
|
+
This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
The major version tracks the supported `fa-auth-m8` **API contract**, not just
|
|
7
|
+
this package's own surface: a backend contract repoint is always a major.
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
Aligns the plugin with the `fa-auth-m8@2.0` contract (service `2.0.0`,
|
|
12
|
+
supported range `>=2.0.0 <3.0.0`). **A `1.x` host cannot talk to a `2.0.0`
|
|
13
|
+
backend and a `2.0.0` host cannot talk to a `1.x` backend** — upgrade both
|
|
14
|
+
together.
|
|
15
|
+
|
|
16
|
+
### Breaking
|
|
17
|
+
|
|
18
|
+
- **Supported backend contract is now `fa-auth-m8@2.0`**, range
|
|
19
|
+
`>=2.0.0 <3.0.0` (was `fa-auth-m8@1.0`, `>=1.0.0 <2.0.0`). `compatibility.ts`
|
|
20
|
+
constants, the `faAuthM8` package metadata block, and the README all move
|
|
21
|
+
together.
|
|
22
|
+
- **`is_superuser` is no longer accepted on user creation.** It was removed from
|
|
23
|
+
`UserCreateSchema` and from the admin create form. `fa-auth-m8` 2.0.0 derives
|
|
24
|
+
the flag server-side from `role` and returns `422` on *any* submitted
|
|
25
|
+
`is_superuser` — `true` or `false`. It remains on `UserPublic` as a response
|
|
26
|
+
field, because the superuser predicate requires both claims as evidence.
|
|
27
|
+
- **`RequireRole roles={...}` is now an ordered-hierarchy check, not exact
|
|
28
|
+
membership.** `roles={["admin"]}` now also admits a `superadmin`. Previously a
|
|
29
|
+
superadmin was denied every admin-tier surface. If you relied on exact-role
|
|
30
|
+
matching, compare `user.role` yourself.
|
|
31
|
+
- **`RequireRole superuser` now requires dual evidence.** It grants only when
|
|
32
|
+
`role === "superadmin"` **and** `is_superuser === true`, via
|
|
33
|
+
`hasSuperuserPrivileges`. A row carrying an inconsistent pair (possible on
|
|
34
|
+
data written before 2.0.0's consistency constraint) is now denied instead of
|
|
35
|
+
granted on the flag alone.
|
|
36
|
+
- **`PATCH /users/update/{id}/` now parses as `UserAuthorizationUpdate`**
|
|
37
|
+
(`UserPublic` plus required `auth_generation` and `revocation_enqueued`).
|
|
38
|
+
`useUsers().update` returns `Promise<UserAuthorizationUpdate>`; anything typed
|
|
39
|
+
against `UserPublic` needs widening.
|
|
40
|
+
- **`ApiKeyPublic` / `ApiKeyCreated` gained required `access_mode` and
|
|
41
|
+
`audiences`.** Both schemas are `.strict()`, so a `1.x` backend response no
|
|
42
|
+
longer parses.
|
|
43
|
+
- **Registry block change (affects copied files):** `errorMessage(error,
|
|
44
|
+
fallback)` in `registry/blocks/account/account-crud.tsx` now returns a
|
|
45
|
+
`ToastNotification` (`{ title, description? }`) instead of a `string`. If you
|
|
46
|
+
copied the account blocks at `1.x` and re-add them, update call sites from
|
|
47
|
+
`accountToast.error({ title: errorMessage(e, f) })` to
|
|
48
|
+
`accountToast.error(errorMessage(e, f))`.
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- `./authorization` subpath: `hasMinimumRole`, `hasSuperuserPrivileges`,
|
|
53
|
+
`privilegeClaimsAreConsistent`, `ORDERED_ROLES` — the TypeScript mirror of
|
|
54
|
+
`auth_sdk_m8/authorization.py`, and the only place this package encodes the
|
|
55
|
+
role hierarchy or the `role`/`is_superuser` invariant.
|
|
56
|
+
- `./errors` subpath: `describeApiError(error, fallback)`, mapping the 2.0.0
|
|
57
|
+
authorization, rate-limit and retention error contracts to operator-readable
|
|
58
|
+
`{ title, description? }`. `409 last_superuser_required` is labelled and the
|
|
59
|
+
raw token never surfaces; `429` (not attempted) and `503` (outcome unknown,
|
|
60
|
+
do not retry) are kept distinct; a `400` retention-floor rejection is
|
|
61
|
+
surfaced verbatim rather than pattern-matched.
|
|
62
|
+
- Wrappers and hooks for the five new 2.0.0 admin routes: `useAdminApiKeys`
|
|
63
|
+
(superadmin list/revoke of another user's keys, metadata only),
|
|
64
|
+
`useAuditLog` (admin-tier privileged-action trail), `useSecurityPurges`
|
|
65
|
+
(superadmin retention purges). `GET /security/superuser-probe` is
|
|
66
|
+
deliberately not wrapped — it is the `security-tests-m8` harness canary.
|
|
67
|
+
- `security-panel` registry item, carrying both admin tiers behind the two
|
|
68
|
+
different predicates the service uses: the audit-log read behind
|
|
69
|
+
`RequireRole roles={["admin"]}` (role hierarchy) and both purges behind
|
|
70
|
+
`RequireRole superuser` (dual evidence).
|
|
71
|
+
- `AccountTab.minRole` on `account-dashboard`, so an admin-tier tab is
|
|
72
|
+
representable in the account shell alongside the existing `superuserOnly`.
|
|
73
|
+
- `is_active` on `UserUpdateSchema`, plus an admin Status control behind a
|
|
74
|
+
dedicated confirmation naming the consequence (generation bump, session
|
|
75
|
+
revocation, and on deactivation an API-key revocation that reactivation does
|
|
76
|
+
not undo). It submits as its own isolated mutation, never bundled into a
|
|
77
|
+
general field edit.
|
|
78
|
+
- Revocation handling: a `revocation_enqueued: true` response invalidates the
|
|
79
|
+
affected auth caches and emits `AUTH_REVOCATION_EVENT`. A mounted
|
|
80
|
+
`AuthProvider` re-reads the profile for the signed-in principal, raising
|
|
81
|
+
`loading` so guards fall back instead of rendering privileged UI from
|
|
82
|
+
superseded claims. The backend remains the authority; this only stops a stale
|
|
83
|
+
client view outliving the change.
|
|
84
|
+
- Automatic compatibility preflight: `installFaAuthBrowserAdapter` calls the
|
|
85
|
+
public `GET {apiBase}/meta` once per install and **warns** on a contract or
|
|
86
|
+
version mismatch. It is advisory and fire-and-forget — it never blocks or
|
|
87
|
+
fails adapter setup, and a fetch failure is ignored. Hosts that want to fail
|
|
88
|
+
closed can still call `assertFaAuthM8Compatibility` themselves. Note this
|
|
89
|
+
adds one unauthenticated request per page load, including for anonymous
|
|
90
|
+
visitors.
|
|
91
|
+
- `access_mode` and `audiences` columns plus explicit creation controls on the
|
|
92
|
+
owner-facing API-keys panel.
|
|
93
|
+
|
|
94
|
+
### Fixed
|
|
95
|
+
|
|
96
|
+
- The compatibility preflight now checks the issuer id on the nested
|
|
97
|
+
`GET /meta` `contract` object, not only its version. Every M8 service serves
|
|
98
|
+
the same payload shape from the shared `mount_service_meta` helper, so a host
|
|
99
|
+
pointed at the wrong sibling was previously reported compatible whenever the
|
|
100
|
+
contract versions happened to match.
|
|
101
|
+
- `403` is now titled by status (`Not permitted`) with the backend's readable
|
|
102
|
+
detail as the description, instead of asserting a role-change cause that was
|
|
103
|
+
wrong for an audit-log or purge `403`.
|
|
104
|
+
- Test fixtures no longer certify an impossible `role: "admin"` /
|
|
105
|
+
`is_superuser: true` pair as a superuser.
|
|
106
|
+
|
|
107
|
+
### Internal
|
|
108
|
+
|
|
109
|
+
- The 100% coverage gate now measures `src/runtime/react/**` and
|
|
110
|
+
`src/runtime/hooks/**`, which were previously excluded — including
|
|
111
|
+
`RequireRole` and the hook layer that carries revocation handling.
|
|
112
|
+
|
|
113
|
+
## 1.5.0 and earlier
|
|
114
|
+
|
|
115
|
+
See the Git history and GitHub releases for `v1.5.0` and prior tags; this file
|
|
116
|
+
was introduced with the `2.0.0` release.
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# astro-auth-m8
|
|
2
2
|
|
|
3
3
|

|
|
4
|
+
[](https://codecov.io/github/mano8/astro-auth-m8)
|
|
5
|
+
[](https://app.codacy.com/gh/mano8/astro-auth-m8/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
4
6
|
|
|
5
7
|
Astro integration and headless runtime client for `fa-auth-m8`.
|
|
6
8
|
|
|
@@ -12,11 +14,11 @@ Part of the M8 auth stack: [mano8/astro-auth-m8](https://github.com/mano8/astro-
|
|
|
12
14
|
npm install @mano8/astro-auth-m8
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
Use it with a `fa-auth-m8` backend that satisfies the `fa-auth-m8@
|
|
17
|
+
Use it with a `fa-auth-m8` backend that satisfies the `fa-auth-m8@2.0` contract.
|
|
16
18
|
|
|
17
19
|
## Backend contract
|
|
18
20
|
|
|
19
|
-
This package targets the `fa-auth-m8@
|
|
21
|
+
This package targets the `fa-auth-m8@2.0` API contract and was tested against `fa-auth-m8` service version `2.0.0`. Supported backend service versions are `>=2.0.0 <3.0.0`.
|
|
20
22
|
|
|
21
23
|
Compatibility helpers are exported from `@mano8/astro-auth-m8/compatibility`. `fa-auth-m8` (>= 1.0.0) exposes a public `GET {API_PREFIX}/meta` route returning a `ServiceMeta` payload - pass it straight to the assert:
|
|
22
24
|
|
|
@@ -30,6 +32,68 @@ assertFaAuthM8Compatibility(meta); // reads nested contract.version + version
|
|
|
30
32
|
|
|
31
33
|
The helper also accepts flat fields (`auth_contract_version` / `contract_version` / `service_version`) for backends that surface metadata elsewhere.
|
|
32
34
|
|
|
35
|
+
### Automatic preflight
|
|
36
|
+
|
|
37
|
+
`installFaAuthBrowserAdapter` (wired in by this package's Astro integration on every page) runs a `GET {API_PREFIX}/meta` preflight itself, once per install, and calls `getFaAuthM8Compatibility` (not the throwing assert) on the result. An incompatible contract or service version logs one `console.warn` naming the expected contract/range; an unrecognized (`"unknown"`) `/meta` payload warns at most once per page. Neither case throws or blocks adapter setup, and a `/meta` fetch failure (offline, CORS, a pre-1.0 backend without the route) is swallowed silently, since the preflight is advisory only. Hosts that want a hard version gate instead should still call `assertFaAuthM8Compatibility` themselves — it is exported unchanged and throws on `"incompatible"` (and on `"unknown"` unless `requireKnown` is passed `false`).
|
|
38
|
+
|
|
39
|
+
## Authorization predicates
|
|
40
|
+
|
|
41
|
+
`@mano8/astro-auth-m8/authorization` is the single place this package encodes the role hierarchy and the role/`is_superuser` cross-field invariant. It mirrors the backend's canonical `auth_sdk_m8.authorization` module, so client-side gating cannot drift from what the server enforces.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { hasMinimumRole, hasSuperuserPrivileges } from "@mano8/astro-auth-m8/authorization";
|
|
45
|
+
|
|
46
|
+
// Ordered hierarchy - a higher role satisfies a lower requirement.
|
|
47
|
+
hasMinimumRole(user.role, "admin"); // true for "superadmin"
|
|
48
|
+
|
|
49
|
+
// Dual evidence - never decide from `role` alone or `is_superuser` alone.
|
|
50
|
+
hasSuperuserPrivileges(user.role, user.is_superuser);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The valid role/flag pairs are `superadmin` with `is_superuser: true`, and every other role with `is_superuser: false`. `privilegeClaimsAreConsistent` exposes that invariant on its own, and `ORDERED_ROLES` exposes the hierarchy, highest privilege first. Any other pair - including an unrecognised role - grants nothing. These are display predicates; the backend stays the authority.
|
|
54
|
+
|
|
55
|
+
## Error presentation
|
|
56
|
+
|
|
57
|
+
`@mano8/astro-auth-m8/errors` exports `ApiError` plus `describeApiError(error, fallback)`, which maps the `fa-auth-m8` 2.0.0 authorization/rate-limit/retention error contracts to an operator-readable `{ title, description? }` (used by the `errorMessage` helper in the account registry blocks):
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { describeApiError } from "@mano8/astro-auth-m8/errors";
|
|
61
|
+
|
|
62
|
+
const { title, description } = describeApiError(error, "Update failed");
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`409` `last_superuser_required` is labelled (the raw token is never surfaced); `403` is titled by status (`Not permitted`) with the backend's own readable detail as the description, since several surfaces produce a `403` and the detail that distinguishes them is not a stable contract; `429` and `503` are distinguished (rate limited vs. an unknown outcome that must not be retried); `400` free-text detail (e.g. a purge's retention-floor rejection) is surfaced verbatim under a labelled heading rather than pattern-matched.
|
|
66
|
+
|
|
67
|
+
## Admin API-key and security surfaces (fa-auth-m8 2.0.0)
|
|
68
|
+
|
|
69
|
+
`@mano8/astro-auth-m8/api` and `@mano8/astro-auth-m8/hooks` wrap the five 2.0.0 admin routes:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { adminListUserApiKeys, adminRevokeApiKey, getAuditLog, purgeApiKeys, purgeAuditLog } from "@mano8/astro-auth-m8/api";
|
|
73
|
+
import { useAdminApiKeys, useAuditLog, useSecurityPurges } from "@mano8/astro-auth-m8/hooks";
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- `useAdminApiKeys(userId)` - superadmin-only list + revoke of another user's keys. Metadata only (`ApiKeyAdminPublic`, exported from `@mano8/astro-auth-m8/schemas`): adds `user_id` and a server-derived `status` (`active`/`revoked`/`expired`), omits `updated_at` - a distinct shape from the owner-facing `ApiKeyPublic`, never reused for it.
|
|
77
|
+
- `useAuditLog(params)` - the read-only privileged-action audit trail. Gate with `hasMinimumRole(role, "admin")`, not the superuser predicate: an admin sees only the rows it authored, a superadmin sees every row, and the split is decided server-side from the authenticated principal - the client never sends an actor id to widen or narrow it.
|
|
78
|
+
- `useSecurityPurges()` - both retention purges (`purgeAudit`, `purgeKeys`). The `window` is the closed enum `"1w" | "1m" | "3m" | "6m" | "1y"` (`RetentionWindowSchema`), never free text or a date. Gate with `hasSuperuserPrivileges`, a different predicate from the audit-log read. All three admin surfaces are rate limited: `429` means the action was not attempted (safe to retry later, never automatically); `503` means the outcome is *unknown* (do not retry); a purge's `400` is a free-text retention-floor rejection - see [Error presentation](#error-presentation) for how `describeApiError` maps all three.
|
|
79
|
+
|
|
80
|
+
`GET /security/superuser-probe` is deliberately not wrapped - it is the `security-tests-m8` harness canary, not a client surface. The four `/security/*` routes are excluded from the backend's OpenAPI schema (`include_in_schema=False`); their shapes here are recorded from the backend source and a live/tested response, not schema-generated.
|
|
81
|
+
|
|
82
|
+
The ready-made skin for both tiers is the `security-panel` registry item (see [Items](#items)); `AccountTab.minRole` on `account-dashboard` is how an admin-tier tab is declared in the account shell, alongside the existing superuser-only `superuserOnly`.
|
|
83
|
+
|
|
84
|
+
### Revocation signals
|
|
85
|
+
|
|
86
|
+
`PATCH /users/update/{id}/` answers with `revocation_enqueued`. When it is `true`, that user's sessions have already been revoked and an authorization-generation bump is propagating, so any client state describing its privileges is stale on arrival. `useUsers().update` therefore invalidates the affected auth caches (profile, sessions, API keys, that user's admin key list) and emits a revocation notification:
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import { AUTH_REVOCATION_EVENT, emitAuthRevocation } from "@mano8/astro-auth-m8/react";
|
|
90
|
+
|
|
91
|
+
// Only needed if you bypass `useUsers` with your own mutation layer.
|
|
92
|
+
emitAuthRevocation(updated.id);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
A mounted `AuthProvider` listens for it and, when the id is the signed-in principal's, re-reads the profile immediately rather than waiting for the next incidental `getProfile()`. It raises `loading` while doing so, so `RequireRole`/`RequireAuth` fall back instead of rendering privileged UI from superseded claims. Notifications for any other user id are ignored. The backend remains the authority; this only stops a stale client view outliving the change.
|
|
96
|
+
|
|
33
97
|
## Modes
|
|
34
98
|
|
|
35
99
|
- `headless`: exports typed schemas, API wrappers, token handling, React provider/hooks, and route helpers without injecting pages.
|
|
@@ -84,8 +148,11 @@ Install `@mano8/astro-auth-m8` from npm first, then consume the registry as a **
|
|
|
84
148
|
| `account-crud` | `npx shadcn add ./node_modules/@mano8/astro-auth-m8/registry/r/account-crud.json` | `button`, `dialog`, `alert-dialog`, `astro-ui-m8` data-table and toast | `lucide-react` | no |
|
|
85
149
|
| `api-keys-panel` | `npx shadcn add ./node_modules/@mano8/astro-auth-m8/registry/r/api-keys-panel.json` | `card`, `button`, `input`, `label`, `badge`, `dialog`, `account-crud`, `astro-ui-m8` data-table | `lucide-react`, `@tanstack/react-table` | **yes** (`useApiKeys`) |
|
|
86
150
|
| `admin-users-panel` | `npx shadcn add ./node_modules/@mano8/astro-auth-m8/registry/r/admin-users-panel.json` | `card`, `button`, `input`, `label`, `badge`, `dialog`, `account-crud`, `astro-ui-m8` data-table | `lucide-react`, `@tanstack/react-table` | **yes** (`RequireRole`, `useUsers`) |
|
|
151
|
+
| `security-panel` | `npx shadcn add ./node_modules/@mano8/astro-auth-m8/registry/r/security-panel.json` | `card`, `button`, `label`, `badge`, `account-crud`, `astro-ui-m8` data-table | `lucide-react`, `@tanstack/react-table` | **yes** (`RequireRole`, `useAuditLog`, `useSecurityPurges`) |
|
|
152
|
+
|
|
153
|
+
`dashboard-overview` is the landing view; `profile-panel`, `sessions-panel`, `api-keys-panel`, `admin-users-panel`, and `security-panel` are the secondary account tabs (drop them into `account-dashboard`'s `extraTabs`, or into your own shell). Each reads its headless logic straight from the package hooks - no local adapter layer - and takes its strings via `labels`. `api-keys-panel` and `admin-users-panel` use the canonical `astro-ui-m8` data-table with client-side search, sorting, pagination, column visibility, and row selection. Their shared `account-crud` dependency is installed automatically; it supplies the popup form, destructive-action confirmation, fixed row actions, and bottom-right toast host. `admin-users-panel` self-gates with `RequireRole superuser`.
|
|
87
154
|
|
|
88
|
-
`
|
|
155
|
+
`security-panel` carries both 2.0.0 admin tiers in one tab and gates them differently, mirroring the service: the audit log is behind `RequireRole roles={["admin"]}` (role hierarchy alone, so an admin sees its own surface and a superadmin is admitted too) and the two retention purges are behind `RequireRole superuser` (dual evidence). Each purge picks its window from the closed `RetentionWindowSchema` enum and runs only through a confirmation that names what is deleted and that a window below the service's retention floor is refused - the floor is server-side configuration published by no endpoint, so the service's rejection is surfaced verbatim instead of pre-validated. A `503` locks the purge control and reports the outcome as *unknown* until the operator explicitly acknowledges having checked, so the next click can never be a blind retry. Drop it into `account-dashboard`'s `extraTabs` with `minRole: "admin"`.
|
|
89
156
|
|
|
90
157
|
Files land under `src/components/fa-auth/` (the items' `target`), import shadcn primitives via `@/components/ui/*`, and pull headless logic from the installed package. The plugin package is intentionally **not** listed in registry item `dependencies`; install the published `@mano8/astro-auth-m8` package from npm yourself so shadcn only copies the skin files.
|
|
91
158
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;KAClD,CAAC;IACF,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,8BAA8B,CAAC;QAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY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AM,KAAK,MAAM,CAAC,CAAC;KAClD,CAAC;IACF,IAAI,CAAC,EAAE;QACL,SAAS,CAAC,EAAE,8BAA8B,CAAC;QAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAAC;QAC7C,MAAM,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;QAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IACF,2GAA2G;IAC3G,GAAG,CAAC,EAAE;QACJ,sGAAsG;QACtG,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,cAAc,CAAC;CACpB,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,OAAO,GAAE,kBAAuB,GAAG,gBAAgB,CAmDjF;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/src/integration.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function faAuth(options = {}) {
|
|
|
19
19
|
return {
|
|
20
20
|
name: "@mano8/astro-auth-m8",
|
|
21
21
|
hooks: {
|
|
22
|
-
"astro:config:setup": ({ injectRoute, addMiddleware, updateConfig }) => {
|
|
22
|
+
"astro:config:setup": ({ injectRoute, injectScript, addMiddleware, updateConfig }) => {
|
|
23
23
|
updateConfig({
|
|
24
24
|
vite: {
|
|
25
25
|
define: {
|
|
@@ -30,6 +30,8 @@ export default function faAuth(options = {}) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
|
+
injectScript?.("page", `import { installFaAuthBrowserAdapter } from "@mano8/astro-auth-m8/browser-adapter";` +
|
|
34
|
+
`installFaAuthBrowserAdapter(${JSON.stringify({ apiBase })});`);
|
|
33
35
|
if (mode === "starter" && (options.views?.strategy ?? "package") !== "none") {
|
|
34
36
|
for (const [name, pattern] of Object.entries(routes)) {
|
|
35
37
|
if (!pattern)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAA2B,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAuB,MAAM,cAAc,CAAC;AAsCvE,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,yCAAyC;IAChD,MAAM,EAAE,0CAA0C;IAClD,MAAM,EAAE,0CAA0C;IAClD,QAAQ,EAAE,4CAA4C;IACtD,OAAO,EAAE,2CAA2C;CAC5C,CAAC;AAEX,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,UAA8B,EAAE;IAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,UAAU,CAAC;IACxC,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC;IAE3C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,KAAK,KAAK,CAAC;IAClD,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAC7D,MAAM,SAAS,GAAG,UAAU,IAAI,gBAAgB;QAC9C,CAAC,CAAC,kBAAkB,CAAC,OAAO,E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"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type ApiKeyCreate, type ApiKeyCreated, type ApiKeyPublic, type Message } from "../schemas.js";
|
|
1
|
+
import { type ApiKeyCreate, type ApiKeyCreated, type ApiKeyPublic, type ApiKeysAdminPublic, type Message } from "../schemas.js";
|
|
2
2
|
export declare function listApiKeys(): Promise<ApiKeyPublic[]>;
|
|
3
3
|
export declare function createApiKey(body: ApiKeyCreate): Promise<ApiKeyCreated>;
|
|
4
4
|
export declare function getApiKey(id: string): Promise<ApiKeyPublic>;
|
|
5
5
|
export declare function revokeApiKey(id: string): Promise<Message>;
|
|
6
6
|
export declare function verifyApiKey(apiKey: string): Promise<ApiKeyPublic>;
|
|
7
|
+
export declare function adminListUserApiKeys(userId: string): Promise<ApiKeysAdminPublic>;
|
|
8
|
+
export declare function adminRevokeApiKey(keyId: string): Promise<Message>;
|
|
7
9
|
//# sourceMappingURL=apiKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeys.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/apiKeys.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"apiKeys.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/apiKeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAoF,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAKlN,wBAAgB,WAAW,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAErD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAEvE;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAE3D;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEzD;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAQlE;AAID,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAEhF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { request } from "../client.js";
|
|
2
|
-
import { ApiKeyCreatedSchema, ApiKeyPublicSchema, MessageSchema } from "../schemas.js";
|
|
2
|
+
import { ApiKeyCreatedSchema, ApiKeyPublicSchema, ApiKeysAdminPublicSchema, MessageSchema } from "../schemas.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
const ApiKeysSchema = z.array(ApiKeyPublicSchema);
|
|
5
5
|
export function listApiKeys() {
|
|
@@ -23,4 +23,12 @@ export function verifyApiKey(apiKey) {
|
|
|
23
23
|
skipRefresh: true
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
+
// Limited superadmin surface (AA-13, AA-17): list + revoke any user's keys,
|
|
27
|
+
// metadata only — never the raw or hashed key. No create/edit path exists.
|
|
28
|
+
export function adminListUserApiKeys(userId) {
|
|
29
|
+
return request({ method: "GET", path: `/api-keys/by-user/${encodeURIComponent(userId)}/`, schema: ApiKeysAdminPublicSchema, auth: true });
|
|
30
|
+
}
|
|
31
|
+
export function adminRevokeApiKey(keyId) {
|
|
32
|
+
return request({ method: "POST", path: `/api-keys/revoke/${encodeURIComponent(keyId)}/`, schema: MessageSchema, auth: true });
|
|
33
|
+
}
|
|
26
34
|
//# sourceMappingURL=apiKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiKeys.js","sourceRoot":"","sources":["../../../../src/runtime/api/apiKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO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,YAAY,CAAC,MAAc;IACzC,OAAO,OAAO,CAAC;QACb,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE;QAChC,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;AACL,CAAC;AAED,4EAA4E;AAC5E,2EAA2E;AAC3E,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,wBAAwB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5I,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,kBAAkB,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAChI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/runtime/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type Health, type Jwks } from "../schemas.js";
|
|
1
|
+
import { type Health, type Jwks, type ServiceMeta } from "../schemas.js";
|
|
2
2
|
export declare function getAuthHealth(): Promise<Health>;
|
|
3
3
|
export declare function getJwks(): Promise<Jwks>;
|
|
4
|
+
export declare function getServiceMeta(): Promise<ServiceMeta>;
|
|
4
5
|
//# sourceMappingURL=ops.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/ops.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/ops.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEtH,wBAAgB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAE/C;AAED,wBAAgB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAEvC;AAID,wBAAgB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAErD"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { request } from "../client.js";
|
|
2
|
-
import { HealthSchema, JwksSchema } from "../schemas.js";
|
|
2
|
+
import { HealthSchema, JwksSchema, ServiceMetaSchema } from "../schemas.js";
|
|
3
3
|
export function getAuthHealth() {
|
|
4
4
|
return request({ method: "GET", path: "/health/", schema: HealthSchema, skipRefresh: true });
|
|
5
5
|
}
|
|
6
6
|
export function getJwks() {
|
|
7
7
|
return request({ method: "GET", path: "/.well-known/jwks.json", schema: JwksSchema, skipRefresh: true });
|
|
8
8
|
}
|
|
9
|
+
// Public, unauthenticated (AA-16/AA-22): backs the compatibility preflight
|
|
10
|
+
// wired into installFaAuthBrowserAdapter (T11).
|
|
11
|
+
export function getServiceMeta() {
|
|
12
|
+
return request({ method: "GET", path: "/meta", schema: ServiceMetaSchema, skipRefresh: true });
|
|
13
|
+
}
|
|
9
14
|
//# sourceMappingURL=ops.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/runtime/api/ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/runtime/api/ops.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAA4C,MAAM,eAAe,CAAC;AAEtH,MAAM,UAAU,aAAa;IAC3B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3G,CAAC;AAED,2EAA2E;AAC3E,gDAAgD;AAChD,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type PrivilegedActionAuditsPublic, type PurgeRequest, type PurgeResponse } from "../schemas.js";
|
|
2
|
+
export declare function getAuditLog(params?: {
|
|
3
|
+
skip?: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
}): Promise<PrivilegedActionAuditsPublic>;
|
|
6
|
+
export declare function purgeAuditLog(body: PurgeRequest): Promise<PurgeResponse>;
|
|
7
|
+
export declare function purgeApiKeys(body: PurgeRequest): Promise<PurgeResponse>;
|
|
8
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/security.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,4BAA4B,EACjC,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAQvB,wBAAgB,WAAW,CAAC,MAAM,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAQjH;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAExE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAEvE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { request } from "../client.js";
|
|
2
|
+
import { PrivilegedActionAuditsPublicSchema, PurgeResponseSchema } from "../schemas.js";
|
|
3
|
+
// Wraps the three `/security/*` admin surfaces (AA-13, AA-19, AA-20).
|
|
4
|
+
// `GET /security/superuser-probe` is deliberately not wrapped — it is the
|
|
5
|
+
// security-tests-m8 harness canary, not a client surface. All three routes
|
|
6
|
+
// are `include_in_schema=False` on the backend, so fixtures for these must
|
|
7
|
+
// come from a recorded live/tested response, not the OpenAPI document.
|
|
8
|
+
export function getAuditLog(params = {}) {
|
|
9
|
+
return request({
|
|
10
|
+
method: "GET",
|
|
11
|
+
path: "/security/audit-log",
|
|
12
|
+
query: { skip: params.skip ?? 0, limit: params.limit ?? 100 },
|
|
13
|
+
schema: PrivilegedActionAuditsPublicSchema,
|
|
14
|
+
auth: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function purgeAuditLog(body) {
|
|
18
|
+
return request({ method: "POST", path: "/security/audit-log/purge", body, schema: PurgeResponseSchema, auth: true });
|
|
19
|
+
}
|
|
20
|
+
export function purgeApiKeys(body) {
|
|
21
|
+
return request({ method: "POST", path: "/security/api-keys/purge", body, schema: PurgeResponseSchema, auth: true });
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../../../src/runtime/api/security.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,kCAAkC,EAClC,mBAAmB,EAIpB,MAAM,eAAe,CAAC;AAEvB,sEAAsE;AACtE,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AAEvE,MAAM,UAAU,WAAW,CAAC,SAA4C,EAAE;IACxE,OAAO,OAAO,CAAC;QACb,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,EAAE;QAC7D,MAAM,EAAE,kCAAkC;QAC1C,IAAI,EAAE,IAAI;KACX,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAkB;IAC9C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,2BAA2B,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACvH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAkB;IAC7C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type Message, type UserCreate, type UserPublic, type UserRegister, type UserUpdate, type UsersPublic } from "../schemas.js";
|
|
1
|
+
import { type Message, type UserAuthorizationUpdate, type UserCreate, type UserPublic, type UserRegister, type UserUpdate, type UsersPublic } from "../schemas.js";
|
|
2
2
|
export declare function listUsers(skip?: number, limit?: number): Promise<UsersPublic>;
|
|
3
3
|
export declare function createUser(body: UserCreate): Promise<UserPublic>;
|
|
4
4
|
export declare function signupUser(body: UserRegister): Promise<UserPublic>;
|
|
5
5
|
export declare function getUser(id: string): Promise<UserPublic>;
|
|
6
|
-
export declare function updateUser(id: string, body: UserUpdate): Promise<
|
|
6
|
+
export declare function updateUser(id: string, body: UserUpdate): Promise<UserAuthorizationUpdate>;
|
|
7
7
|
export declare function deleteUser(id: string): Promise<Message>;
|
|
8
8
|
//# sourceMappingURL=users.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/users.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../../src/runtime/api/users.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,wBAAgB,SAAS,CAAC,IAAI,SAAI,EAAE,KAAK,SAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAErE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAEhE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAElE;AAED,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAEvD;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAEzF;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEvD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { request } from "../client.js";
|
|
2
|
-
import { MessageSchema, UserPublicSchema, UsersPublicSchema } from "../schemas.js";
|
|
2
|
+
import { MessageSchema, UserAuthorizationUpdateSchema, UserPublicSchema, UsersPublicSchema } from "../schemas.js";
|
|
3
3
|
export function listUsers(skip = 0, limit = 100) {
|
|
4
4
|
return request({ method: "GET", path: "/users/", query: { skip, limit }, schema: UsersPublicSchema, auth: true });
|
|
5
5
|
}
|
|
@@ -13,7 +13,7 @@ export function getUser(id) {
|
|
|
13
13
|
return request({ method: "GET", path: `/users/get/${encodeURIComponent(id)}/`, schema: UserPublicSchema, auth: true });
|
|
14
14
|
}
|
|
15
15
|
export function updateUser(id, body) {
|
|
16
|
-
return request({ method: "PATCH", path: `/users/update/${encodeURIComponent(id)}/`, body, schema:
|
|
16
|
+
return request({ method: "PATCH", path: `/users/update/${encodeURIComponent(id)}/`, body, schema: UserAuthorizationUpdateSchema, auth: true });
|
|
17
17
|
}
|
|
18
18
|
export function deleteUser(id) {
|
|
19
19
|
return request({ method: "DELETE", path: `/users/delete/${encodeURIComponent(id)}/`, schema: MessageSchema, auth: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../../src/runtime/api/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../../../src/runtime/api/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,aAAa,EACb,6BAA6B,EAC7B,gBAAgB,EAChB,iBAAiB,EAQlB,MAAM,eAAe,CAAC;AAEvB,MAAM,UAAU,SAAS,CAAC,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG;IAC7C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACpH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAkB;IAC3C,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACzG,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,EAAU;IAChC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACzH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,IAAgB;IACrD,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,6BAA6B,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AACjJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EAAU;IACnC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5H,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser notifications the auth runtime uses to tell a mounted `AuthProvider`
|
|
3
|
+
* about an authorization change that did not originate from it.
|
|
4
|
+
*
|
|
5
|
+
* Kept in a plain runtime module rather than the provider component so the
|
|
6
|
+
* headless hook layer can announce one without importing React UI code, and so
|
|
7
|
+
* a consumer with its own mutation layer can announce one too (re-exported from
|
|
8
|
+
* `@mano8/astro-auth-m8/react`).
|
|
9
|
+
*/
|
|
10
|
+
export declare const AUTH_REVOCATION_EVENT = "fa-auth-m8:revocation";
|
|
11
|
+
export type AuthRevocationDetail = {
|
|
12
|
+
userId: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Announce that `fa-auth-m8` answered an authorization change with
|
|
16
|
+
* `revocation_enqueued: true` for `userId` (AA-11): that principal's sessions
|
|
17
|
+
* have been revoked and its authorization generation is being bumped, so any
|
|
18
|
+
* client state describing its privileges is already stale.
|
|
19
|
+
*
|
|
20
|
+
* This is a notification, not a decision - each listener judges whether the id
|
|
21
|
+
* concerns it, and the backend stays the authority either way. No-op outside a
|
|
22
|
+
* browser.
|
|
23
|
+
*/
|
|
24
|
+
export declare function emitAuthRevocation(userId: string): void;
|
|
25
|
+
//# sourceMappingURL=authEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authEvents.d.ts","sourceRoot":"","sources":["../../../src/runtime/authEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAKvD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser notifications the auth runtime uses to tell a mounted `AuthProvider`
|
|
3
|
+
* about an authorization change that did not originate from it.
|
|
4
|
+
*
|
|
5
|
+
* Kept in a plain runtime module rather than the provider component so the
|
|
6
|
+
* headless hook layer can announce one without importing React UI code, and so
|
|
7
|
+
* a consumer with its own mutation layer can announce one too (re-exported from
|
|
8
|
+
* `@mano8/astro-auth-m8/react`).
|
|
9
|
+
*/
|
|
10
|
+
export const AUTH_REVOCATION_EVENT = "fa-auth-m8:revocation";
|
|
11
|
+
/**
|
|
12
|
+
* Announce that `fa-auth-m8` answered an authorization change with
|
|
13
|
+
* `revocation_enqueued: true` for `userId` (AA-11): that principal's sessions
|
|
14
|
+
* have been revoked and its authorization generation is being bumped, so any
|
|
15
|
+
* client state describing its privileges is already stale.
|
|
16
|
+
*
|
|
17
|
+
* This is a notification, not a decision - each listener judges whether the id
|
|
18
|
+
* concerns it, and the backend stays the authority either way. No-op outside a
|
|
19
|
+
* browser.
|
|
20
|
+
*/
|
|
21
|
+
export function emitAuthRevocation(userId) {
|
|
22
|
+
if (typeof window === "undefined")
|
|
23
|
+
return;
|
|
24
|
+
window.dispatchEvent(new CustomEvent(AUTH_REVOCATION_EVENT, { detail: { userId } }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=authEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authEvents.js","sourceRoot":"","sources":["../../../src/runtime/authEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAI7D;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,CAAC,aAAa,CAClB,IAAI,WAAW,CAAuB,qBAAqB,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,CACrF,CAAC;AACJ,CAAC"}
|