@adonis-agora/authkit-react 0.25.2 → 1.0.0-rc.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 +678 -0
- package/README.md +29 -19
- package/build/index.d.ts +7 -18
- package/build/index.js +4 -9
- package/build/src/client/client.d.ts +12 -21
- package/build/src/client/client.js +7 -15
- package/build/src/client/types.d.ts +39 -7
- package/build/src/components/authorized_apps.js +17 -13
- package/build/src/components/last_used_badge.d.ts +288 -0
- package/build/src/components/last_used_badge.js +10 -0
- package/build/src/components/organization_profile.js +31 -39
- package/build/src/components/organization_switcher.js +25 -9
- package/build/src/components/user_profile.js +13 -7
- package/build/src/config.d.ts +0 -6
- package/build/src/config.js +0 -12
- package/build/src/hooks/use_resource.d.ts +0 -8
- package/build/src/hooks/use_resource.js +0 -22
- package/build/src/interaction/last_used.d.ts +2 -0
- package/build/src/interaction/last_used.js +5 -0
- package/build/src/queries/account/index.d.ts +11 -1
- package/build/src/queries/account/index.js +14 -0
- package/build/src/queries/admin/index.d.ts +6 -21
- package/build/src/queries/keys.d.ts +1 -0
- package/build/src/queries/keys.js +1 -0
- package/package.json +11 -10
- package/skills/authkit-react-auth/SKILL.md +39 -22
- package/styles.css +12 -0
- package/build/src/hooks/use_authorized_apps.d.ts +0 -16
- package/build/src/hooks/use_authorized_apps.js +0 -15
- package/build/src/hooks/use_org_invitations.d.ts +0 -19
- package/build/src/hooks/use_org_invitations.js +0 -20
- package/build/src/hooks/use_organization.d.ts +0 -23
- package/build/src/hooks/use_organization.js +0 -10
- package/build/src/hooks/use_organizations.d.ts +0 -18
- package/build/src/hooks/use_organizations.js +0 -14
- package/build/src/hooks/use_profile.d.ts +0 -13
- package/build/src/hooks/use_profile.js +0 -32
- package/build/src/hooks/use_sessions.d.ts +0 -16
- package/build/src/hooks/use_sessions.js +0 -15
- package/build/src/hooks/use_switch_organization.d.ts +0 -7
- package/build/src/hooks/use_switch_organization.js +0 -42
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
# @adonis-agora/authkit-react
|
|
2
|
+
|
|
3
|
+
## 1.0.0-rc.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#436](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/436) [`c942fe3`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/c942fe30483346217c9c89112e13db0d4a65c647) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - AuthKit 1.0. See the [Migrating to 1.0](https://github.com/DavideCarvalho/adonis-agora-authkit/blob/main/apps/docs/content/docs/migrating-to-1-0.mdx) guide.
|
|
8
|
+
|
|
9
|
+
Breaking changes (`@adonis-agora/authkit-server`):
|
|
10
|
+
|
|
11
|
+
- `withMfa` is removed. MFA state lives in the lib-owned `auth_mfa` table, so drop the mixin from your `AuthUser` model's `compose(...)`.
|
|
12
|
+
- `markSudo` is no longer exported. Grant sudo with `completeSudo(sudoContextFrom(ctx), methodId)`, which also writes the `sudo.confirmed` audit event, remembers the method and redirects to the validated `return_to`.
|
|
13
|
+
- The email-change confirmation link is sent through `mail.onEmailChangeConfirm` only. Without it, AuthKit sends its built-in email; `onEmailVerification` no longer receives email-change confirmations.
|
|
14
|
+
- The `clients` option of `defineConfig` is removed. Create clients in the admin console, through the Admin API or with `node ace authkit:clients:create` (new `--client-secret` flag keeps an existing secret). `buildImpersonationPanel(cfg, targetId, clients)` now requires `clients`, and the impersonation curl always shows the `<CLIENT_SECRET>` placeholder.
|
|
15
|
+
- `inertiaRenderer({ prefix, views })`: `views` is required. Screens not listed render with the built-in Edge view. `AuthkitScreen` is now the exact union of the screens AuthKit renders (adds `throttled`, `agents/consent`, `agents/done`; no arbitrary strings), and every screen's props are exported: `AuthkitScreenProps['<view>']` plus named types (`LoginProps`, `SessionExpiredProps`, …). The controllers are checked against them. Hosts declare screens of their own by augmenting `AuthkitScreenProps` (`declare module '@adonis-agora/authkit-server'`).
|
|
16
|
+
- The Admin API client body reads `grantTypes` only; the `grants` alias is gone (responses still return `grants`).
|
|
17
|
+
- `lucidAccountStore` always mounts password history over the model's connection (`auth_password_history`).
|
|
18
|
+
- `/account/orgs/json`, `/account/orgs/invitations/json` and `/account/orgs/:id/json` are removed; use `/account/api/orgs/*`.
|
|
19
|
+
- `GET /account/api/apps` entries gain `name` and `logoUrl`.
|
|
20
|
+
|
|
21
|
+
- The admin console reads its config from a `<script type="application/json" id="authkit-admin-config">` data block (CSP-safe) instead of an inline `window.__AUTHKIT__` script; the dev fallback is gone.
|
|
22
|
+
- The admin client DTO returns `grantTypes` (was `grants`), plus `clientName` and `logoUri`, which the console and the Admin API can now set (`null` removes them, as it does `backchannelLogoutUri`). `GET {admin}/api/clients/:id` exists.
|
|
23
|
+
- Anonymous JSON callers of the admin and account JSON APIs get `401` (and `403` without an admin role) instead of a redirect to the login page.
|
|
24
|
+
- Fixes: the Redis adapter's `list()` honours the connection `keyPrefix` (sessions, apps and admin lists were empty); a password login posted without a password is an invalid-credentials answer, not a 500.
|
|
25
|
+
|
|
26
|
+
Breaking changes (`@adonis-agora/authkit-core`):
|
|
27
|
+
|
|
28
|
+
- `ClientConfig` and `ResolvedAuthServerConfig.clients` are removed.
|
|
29
|
+
|
|
30
|
+
Breaking changes (`@adonis-agora/authkit-client`):
|
|
31
|
+
|
|
32
|
+
- `@adonisjs/auth` is a required peer. `ctx.auth` is `@adonisjs/auth`, backed by the AuthKit session through `authkitClientGuard`; `ctx.authkit` (from `authkit_context_middleware`) carries the AuthKit-only data (identity, `hasGlobalRole`, active org, `toSharedProps`).
|
|
33
|
+
- `authkit_middleware`, `auth_middleware` and `silent_auth_middleware` (and their subpaths) are removed: `ctx.auth` comes from `@adonisjs/auth`, and `middleware.auth()` / `silentAuth` are the `#middleware/auth_middleware` / `#middleware/silent_auth_middleware` files `node ace configure` publishes. `require_org_middleware` stays. `@adonis-agora/authkit-client/types` no longer declares `HttpContext.auth`; type `ctx.authkit.getUser()` through the `AuthkitUserType` interface.
|
|
34
|
+
- `node ace configure @adonis-agora/authkit-client` installs `@adonisjs/auth` when missing (`--no-install` prints the command), writes `config/auth.ts` with `authkitClientGuard` + `sessionUserProvider` (`--model`, default `#models/user`; an existing file is left alone and the guard to add is printed), registers `@adonisjs/auth/auth_provider`, `initialize_auth_middleware` + `authkit_context_middleware`, and publishes the named `auth` / `silentAuth` middleware.
|
|
35
|
+
- `authkitClientGuard` takes its user from `resolveUser` when one is configured (so `lucidMirror` provisions the row on first login, and what it loads is on `ctx.auth.user`, the same instance as `ctx.authkit.getUser()`), with the provider as the fallback.
|
|
36
|
+
- New `authkitIdentityProvider()`: a user provider with no database; `ctx.auth.user` is the AuthKit `Identity`.
|
|
37
|
+
- New `authkitClientGuard({ provider, resolver })` option: a per-guard resolver for API routes (bearer JWT, opaque, PAT).
|
|
38
|
+
- `resolvers.jwt({ tokenSource: 'bearer' })` accepts `Authorization: DPoP <jwt>` with a valid `DPoP` proof for `cnf.jkt`-bound tokens, and refuses DPoP-bound tokens sent as `Bearer`.
|
|
39
|
+
- `UnauthorizedAccessConstructor` is no longer exported, and `AuthkitClientGuard` no longer takes an exception class; it always throws `@adonisjs/auth`'s `E_UNAUTHORIZED_ACCESS`.
|
|
40
|
+
|
|
41
|
+
Breaking changes (`@adonis-agora/authkit-sdk`):
|
|
42
|
+
|
|
43
|
+
- `clients.*` return `grantTypes` (was `grants`), plus `clientName` and `logoUri`.
|
|
44
|
+
|
|
45
|
+
Breaking changes (`@adonis-agora/authkit-react`):
|
|
46
|
+
|
|
47
|
+
- `createAuthkitClient()` no longer reads `window.__AUTHKIT__`: pass `baseUrl` for `client.admin.*` and `csrfToken`.
|
|
48
|
+
- Admin response types match the server: `users.remove` / `clients.remove` → `{ ok, deleted }`, `users.resetPassword` → `{ ok, email }`, `users.disable` / `enable` → the user, `SettingListResult.locked`; `AdminClient.grants` → `grantTypes` (+ `clientName`, `logoUri`); `UpdateUserInput` is `{ globalRoles? }`, `CreateUserInput` takes no `null`.
|
|
49
|
+
- New: `client.account.agents.list()` / `revoke()`, `useAccountAgentsQueryOptions`, `useRevokeAccountAgentMutationOptions`.
|
|
50
|
+
- Peers: `react` / `react-dom` `^19.0.0`, `@inertiajs/react` `^2.0.0 || ^3.0.0`.
|
|
51
|
+
|
|
52
|
+
- `useProfile`, `useSessions`, `useAuthorizedApps`, `useOrganizations`, `useOrganization`, `useOrgInvitations`, `useSwitchOrganization` and their types are removed, with the `profile`, `sessions`, `apps`, `orgs` and `orgInvitations` keys of `endpoints`. Use the query options (`useMeQueryOptions`, `useAccountSessionsQueryOptions`, `useAppsQueryOptions`, `useAccountOrgsQueryOptions`, …).
|
|
53
|
+
- `UserProfile`, `AuthorizedApps`, `OrganizationSwitcher` and `OrganizationProfile` need `QueryClientProvider` and `AuthkitClientProvider`.
|
|
54
|
+
|
|
55
|
+
All packages:
|
|
56
|
+
|
|
57
|
+
- `@adonis-agora/*` peer ranges accept 1.x and its release candidates (`<2.0.0 || >=1.0.0-rc.0 <2.0.0`): `durable`, `media`, `telescope` (authkit-server), `resilience` (authkit-client), `authkit-server` (authkit-sdk).
|
|
58
|
+
- Node.js `>=24` is required (tested on 24 and 26).
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- Updated dependencies [[`c942fe3`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/c942fe30483346217c9c89112e13db0d4a65c647)]:
|
|
63
|
+
- @adonis-agora/authkit-core@1.0.0-rc.0
|
|
64
|
+
|
|
65
|
+
## 0.26.0
|
|
66
|
+
|
|
67
|
+
### Minor Changes
|
|
68
|
+
|
|
69
|
+
- [#369](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/369) [`431e9aa`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/431e9aa99fb1b28e4f0d9ceeac1f3d15f9f7106e) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - "Last used" badge on the login screen. The server remembers, in a cookie on the device (`authkit_last_login`, httpOnly, no identity in it), the primary method the last login used — password, magic link, email code, passkey, a social provider or a custom method — and passes it as `lastUsedLoginMethod` to every `login` render. The built-in Edge screen marks the matching button; Inertia hosts use the new `<LastUsedBadge>` / `isLastUsedLoginMethod()` from authkit-react. It is per device on purpose: a per-account hint would tell anyone who types an email how that account signs in. Opt out with `login: { lastUsedMethod: false }`.
|
|
70
|
+
|
|
71
|
+
Also fixes cookies written during the final login request being dropped: `interactionFinished` ends the raw response before AdonisJS flushes its headers, so `completeLogin` now relays pending `Set-Cookie` headers first. This affected the "trust this device" cookie set after a successful second factor.
|
|
72
|
+
|
|
73
|
+
## 0.25.2
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- [#368](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/368) [`b7870c2`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/b7870c2bbd0fbdc347b91eb585f70e76a7c27143) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - feat(admin): roles are read-only in the console and the Admin API when they come from outside authkit.
|
|
78
|
+
|
|
79
|
+
With `resolveTokenRoles` configured (roles kept in `@adonis-agora/authz` or the host's own table), `globalRoles` decides nothing, but the console and `PATCH /users/:id` still wrote to it and answered "saved". Now:
|
|
80
|
+
|
|
81
|
+
- User DTOs (console and Admin API) carry `roles`: the effective roles from `resolveAccountRoles`, the same source as the `roles` claim. Without the hook it equals `globalRoles`. `globalRoles` keeps meaning the stored column.
|
|
82
|
+
- Editing roles answers `409 roles_managed_externally` (console `PATCH /api/users/:id/roles`, Admin API `PATCH /users/:id` with `globalRoles`). Other fields stay editable.
|
|
83
|
+
- The console shows the effective roles as read-only, with a note that the application manages them (`features.rolesManagedExternally` in the injected config).
|
|
84
|
+
- `AdminUser.roles?: string[]` in `@adonis-agora/authkit-react`.
|
|
85
|
+
|
|
86
|
+
Hosts without `resolveTokenRoles` keep editing `globalRoles` as before.
|
|
87
|
+
|
|
88
|
+
## 0.25.1
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- [#361](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/361) [`1b9c90c`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/1b9c90ced4356d2c754e850e307954455ddeeb3a) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Performance: smaller bundles and fewer re-renders.
|
|
93
|
+
|
|
94
|
+
- The package declares `"sideEffects": ["*.css"]`, so bundlers drop the modules an app doesn't import. A bundle that imports only `useAuth` went from 3.1 kB to 0.8 kB minified. `styles.css` is still kept as a side effect.
|
|
95
|
+
- `AuthkitProvider` memoizes the resolved config on the `config` prop, and `AuthkitClientProvider` memoizes the client it creates on the `client`/`opts` props. Before, each render of these providers produced a new context value, which re-rendered every consumer.
|
|
96
|
+
- Updated dependencies [[`1b9c90c`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/1b9c90ced4356d2c754e850e307954455ddeeb3a)]:
|
|
97
|
+
- @adonis-agora/authkit-core@0.10.1
|
|
98
|
+
|
|
99
|
+
## 0.25.0
|
|
100
|
+
|
|
101
|
+
### Minor Changes
|
|
102
|
+
|
|
103
|
+
- [#269](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/269) [`b0ca480`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/b0ca4802419aba93a9f913775f697cc4075cff88) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Drop Node 20, which reached end-of-life on 2026-04-30, and Node 22, which AdonisJS 7 does not support (it requires Node >=24): `engines.node` is now `>=24`. The supported Node lines are 24 and 26, and CI runs the test suite on each of them.
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- Updated dependencies [[`b0ca480`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/b0ca4802419aba93a9f913775f697cc4075cff88)]:
|
|
108
|
+
- @adonis-agora/authkit-core@0.10.0
|
|
109
|
+
|
|
110
|
+
## 0.24.1
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- [#255](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/255) [`481051c`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/481051c86c67b2bf5026f7a49028d260236667c9) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Publish peer dependencies as ranges again (`^7.5.0` instead of `7.5.0`, etc.). A Renovate pinning pass had turned the peer catalogs into exact versions, so any upstream patch release (e.g. `@adonisjs/core` 7.5.1) fell outside the accepted peer range.
|
|
115
|
+
|
|
116
|
+
## 0.24.0
|
|
117
|
+
|
|
118
|
+
### Minor Changes
|
|
119
|
+
|
|
120
|
+
- [#247](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/247) [`eba2f4d`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/eba2f4dc886cf9596a451539cff9ecce5bf6830c) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Admin console: a **Personal agents** page (PACT and Poppy). Lists every agent with its live
|
|
121
|
+
connection count, lists and revokes connections across all accounts, and allows or blocks agents
|
|
122
|
+
at runtime on top of `defineConfig` (lib-owned `auth_agent_registry` table). Blocking also revokes
|
|
123
|
+
every connection and ends the agent's Poppy sessions. Writes need sudo and are audited.
|
|
124
|
+
`@adonis-agora/authkit-react` gets the matching `client.admin.personalAgents.*` methods and query
|
|
125
|
+
options.
|
|
126
|
+
|
|
127
|
+
## 0.23.0
|
|
128
|
+
|
|
129
|
+
### Minor Changes
|
|
130
|
+
|
|
131
|
+
- [#233](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/233) [`94644e6`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/94644e6b1d8d10e0fd3c4b57706cce46b70412cb) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `applicationType?: 'web' | 'native'` nos tipos de client
|
|
132
|
+
|
|
133
|
+
`ClientConfig` (core) e `AdminClient`/`CreateClientInput` (react) ganham o campo opcional
|
|
134
|
+
`applicationType`, para os clientes nativos (RFC 8252) do `@adonis-agora/authkit-server`.
|
|
135
|
+
|
|
136
|
+
### Patch Changes
|
|
137
|
+
|
|
138
|
+
- Updated dependencies [[`94644e6`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/94644e6b1d8d10e0fd3c4b57706cce46b70412cb)]:
|
|
139
|
+
- @adonis-agora/authkit-core@0.9.0
|
|
140
|
+
|
|
141
|
+
## 0.22.0
|
|
142
|
+
|
|
143
|
+
### Minor Changes
|
|
144
|
+
|
|
145
|
+
- [#223](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/223) [`6adae6d`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/6adae6dff8cf9d81892a0377ee25395bf36b632f) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - feat(authkit-react): client e hooks para as escritas de conta (orgs + segundo fator)
|
|
146
|
+
|
|
147
|
+
Lado React do espelho JSON de `/account/api/*`, para telas do próprio host.
|
|
148
|
+
|
|
149
|
+
- `client.account.orgs` ganha `create`, `activate`, `deactivate`, `leave`, `invite`,
|
|
150
|
+
`revokeInvitation`, `updateMemberRole`, `removeMember` e `acceptInvitation`.
|
|
151
|
+
- `client.account.mfa` vira uma FUNÇÃO COM PROPRIEDADES: `mfa()` continua sendo a leitura do
|
|
152
|
+
status (assinatura preservada) e as escritas penduram nela — `mfa.enroll()`,
|
|
153
|
+
`mfa.confirm(code)`, `mfa.disable()`, `mfa.regenerateRecoveryCodes()` e
|
|
154
|
+
`mfa.passkeys.{options,verify}`.
|
|
155
|
+
- Hooks novos: `useAccount{Create,Activate,Deactivate,Leave}OrgMutationOptions`,
|
|
156
|
+
`useAccount{InviteOrgMember,RevokeOrgInvitation,AcceptOrgInvitation,UpdateOrgMemberRole,RemoveOrgMember}MutationOptions`,
|
|
157
|
+
`use{Enroll,Confirm,Disable}TotpMutationOptions`,
|
|
158
|
+
`useRegenerateRecoveryCodesMutationOptions` e `useRegisterPasskeyMutationOptions`. O
|
|
159
|
+
prefixo `useAccount…` nos de org evita colidir com os homônimos da superfície ADMIN, que
|
|
160
|
+
agem sobre qualquer org.
|
|
161
|
+
- `registerPasskeyJson(client, deps?)`: a cerimônia de registro de passkey inteira por
|
|
162
|
+
fetch (options → `startRegistration` → verify), o par headless do `usePasskeyRegistration`
|
|
163
|
+
(que é por form de página inteira e não muda). Sem React, para quem não usa TanStack.
|
|
164
|
+
- `authkitKeys.account.mutations.*`: as chaves das novas mutations, com prefixos `orgs()` e
|
|
165
|
+
`mfa()` para `useIsMutating`.
|
|
166
|
+
- `AccountMfaStatus.recovery` ganha `remaining` e `regenerable`.
|
|
167
|
+
|
|
168
|
+
## 0.21.0
|
|
169
|
+
|
|
170
|
+
### Minor Changes
|
|
171
|
+
|
|
172
|
+
- 9231887: **BREAKING (0.x minor):** todas as listagens paginadas do authkit passam a usar `{ page, size }` no lugar de `{ page, limit }` (e de `perPage`, na API do console), alinhando a interface de paginação com `@adonis-agora/filter` e com o restante do ecossistema `@adonis-agora/*`. `page` continua **1-based** com default `1`; `limit` foi apenas **renomeado** para `size` — a semântica (itens por página) não mudou. O casamento com `@adonis-agora/filter` é **estrutural** de propósito: nenhum pacote passa a depender dele.
|
|
173
|
+
|
|
174
|
+
Na **resposta**, as mesmas listagens passam a devolver o envelope `{ meta, data }` — com `page`, `size` e `total` dentro de `meta` — no lugar do antigo shape achatado `{ data, total, page, size }`. `meta` é a convenção do próprio `.paginate()` do Lucid (`{ meta, data }`), que é onde o caminho por offset de `@adonis-agora/filter` desemboca, e agora é o envelope de TODAS as listagens paginadas do ecossistema `@adonis-agora/*`.
|
|
175
|
+
|
|
176
|
+
Junto vem um **teto de `size`** que antes não existia de forma unificada: toda borda HTTP (Admin REST API e API JSON do console) agora corta `size` em `ADMIN_LIST_MAX_SIZE` (200), e as varreduras internas usam `ADMIN_LIST_DEFAULT_SIZE` (100) em vez de um `100` hardcoded por serviço.
|
|
177
|
+
|
|
178
|
+
### O que mudou
|
|
179
|
+
|
|
180
|
+
- **Wire HTTP** — `GET {adminApi}/users`, `GET {adminApi}/audit`, `GET {consolePrefix}/api/users` e `GET {consolePrefix}/api/audit` leem `?page=&size=` (antes `?page=&limit=`; o de usuários do console lia `?perPage=`) e respondem `{ meta: { page, size, total }, data }` (antes `{ data, total, page, size }` achatado). Endpoints de listagem NÃO paginados (`/clients`, `/settings`, `/organizations`, `/roles`, `/sessions`) continuam como estão — eles nunca tiveram metadados de paginação e não ganham envelope agora.
|
|
181
|
+
- **Tipos do servidor** — `ListAccountsParams.limit` → `.size` e `ListAuditParams.limit` → `.size`. Stores de conta e sinks de auditoria customizados precisam ler o novo campo.
|
|
182
|
+
- **SDK** (`@adonis-agora/authkit-sdk`) — `ListUsersParams` e `ListAuditParams` passam a usar `size`; `ListUsersResult` e `ListAuditResult` viram `{ meta: ListMeta; data: T[] }` (novo tipo `ListMeta` exportado), nos dois drivers (remoto e embedded).
|
|
183
|
+
- **React** (`@adonis-agora/authkit-react`) — `client.admin.users.list()`, `client.admin.audit.list()`, `useUsersQueryOptions()`, `useAuditQueryOptions()` e as query keys `authkitKeys.admin.users/audit` passam a usar `size`; `AdminUserListResult` e `AuditListResult` viram `{ meta: ListMeta; data: T[] }` (novo tipo `ListMeta` exportado). Efeito colateral: o console admin enviava `limit=` para um endpoint que lia `perPage`, então o tamanho de página pedido pela UI era silenciosamente ignorado — agora vale.
|
|
184
|
+
- **Novas constantes exportadas** — `LIST_FIRST_PAGE`, `ADMIN_LIST_DEFAULT_SIZE` (100), `ADMIN_LIST_HTTP_DEFAULT_SIZE` (20), `ADMIN_LIST_MAX_SIZE` (200), mais os helpers `resolveListPage`, `normalizeListSize`, `clampListSize`, `parseListPage` e `parseListSize` (o SDK reexporta as três primeiras constantes com os mesmos nomes).
|
|
185
|
+
- **Novos tipos exportados** — `ListMeta` (`{ page, size, total }`) e `PaginatedResponse<T>` (`{ meta, data }`) em `@adonis-agora/authkit-server`; `ListMeta` também em `@adonis-agora/authkit-sdk` e `@adonis-agora/authkit-react`.
|
|
186
|
+
- **Inalterado** — o contrato INTERNO dos stores continua `Paginated<T> = { data, total }`: `AccountStore.listAccounts()` e `AuditSink.list()` NÃO ganham envelope `meta` (quem monta o `meta` é a borda HTTP/SDK). Implementações customizadas de store/sink só precisam da renomeação `limit` → `size`.
|
|
187
|
+
|
|
188
|
+
### Migração
|
|
189
|
+
|
|
190
|
+
```diff
|
|
191
|
+
// HTTP
|
|
192
|
+
- GET /api/authkit/v1/users?page=2&limit=50
|
|
193
|
+
+ GET /api/authkit/v1/users?page=2&size=50
|
|
194
|
+
|
|
195
|
+
// HTTP — resposta
|
|
196
|
+
- { "data": [...], "total": 137, "page": 2, "size": 50 }
|
|
197
|
+
+ { "meta": { "page": 2, "size": 50, "total": 137 }, "data": [...] }
|
|
198
|
+
|
|
199
|
+
// SDK
|
|
200
|
+
- const { data, total, page, limit } = await authkit.users.list({ page: 2, limit: 50 })
|
|
201
|
+
+ const { data, meta } = await authkit.users.list({ page: 2, size: 50 })
|
|
202
|
+
+ // meta.page / meta.size / meta.total
|
|
203
|
+
|
|
204
|
+
// React
|
|
205
|
+
- useUsersQueryOptions({ search, page, limit: 20 })
|
|
206
|
+
+ useUsersQueryOptions({ search, page, size: 20 })
|
|
207
|
+
- const total = data?.total ?? 0
|
|
208
|
+
+ const total = data?.meta.total ?? 0
|
|
209
|
+
|
|
210
|
+
// AccountStore / AuditSink customizados
|
|
211
|
+
- async listAccounts({ search, page = 1, limit = 20 }: ListAccountsParams) {
|
|
212
|
+
- return { data: rows.slice((page - 1) * limit, page * limit), total }
|
|
213
|
+
+ async listAccounts({ search, page = 1, size = 20 }: ListAccountsParams) {
|
|
214
|
+
+ return { data: rows.slice((page - 1) * size, page * size), total }
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Callers que pediam `limit > 200` via HTTP passam a receber 200 itens por página — pagine com `page` para cobrir o resto.
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- bc32ea4: Bump runtime dependencies to their latest releases.
|
|
223
|
+
|
|
224
|
+
- `@simplewebauthn/server` and `@simplewebauthn/browser` go to `14.x`. The committed
|
|
225
|
+
`src/host/assets/webauthn.js` bundle was regenerated from the new `@simplewebauthn/browser`
|
|
226
|
+
(the `check:webauthn-bundle` guard would have caught the drift otherwise). The `authkit-react`
|
|
227
|
+
peer was **widened** to `^13.3.0 || ^14.0.0` instead of moved, so apps still on 13 keep
|
|
228
|
+
installing cleanly.
|
|
229
|
+
- `oidc-provider` 9.12.0 → 9.12.2 and `jose` 6.2.10 → 6.2.12 (patch releases on the token/JWT path).
|
|
230
|
+
|
|
231
|
+
No API change on our side: typecheck, tests, packaging smoke and the WebAuthn bundle check all pass.
|
|
232
|
+
|
|
233
|
+
## 0.20.1
|
|
234
|
+
|
|
235
|
+
### Patch Changes
|
|
236
|
+
|
|
237
|
+
- a6d271c: Ship TanStack Intent AI-agent skills with each package (`skills/` added to `files`), add the `tanstack-intent` keyword, and take a devDependency on `@tanstack/intent` for skill validation.
|
|
238
|
+
|
|
239
|
+
## 0.20.0
|
|
240
|
+
|
|
241
|
+
### Minor Changes
|
|
242
|
+
|
|
243
|
+
- cbc19f5: Hooks e tipos para a preferência de tipos de login por usuário
|
|
244
|
+
|
|
245
|
+
Novos hooks TanStack Query sobre a Account API `GET/PUT
|
|
246
|
+
/account/api/login-methods` (requer authkit-server com a feature):
|
|
247
|
+
|
|
248
|
+
- `useLoginMethodsQueryOptions()` — preferência do usuário + estado final
|
|
249
|
+
(`available`) + o que está travado (`locked`).
|
|
250
|
+
- `useUpdateLoginMethodsMutationOptions()` — grava a preferência; `{}` volta a
|
|
251
|
+
herdar os globais.
|
|
252
|
+
|
|
253
|
+
Tipos exportados: `AccountLoginMethodsResult`, `UpdateLoginMethodsResult`,
|
|
254
|
+
`UserLoginMethodsInput`. Query key nova: `authkitKeys.account.loginMethods()`.
|
|
255
|
+
|
|
256
|
+
## 0.19.1
|
|
257
|
+
|
|
258
|
+
### Patch Changes
|
|
259
|
+
|
|
260
|
+
- Updated dependencies [813a321]
|
|
261
|
+
- @adonis-agora/authkit-core@0.8.0
|
|
262
|
+
|
|
263
|
+
## 0.19.0
|
|
264
|
+
|
|
265
|
+
### Minor Changes
|
|
266
|
+
|
|
267
|
+
- 8f23a85: Fix the admin console's "Impersonate" button, both halves of it.
|
|
268
|
+
|
|
269
|
+
**It could never have worked.** The panel was built from `cfg.clients`, which is
|
|
270
|
+
always `[]` in a real installation — clients live in the OIDC adapter, created
|
|
271
|
+
through the console, the Admin API or `authkit:clients:create`, and the resolved
|
|
272
|
+
config never carries them. So the endpoint answered `404 no_token_exchange_client`
|
|
273
|
+
on every host that had not kept legacy static clients. Only the test suite, which
|
|
274
|
+
declared static clients, ever saw it succeed. `buildImpersonationPanel` now takes
|
|
275
|
+
the candidate clients as an argument and the controller reads them from the
|
|
276
|
+
adapter, falling back to static config clients for legacy hosts and for adapters
|
|
277
|
+
that cannot enumerate. A confidential runtime client renders a `<CLIENT_SECRET>`
|
|
278
|
+
placeholder rather than an empty secret, because the adapter cannot hand back a
|
|
279
|
+
secret that was shown once at creation.
|
|
280
|
+
|
|
281
|
+
**And the audit trail lied about it.** The endpoint recorded
|
|
282
|
+
`impersonation.started` before the UI had done anything — so a request that then
|
|
283
|
+
404'd, or that the admin abandoned, left a record claiming an impersonation had
|
|
284
|
+
begun. Viewing the exchange parameters is not assuming an identity. The console
|
|
285
|
+
now records `impersonation.panel_viewed`, emitted only once a usable panel
|
|
286
|
+
exists; `impersonation` still belongs to the token-exchange handler, which is
|
|
287
|
+
where an identity is actually assumed. `impersonation.started` is gone from
|
|
288
|
+
`AuditEventType` — nothing emitted it under a truthful reading.
|
|
289
|
+
|
|
290
|
+
**The UI opened a field that never existed.** `result.data.url` type-checked only
|
|
291
|
+
because `ImpersonationPanel` in `@adonis-agora/authkit-react` carried an
|
|
292
|
+
`[key: string]: unknown` index signature; at runtime it was always
|
|
293
|
+
`window.open(undefined)`. The type is now closed over the real response, so that
|
|
294
|
+
line no longer compiles, and the console renders the exchange parameters with a
|
|
295
|
+
copyable request instead of trying to navigate somewhere.
|
|
296
|
+
|
|
297
|
+
## 0.18.1
|
|
298
|
+
|
|
299
|
+
### Patch Changes
|
|
300
|
+
|
|
301
|
+
- 1f15367: Point `homepage` and `bugs.url` at the repository's current name.
|
|
302
|
+
|
|
303
|
+
The repository was renamed to `adonis-agora-authkit`; `repository.url` followed,
|
|
304
|
+
`homepage` and `bugs.url` did not. Every package therefore shipped a manifest
|
|
305
|
+
that disagreed with itself, and the "Repository"/"Homepage" links on npm leaned
|
|
306
|
+
on GitHub's rename redirect — which lasts only until someone claims the old
|
|
307
|
+
name. All three fields now name the same repository.
|
|
308
|
+
|
|
309
|
+
- Updated dependencies [1f15367]
|
|
310
|
+
- @adonis-agora/authkit-core@0.7.1
|
|
311
|
+
|
|
312
|
+
## 0.18.0
|
|
313
|
+
|
|
314
|
+
### Minor Changes
|
|
315
|
+
|
|
316
|
+
- Login OTP e anti-duplo-submit nos formulários de interaction:
|
|
317
|
+
|
|
318
|
+
- `interactionUrls` cobre `otpVerify` (e `InteractionPostStep` aceita `'otpVerify'`) + novo export `OTP_CODE_FIELD` (`'code'`). A rota existe no server desde a 0.50 e o helper ficou pra trás — hosts montavam a URL à mão e hardcodavam o nome do campo.
|
|
319
|
+
- `MagicLinkButton` aceita `channel` (`'code'` | `'link'` — o choose-first do server 0.51) e mostra `pendingChildren` durante o voo do POST.
|
|
320
|
+
- `InteractionForm` ganha trava anti-duplo-submit a nível de DOM: desabilita os botões de submit depois do dispatch do evento (botão nomeado preserva o valor; `preventDefault` não trava à toa). Cobre qualquer `children` sem mudança de API — clique repetido não vira mais POST duplicado (no `/magic`, N cliques impacientes derrubavam o usuário no throttle 429).
|
|
321
|
+
|
|
322
|
+
## 0.17.0
|
|
323
|
+
|
|
324
|
+
### Minor Changes
|
|
325
|
+
|
|
326
|
+
- efd30df: Adiciona hooks e utilitários headless para o "dance" de sudo/passkey por form
|
|
327
|
+
clássico, para hosts com telas React próprias.
|
|
328
|
+
|
|
329
|
+
- `submitClassicForm({ action, fields, method? })`: cria um `<form>` nativo com
|
|
330
|
+
campos hidden e o submete (navegação real) — necessário porque os fluxos de
|
|
331
|
+
sudo/passkey respondem 302, que um `fetch` não segue como navegação. SSR-safe.
|
|
332
|
+
- `usePasskeyAssertion({ optionsUrl, actionUrl, csrfToken, returnTo? })` →
|
|
333
|
+
`{ run, running, error }`: pega as options (`x-csrf-token`), roda
|
|
334
|
+
`startAuthentication` e submete o `response` via form clássico (com `_csrf` e
|
|
335
|
+
`return_to` quando fornecidos).
|
|
336
|
+
- `usePasskeyRegistration(...)`: idem, com `startRegistration`.
|
|
337
|
+
|
|
338
|
+
Também exporta as peças de tier mais baixo reusadas por eles (`runPasskeyAssertion`,
|
|
339
|
+
`runPasskeyRegistration`, `registerPasskey`, `loadStartRegistration`). O
|
|
340
|
+
`submitPasskeyVerification` existente passa a delegar ao `submitClassicForm`,
|
|
341
|
+
sem mudança de comportamento.
|
|
342
|
+
|
|
343
|
+
## 0.16.0
|
|
344
|
+
|
|
345
|
+
### Minor Changes
|
|
346
|
+
|
|
347
|
+
- 7ea3ac8: Login por senha/magic link/OAuth também nas camadas do ecossistema — some a concatenação de URL à mão e o `_csrf` repetido em cada form:
|
|
348
|
+
- **Funções (`interactionUrls`, `oauthRedirectUrl`)** — builders tipados das URLs de interaction (identifier, login, magic, signup, switch, passkey/options, passkey/verify) e do redirect OAuth. Fonte única: se o prefixo de rota do authkit-server mudar, não quebra silenciosamente em string mágica espalhada.
|
|
349
|
+
- **Primitivo (`InteractionForm`)** — `<form method="POST">` no endpoint certo + o campo escondido `_csrf`, deixando os campos e o estilo pro app. Encapsula o boilerplate que se repetia em identifier/login/magic.
|
|
350
|
+
- **Componentes prontos (`MagicLinkButton`, `OAuthButton`)** — o "faz tudo", construídos sobre o primitivo/as funções, temáveis via `className`/`children`.
|
|
351
|
+
- **Helper `buttonClass(variant, extra)`** — centraliza a mescla de className dos botões do authkit (base + variante + extra do host), que os componentes repetiam.
|
|
352
|
+
|
|
353
|
+
## 0.15.0
|
|
354
|
+
|
|
355
|
+
### Minor Changes
|
|
356
|
+
|
|
357
|
+
- 9909753: Login por passkey disparado por clique, nas três camadas do ecossistema — o app deixa de reescrever a cerimônia à mão:
|
|
358
|
+
|
|
359
|
+
- **Função (`authenticatePasskey`, `submitPasskeyVerification`, `loadStartAuthentication`)** — a cerimônia pura (POST das options → `startAuthentication` → serializa a assertion) e o submit de página inteira no `verify`. Totalmente customizável: use só a peça que precisar.
|
|
360
|
+
- **Hook headless (`usePasskeyLogin`)** — `{ authenticate, busy, failed }`. Roda a cerimônia e faz o submit; passe `onSuccess` pra controlar a verificação você mesmo (meio-do-caminho). O app é dono do visual do botão.
|
|
361
|
+
- **Componente pronto (`PasskeyButton`)** — o "faz tudo": botão + estado + erro, temável via `className`/`children`. Construído sobre o hook.
|
|
362
|
+
|
|
363
|
+
`@simplewebauthn/browser` continua sendo import lazy (pacote local → CDN), sem virar dependência. O `usePasskeyAutofill` passa a reusar o mesmo `loadStartAuthentication` (some a duplicação do carregamento da lib).
|
|
364
|
+
|
|
365
|
+
## 0.14.0
|
|
366
|
+
|
|
367
|
+
### Minor Changes
|
|
368
|
+
|
|
369
|
+
- c12bac9: `authkit-react` drops app-role/authorization gating — that concern moved to
|
|
370
|
+
`@adonis-agora/authz-react`.
|
|
371
|
+
|
|
372
|
+
Removed:
|
|
373
|
+
|
|
374
|
+
- `AuthUser.appRoles`, `AuthSharedProps.authkit.appRoles`.
|
|
375
|
+
- `AuthState.appRoles`/`AuthState.hasAppRole()`.
|
|
376
|
+
- `hasAppRole`, `hasAnyAppRole`, `hasAllAppRoles` (from `roles.ts` and the package barrel).
|
|
377
|
+
- The `<Can>` component (`components/can.tsx`) and its `CanProps` type — it now lives in
|
|
378
|
+
`@adonis-agora/authz-react`, backed by the Authz service instead of app roles resolved
|
|
379
|
+
on the host.
|
|
380
|
+
|
|
381
|
+
`AuthState` is now `{ user, isAuthenticated, globalRoles, hasGlobalRole, hasAnyGlobalRole,
|
|
382
|
+
hasAllGlobalRoles }`.
|
|
383
|
+
|
|
384
|
+
Kept: `user`, `globalRoles`, `hasGlobalRole`/`hasAnyGlobalRole`/`hasAllGlobalRoles` — these
|
|
385
|
+
read from the IdP token via `@adonis-agora/authkit-client`, not from app-defined roles.
|
|
386
|
+
`<CanPermission>`/`useCan` (permission checks against the Authz `/authz/can` endpoint) are
|
|
387
|
+
unaffected.
|
|
388
|
+
|
|
389
|
+
## 0.13.1
|
|
390
|
+
|
|
391
|
+
### Patch Changes
|
|
392
|
+
|
|
393
|
+
- 70f5721: Ship peer dependencies as ranges instead of exact versions
|
|
394
|
+
|
|
395
|
+
`peerDependencies` pointed at the pinned `adonis`/`frontend` catalogs, and pnpm
|
|
396
|
+
inlines a catalog's literal value at publish time — so every published peer came
|
|
397
|
+
out exact. `@adonis-agora/authkit-server@0.34.1` on npm requires
|
|
398
|
+
`"@adonisjs/core": "7.3.3"`, which no app on 7.3.5 can satisfy;
|
|
399
|
+
`@adonis-agora/authkit-react@0.13.0` requires `"react": "19.2.6"`, which locks
|
|
400
|
+
out every consumer not on that exact patch.
|
|
401
|
+
|
|
402
|
+
Peers now resolve from three new range-only catalogs (`adonisPeers`,
|
|
403
|
+
`frontendPeers`, `miscPeers`). Dependencies keep the pinned catalogs — a pin is
|
|
404
|
+
right for reproducible installs and wrong for consumer compatibility, and the
|
|
405
|
+
two were sharing one source.
|
|
406
|
+
|
|
407
|
+
No source or runtime behaviour changes.
|
|
408
|
+
|
|
409
|
+
## 0.13.0
|
|
410
|
+
|
|
411
|
+
### Minor Changes
|
|
412
|
+
|
|
413
|
+
- 12df185: Write `globalRoles` into the @agora context from the resolved session (so the Authz global-role bridge can read them), and add Authz permission gating to authkit-react: `useCan(permission, resource?)` and `<CanPermission>`, which consult the Authz `POST <canPath>` endpoint (`{ permission, resource? }` → `{ allowed }`, credentials included) with in-memory caching/dedupe. The endpoint path is configurable via `AuthkitProvider` (`canPath` / `endpoints.can`, default `/authz/can`).
|
|
414
|
+
- 4bccbe9: fix: invalidate can-permission cache on principal change (stale authz after logout/org-switch)
|
|
415
|
+
|
|
416
|
+
The in-memory `useCan`/`checkCan` cache was process-global and keyed only by
|
|
417
|
+
`(path, permission, resource)`, so resolved permission decisions kept being
|
|
418
|
+
served across logout / user-switch / org-switch — a decision could outlive the
|
|
419
|
+
session that authorized it. The current principal (`useAuth().user?.id`, or an
|
|
420
|
+
`anon` sentinel when logged out) is now folded into the cache key, so a new
|
|
421
|
+
principal naturally misses the previous principal's answers and re-checks.
|
|
422
|
+
|
|
423
|
+
Also: `UseCanResult` now exposes an optional `error?: Error` (fail-closed:
|
|
424
|
+
`allowed` stays `false` on error), symmetric with `ResourceState<T>`; a public
|
|
425
|
+
`invalidateCanCache()` is exported to force a global refetch; and the warm-cache
|
|
426
|
+
render no longer triggers a redundant second `setState`.
|
|
427
|
+
|
|
428
|
+
## 0.12.0
|
|
429
|
+
|
|
430
|
+
### Minor Changes
|
|
431
|
+
|
|
432
|
+
- 0542665: Re-scope to @adonis-agora/authkit-\* (join the Agora ecosystem)
|
|
433
|
+
|
|
434
|
+
### Patch Changes
|
|
435
|
+
|
|
436
|
+
- Updated dependencies [0542665]
|
|
437
|
+
- @adonis-agora/authkit-core@0.7.0
|
|
438
|
+
|
|
439
|
+
## 0.11.0
|
|
440
|
+
|
|
441
|
+
### Minor Changes
|
|
442
|
+
|
|
443
|
+
- a450edb: Página "Signing Keys" no console admin: ver chaves JWKS (kids/idade/ativa), configurar rotação automática (enabled/maxAgeDays/keep), rotacionar agora e desabilitar todas + criar nova. O status de keys (`GET {base}/keys`) agora inclui a lista de chaves (`KeysStatus.keys`).
|
|
444
|
+
|
|
445
|
+
## 0.10.0
|
|
446
|
+
|
|
447
|
+
### Minor Changes
|
|
448
|
+
|
|
449
|
+
- 386a0df: feat: gestão de rotação de chave JWKS no React SDK. Novo `client.admin.keys.status()`
|
|
450
|
+
e `client.admin.keys.rotate()` (console API session-authed — sem API key no browser),
|
|
451
|
+
hooks headless TanStack `useKeysQueryOptions`/`useRotateKeysMutationOptions`, e o
|
|
452
|
+
componente `<KeyRotation>` (idade da chave, política, ETA e botão "Rotacionar agora").
|
|
453
|
+
|
|
454
|
+
### Patch Changes
|
|
455
|
+
|
|
456
|
+
- Updated dependencies [93eaf69]
|
|
457
|
+
- Updated dependencies [e2582b8]
|
|
458
|
+
- @adonis-agora/authkit-core@0.6.0
|
|
459
|
+
|
|
460
|
+
## 0.9.1
|
|
461
|
+
|
|
462
|
+
### Patch Changes
|
|
463
|
+
|
|
464
|
+
- Updated dependencies [df4b41f]
|
|
465
|
+
- @adonis-agora/authkit-core@0.5.0
|
|
466
|
+
|
|
467
|
+
## 0.9.0
|
|
468
|
+
|
|
469
|
+
### Minor Changes
|
|
470
|
+
|
|
471
|
+
- a6ca8a7: Bring your own IdP — use AuthKit against any OIDC-compliant provider
|
|
472
|
+
- **client**: new `discoverEndpoints(issuer)` resolves the IdP's real endpoints from `/.well-known/openid-configuration` (cached per issuer, field-level manual overrides, silent fallback to the oidc-provider conventions when the document is unreachable). All flow helpers (`buildAuthorizeUrl`, `exchangeCode`, `refreshTokens`, `exchangeToken`, `buildEndSessionUrl`) now accept explicit endpoint params — Keycloak, Auth0, Okta, Entra et al. work out of the box.
|
|
473
|
+
- **react**: new `idp: 'authkit' | 'external'` config on `AuthkitProvider`. With an external IdP, the components that depend on authkit-server's REST surface (`UserProfile`, `OrganizationSwitcher`, `OrganizationProfile`, `AuthorizedApps`) degrade to `null` instead of calling endpoints that don't exist; sign-in/out, auth state, role gates and the password strength meter keep working.
|
|
474
|
+
- New "Bring your own IdP" docs page tying the two together.
|
|
475
|
+
|
|
476
|
+
## 0.8.0
|
|
477
|
+
|
|
478
|
+
### Minor Changes
|
|
479
|
+
|
|
480
|
+
- feat(account): global sign-out — revoke all sessions across all devices
|
|
481
|
+
|
|
482
|
+
**Server (`@adonis-agora/authkit-server`):**
|
|
483
|
+
|
|
484
|
+
- `POST /account/api/sessions/revoke-all` — revokes all OIDC sessions/grants for the account
|
|
485
|
+
and terminates the current Adonis console session (global logout).
|
|
486
|
+
Returns `{ ok: true, signedOut: true }` so the UI can redirect to login.
|
|
487
|
+
Emits audit event `account.signed_out_all`.
|
|
488
|
+
|
|
489
|
+
**React SDK (`@adonis-agora/authkit-react`):**
|
|
490
|
+
|
|
491
|
+
- `RevokeAllResult` type (`{ ok, signedOut, ...rest }`)
|
|
492
|
+
- `client.account.sessions.revokeAll()` method
|
|
493
|
+
- `useAccountRevokeAllSessionsMutationOptions()` hook (account namespace;
|
|
494
|
+
distinct from the admin `useRevokeAllSessionsMutationOptions`)
|
|
495
|
+
|
|
496
|
+
## 0.7.0
|
|
497
|
+
|
|
498
|
+
### Minor Changes
|
|
499
|
+
|
|
500
|
+
- feat(settings): org-scoped runtime settings (org → global → default resolution)
|
|
501
|
+
- `auth_settings` table gains `organization_id` column (nullable; NULL = global). Unique constraint on (key, organization_id).
|
|
502
|
+
- `RuntimeSettings` methods gain optional `orgId` param: `getSetting(key, orgId?)`, `setSetting(key, value, updatedBy?, orgId?)`, `deleteSetting(key, orgId?)`, `listSettings(orgId?)`. New `getEffective(key, orgId?)` helper resolves org → global → null.
|
|
503
|
+
- Cache is org-scope-aware (cache key includes orgId).
|
|
504
|
+
- `resolveEffectiveOrganizationsPolicy` and `resolveEffectiveRolesCatalog` accept optional `orgId` and resolve org → global → default. All other resolvers remain global-only.
|
|
505
|
+
- Console JSON API (`/api/settings`) and Admin REST API accept `?organizationId=` query param for scoped reads/writes/deletes.
|
|
506
|
+
- Org detail drawer in console admin shows "Organization Settings" section for org-scopable keys (`organizations_policy`, `roles_catalog`) with source badges (from org / from global / default) and inline JSON editor.
|
|
507
|
+
- `@adonis-agora/authkit-react` client: `settings.list(orgId?)`, `settings.set(key, value, orgId?)`, `settings.remove(key, orgId?)`. `authkitKeys.admin.settings(orgId?)`. `useSettingsQueryOptions(orgId?)`, `useSetSettingMutationOptions(orgId?)`, `useRemoveSettingMutationOptions(orgId?)`.
|
|
508
|
+
- `SettingEntry` type gains `organizationId: string | null` field.
|
|
509
|
+
- Existing rows default to `organization_id = NULL` (global) — no data migration needed.
|
|
510
|
+
|
|
511
|
+
## 0.6.0
|
|
512
|
+
|
|
513
|
+
### Minor Changes
|
|
514
|
+
|
|
515
|
+
- feat(console): gestão completa de organizations no console admin React
|
|
516
|
+
|
|
517
|
+
Adiciona CRUD completo de organizações na JSON API do console React
|
|
518
|
+
(console_orgs_controller) e na SPA (Orgs.tsx + orgs.containers.tsx):
|
|
519
|
+
|
|
520
|
+
**Novos endpoints no console React JSON API (`{adminPrefix}/api/orgs/*`):**
|
|
521
|
+
|
|
522
|
+
- `POST /api/orgs` → criar org (name + slug + ownerAccountId)
|
|
523
|
+
- `PATCH /api/orgs/:id` → editar nome/logo
|
|
524
|
+
- `DELETE /api/orgs/:id` → remover org
|
|
525
|
+
- `POST /api/orgs/:id/members` → adicionar membro (accountId + role)
|
|
526
|
+
- `PATCH /api/orgs/:id/members/:accountId` → alterar role do membro
|
|
527
|
+
- `DELETE /api/orgs/:id/members/:accountId` → remover membro
|
|
528
|
+
- `POST /api/orgs/:id/invitations` → criar convite (email + role)
|
|
529
|
+
- `DELETE /api/orgs/:id/invitations/:invitationId` → revogar convite
|
|
530
|
+
|
|
531
|
+
Todos os endpoints retornam 404 `capability_unsupported` quando o store não
|
|
532
|
+
suporta organizações. Lógica reutiliza `AdminOrgsService` (sem duplicação).
|
|
533
|
+
|
|
534
|
+
**SDK `@adonis-agora/authkit-react`:**
|
|
535
|
+
|
|
536
|
+
- `client.admin.orgs`: novos métodos `addMember`, `removeMember`,
|
|
537
|
+
`updateMemberRole`, `createInvitation`, `revokeInvitation`
|
|
538
|
+
- Novos hooks: `useAddOrgMemberMutationOptions`, `useRemoveOrgMemberMutationOptions`,
|
|
539
|
+
`useUpdateOrgMemberRoleMutationOptions`, `useCreateOrgInvitationMutationOptions`,
|
|
540
|
+
`useRevokeOrgInvitationMutationOptions`
|
|
541
|
+
|
|
542
|
+
**SPA do console:**
|
|
543
|
+
|
|
544
|
+
- Botão "New organization" na header (modal com name + slug auto-gerado + ownerAccountId)
|
|
545
|
+
- Empty state com CTA de criar
|
|
546
|
+
- Drawer da org: editar nome/logo, deletar (com confirmação), listar membros com
|
|
547
|
+
add/mudar-role/remover, convites pendentes com criar e revogar
|
|
548
|
+
- Padrão containers + skeleton + QueryBoundary + toasts
|
|
549
|
+
|
|
550
|
+
i18n: strings em inglês (interface do console); mensagens de erro do servidor em pt-BR.
|
|
551
|
+
|
|
552
|
+
## 0.5.3
|
|
553
|
+
|
|
554
|
+
### Patch Changes
|
|
555
|
+
|
|
556
|
+
- fix(sessions): listagem global no console admin quando accountId ausente
|
|
557
|
+
- `ConsoleSessionsController.index`: sem `accountId` retorna lista global de todas as sessões ativas (todas as contas) em vez de 400
|
|
558
|
+
- `AdminSessionsService.listAllSessions()`: enumera todas as sessões via adapter, resolve email por conta com cache (evita N+1), limita a 500 entradas com flag `truncated`
|
|
559
|
+
- `AdminSession`: novo campo opcional `email`
|
|
560
|
+
- `sessionDto`: inclui `email` na projeção JSON
|
|
561
|
+
- `AdminSessionEntry` (react types): campo `email: string | null`
|
|
562
|
+
- `UserSessionsResult` (react types): campo `truncated?: boolean`; renomeia `canList` → `supported` para alinhar com a resposta real do servidor
|
|
563
|
+
- SPA `sessions.containers.tsx`: exibe email acima do accountId na coluna Account quando presente
|
|
564
|
+
- Testes: cobre listagem global, truncamento a 500, capability ausente e resolução de email
|
|
565
|
+
|
|
566
|
+
## 0.5.2
|
|
567
|
+
|
|
568
|
+
### Patch Changes
|
|
569
|
+
|
|
570
|
+
- Fix SSR crash (500) when host React account screens use the client: the constructor threw an SSR error eagerly, breaking server-render of any page that only uses `client.account.*`. Construction is now side-effect-free; the admin base is resolved lazily and only throws if an `admin.*` call is actually made without a base. Account-only screens work with just `accountBaseUrl`.
|
|
571
|
+
|
|
572
|
+
## 0.5.1
|
|
573
|
+
|
|
574
|
+
### Patch Changes
|
|
575
|
+
|
|
576
|
+
- Fix "Failed to execute 'fetch' on 'Window': Illegal invocation": the typed client stored `globalThis.fetch` unbound and called it as an instance method, losing the Window binding. The default fetch is now bound to `globalThis`. The admin console SPA is also refactored into per-section containers, each with its own loading skeleton and a `react-error-boundary`-backed error state with retry.
|
|
577
|
+
|
|
578
|
+
## 0.5.0
|
|
579
|
+
|
|
580
|
+
### Minor Changes
|
|
581
|
+
|
|
582
|
+
- Typed front-end client, TanStack Query hooks, and account JSON API:
|
|
583
|
+
- **Account self-service JSON API** (`/account/api/*`): session-authed, CSRF-protected endpoints for profile, security overview, password/email change, sessions, authorized apps, MFA/passkeys, PATs and organizations — the data layer for client-side account screens. Login/consent stay postback for security.
|
|
584
|
+
- **Typed front-end client** in `@adonis-agora/authkit-react`: `createAuthkitClient()` (auto-reads `window.__AUTHKIT__`) exposing `client.admin.*` and `client.account.*`, plus `AuthkitClientError`.
|
|
585
|
+
- **TanStack Query hooks** (Tuyau-style): ready-made `use*QueryOptions`/`use*MutationOptions` for every admin and account endpoint, structured `authkitKeys` for invalidation, `AuthkitClientProvider` + `createAuthkitQueryClient()`. `@tanstack/react-query` is a new peer dependency.
|
|
586
|
+
- **Admin console SPA** now consumes these hooks internally (client-side fetching via TanStack Query) instead of a bespoke fetch wrapper.
|
|
587
|
+
|
|
588
|
+
## 0.4.0
|
|
589
|
+
|
|
590
|
+
### Minor Changes
|
|
591
|
+
|
|
592
|
+
- Rodauth parity completion + React admin console:
|
|
593
|
+
- **Sudo mode**: `sudo_mode` setting + `/account/confirm` (password or passkey) re-confirmation with a grace window; `requireSudo` gates password/email change, account deletion, MFA/passkey management and PAT actions.
|
|
594
|
+
- **OTP lockout**: `otp_lockout` setting locks the second factor after repeated TOTP/recovery failures and unlocks via emailed link (`GET /auth/otp-unlock/:token`, `onOtpUnlock` hook).
|
|
595
|
+
- **Common-password block**: `password_policy.blockCommon` (default on) rejects the ~10k most common passwords offline, before the HIBP check.
|
|
596
|
+
- **Account expiration**: `account_expiration` setting blocks login for accounts inactive beyond N days (reactivate via password reset) + `authkit:accounts:expire-scan` command for cron with warning emails.
|
|
597
|
+
- **WebAuthn autofill**: `auth_methods.passkeyAutofill` enables conditional-mediation passkey suggestions on the login field; new `usePasskeyAutofill` React hook.
|
|
598
|
+
- **React admin console (new default)**: `admin: { ui: 'react' }` serves a real Vite-built React SPA (build-and-serve, bundled in the package — zero host setup) with a dark/light telescope-style theme, consuming a session-authed JSON API under `{prefix}/api/*`. `ui: 'edge'` keeps the classic server-rendered console.
|
|
599
|
+
|
|
600
|
+
## 0.3.2
|
|
601
|
+
|
|
602
|
+
### Patch Changes
|
|
603
|
+
|
|
604
|
+
- Updated dependencies
|
|
605
|
+
- @adonis-agora/authkit-core@0.4.0
|
|
606
|
+
|
|
607
|
+
## 0.3.1
|
|
608
|
+
|
|
609
|
+
### Patch Changes
|
|
610
|
+
|
|
611
|
+
- Updated dependencies
|
|
612
|
+
- @adonis-agora/authkit-core@0.3.1
|
|
613
|
+
|
|
614
|
+
## 0.3.0
|
|
615
|
+
|
|
616
|
+
### Minor Changes
|
|
617
|
+
|
|
618
|
+
- Round 7 — production pack + multi-tenancy:
|
|
619
|
+
- **Organizations (multi-tenancy)**: optional capability-probed tables (`auth_organizations`, `auth_organization_members`, `auth_organization_invitations`), per-org roles (owner/admin/member), email invitations with hashed tokens, active-org session cookie with `org_id`/`org_slug`/`org_role` claims in id_token/userinfo/JWT access tokens, `/account/orgs` page, admin console section, Admin REST API (`/api/authkit/v1/organizations`), SDK `organizations.*` namespace (remote + embedded), React `useOrganizations`/`useOrganization`/`useSwitchOrganization`/`useOrgInvitations` hooks plus `<OrganizationSwitcher />` and `<OrganizationProfile />` components.
|
|
620
|
+
- **LGPD/GDPR compliance**: self-service and admin account deletion with full cascade (sessions, grants, PATs, passkeys, identities, MFA, avatar) and audit anonymization (stable pseudonym), data export endpoint (`GET /account/security/export`), `login.requireVerifiedEmail` gate across password/magic-link/passkey flows, SDK `users.delete()`.
|
|
621
|
+
- **User migration & password hygiene**: transparent lazy password rehash on login, `password.legacyVerifier` hook for foreign hash formats, `authkit:users:import` ace command (JSON/NDJSON, `--dry-run`), configurable `password.policy`, HaveIBeenPwned k-anonymity breach check (fail-safe), React `usePasswordStrength` + `<PasswordStrengthMeter />`.
|
|
622
|
+
- **JWT access tokens (RFC 9068)**: `accessTokens: { format: 'jwt' }` with per-resource overrides, `verifyJwtAccessToken` local validation in the client package, `authkit:keys:rotate` command with grace-period JWKS rotation.
|
|
623
|
+
- **Bot protection**: pluggable vendor-agnostic `botProtection` config (Turnstile/hCaptcha-ready, fail-safe) on login/signup/reset.
|
|
624
|
+
- **New-device login notification**: `notifications.newDeviceEmail` + `mail.onNewDeviceLogin` hook driven by the trusted-device signal.
|
|
625
|
+
- **Console polish**: session context (user-agent/OS/IP/geo via pluggable `resolveGeo`), RFC 8693 impersonation panel (`admin.impersonation`, default off), dashboard with MAU/daily sign-ins, `GET /api/authkit/v1/stats` + SDK `stats()`.
|
|
626
|
+
|
|
627
|
+
### Patch Changes
|
|
628
|
+
|
|
629
|
+
- Updated dependencies
|
|
630
|
+
- @adonis-agora/authkit-core@0.3.0
|
|
631
|
+
|
|
632
|
+
## 0.2.0
|
|
633
|
+
|
|
634
|
+
### Minor Changes
|
|
635
|
+
|
|
636
|
+
- 0403b72: Add a Clerk-style frontend layer: an `<AuthkitProvider>` config context (loginUrl/logoutUrl/profileUrl/endpoints/csrfToken with host-kit defaults), headless hooks (`useSignIn`, `useSignOut`, `useUser`, `useProfile`, `useSessions`, `useAuthorizedApps` — fetch-based, no react-query), and pre-built themeable components (`SignInButton`, `SignOutButton`, `UserButton`, `UserProfile`, `AuthorizedApps`, `Avatar`) with a shipped `styles.css` (`./styles.css` export) and `--authkit-*` CSS variables.
|
|
637
|
+
|
|
638
|
+
## 0.1.2
|
|
639
|
+
|
|
640
|
+
### Patch Changes
|
|
641
|
+
|
|
642
|
+
- Updated dependencies [1872a30]
|
|
643
|
+
- @adonis-agora/authkit-core@0.2.0
|
|
644
|
+
|
|
645
|
+
## 0.1.1
|
|
646
|
+
|
|
647
|
+
### Patch Changes
|
|
648
|
+
|
|
649
|
+
- Refactors do code review (comportamento preservado, contratos mais limpos):
|
|
650
|
+
|
|
651
|
+
**server (minor):**
|
|
652
|
+
|
|
653
|
+
- `AccountStore` decomposto em interfaces de capacidade (`CoreAccountStore`,
|
|
654
|
+
`MfaCapability`, `WebauthnCapability`, `ProviderIdentityCapability`) com type
|
|
655
|
+
guards (`supportsMfa`/`supportsPasskeys`/`supportsProviderIdentity`). O tipo
|
|
656
|
+
`AccountStore` continua existindo (core & Partial<capacidades>) — compatível.
|
|
657
|
+
`lucidAccountStore` agora OMITE os métodos de capacidades não configuradas em
|
|
658
|
+
vez de lançar em runtime; social login sem provider-identity degrada pro login.
|
|
659
|
+
- Sequência login+lockout centralizada em `attemptPasswordLogin` (era duplicada
|
|
660
|
+
em 2 controllers).
|
|
661
|
+
- `adminGuard` agora retorna 404 quando `admin.enabled: false` (fecha bypass de
|
|
662
|
+
drift entre config e `AuthHostOptions.admin`).
|
|
663
|
+
- `dynamicRegistration.management: true` sem `enabled: true` agora falha no
|
|
664
|
+
resolve do config (RFC 7592 exige 7591).
|
|
665
|
+
- Serialização JSON dos mixins unificada em `jsonColumn()` (semântica por coluna
|
|
666
|
+
preservada).
|
|
667
|
+
|
|
668
|
+
**client (minor):**
|
|
669
|
+
|
|
670
|
+
- POST ao token endpoint unificado (`exchangeCode`/`refreshTokens`/`exchangeToken`).
|
|
671
|
+
- Introspection + claims→Identity compartilhados entre resolvers; `pat`/`opaque`
|
|
672
|
+
agora também mapeiam `picture→profile.avatarUrl` e `sid→sessionId` (alinhados
|
|
673
|
+
ao `jwt`).
|
|
674
|
+
|
|
675
|
+
**react (patch):**
|
|
676
|
+
|
|
677
|
+
- Helpers genéricos de roles; warn de dev no `useAuth` quando não há
|
|
678
|
+
`AuthProvider` nem shared prop do Inertia.
|