@adonis-agora/authkit-react 0.26.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +699 -0
  2. package/README.md +29 -19
  3. package/build/index.d.ts +3 -18
  4. package/build/index.js +2 -9
  5. package/build/src/client/client.d.ts +12 -21
  6. package/build/src/client/client.js +7 -15
  7. package/build/src/client/types.d.ts +54 -17
  8. package/build/src/components/authorized_apps.js +17 -13
  9. package/build/src/components/organization_profile.js +31 -39
  10. package/build/src/components/organization_switcher.js +25 -9
  11. package/build/src/components/user_profile.js +13 -7
  12. package/build/src/config.d.ts +0 -6
  13. package/build/src/config.js +0 -12
  14. package/build/src/hooks/use_resource.d.ts +0 -8
  15. package/build/src/hooks/use_resource.js +0 -22
  16. package/build/src/queries/account/index.d.ts +11 -1
  17. package/build/src/queries/account/index.js +14 -0
  18. package/build/src/queries/admin/index.d.ts +6 -21
  19. package/build/src/queries/keys.d.ts +1 -0
  20. package/build/src/queries/keys.js +1 -0
  21. package/package.json +12 -11
  22. package/skills/authkit-react-auth/SKILL.md +39 -22
  23. package/build/src/hooks/use_authorized_apps.d.ts +0 -16
  24. package/build/src/hooks/use_authorized_apps.js +0 -15
  25. package/build/src/hooks/use_org_invitations.d.ts +0 -19
  26. package/build/src/hooks/use_org_invitations.js +0 -20
  27. package/build/src/hooks/use_organization.d.ts +0 -23
  28. package/build/src/hooks/use_organization.js +0 -10
  29. package/build/src/hooks/use_organizations.d.ts +0 -18
  30. package/build/src/hooks/use_organizations.js +0 -14
  31. package/build/src/hooks/use_profile.d.ts +0 -13
  32. package/build/src/hooks/use_profile.js +0 -32
  33. package/build/src/hooks/use_sessions.d.ts +0 -16
  34. package/build/src/hooks/use_sessions.js +0 -15
  35. package/build/src/hooks/use_switch_organization.d.ts +0 -7
  36. package/build/src/hooks/use_switch_organization.js +0 -42
package/CHANGELOG.md ADDED
@@ -0,0 +1,699 @@
1
+ # @adonis-agora/authkit-react
2
+
3
+ ## 1.0.0-rc.1
4
+
5
+ ### Major Changes
6
+
7
+ - [#456](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/456) [`9c12ef9`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/9c12ef9c1c49db9d54a7da6d241264499ad76e18) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Poppy (the Personal Agent Protocol) moves out of `@adonis-agora/authkit-server` into the new `@adonis-agora/authkit-poppy` package, and authkit-server gains a stable extension surface for personal-agent protocols. See [Install `@adonis-agora/authkit-poppy` for Poppy](https://github.com/DavideCarvalho/adonis-agora-authkit/blob/main/apps/docs/content/docs/migrating-to-1-0.mdx#install-adonis-agoraauthkit-poppy-for-poppy).
8
+
9
+ Breaking changes (`@adonis-agora/authkit-server`):
10
+
11
+ - `personalAgents.poppy` is removed: install `@adonis-agora/authkit-poppy` and use `personalAgents: { extensions: [poppy({ ... })] }` with the same options. A config that still has `personalAgents.poppy` fails at boot. Routes, tables, tokens and sessions are unchanged, so no data migration is needed.
12
+ - Every Poppy export (`PoppyConfigInput` and the other `Poppy*` types, `poppyEmailCodeSignIn`, `verifyPoppyRequest`, `poppyAuth`, `poppyOf`, `poppyWebSession`, `poppyWebSessionOf`, `installPoppySlots`, `POPPY_AUTHENTICATE_SLOT`, `POPPY_WEB_SESSION_KEY`, `PoppyError`, `verifyDpopProof`, `accessTokenHash`, `hmacNonceSource`, `databaseReplayStore`, `memoryReplayStore`, `redisReplayStore`, `safeFetchJson`, `isBlockedAddress`, `SafeFetchError`, `maskEmail`) now comes from `@adonis-agora/authkit-poppy`.
13
+ - `mail.onPoppySignInCode` is removed: pass `sendCode` to `poppyEmailCodeSignIn()`.
14
+ - `authkitCsrfExceptions` no longer takes `poppyPrefix`; extensions' endpoints are exempted from the config (`personalAgentExtensions: false` turns that off).
15
+ - `ensureAuthkitSchema()` no longer creates the `auth_poppy_*` tables (the extension's tables are ensured at boot; `ensurePoppySchema()` for migrations).
16
+ - Admin console API: an extension's `protocols` entry is `{ label, requireRegistration, hostResolver, allowHttpIdentifiers, identifierLabel, identifierPlaceholder }`.
17
+
18
+ New, stable for 1.x: `personalAgents.extensions` and the types `PersonalAgentExtension`, `PersonalAgentExtensionDefinition`, `PersonalAgentExtensionContext`, `PersonalAgentRouteKit`, `PersonalAgentHost`, `PersonalAgentGrantLedger`, `PersonalAgentGrant`, `PersonalAgentRefreshToken`, `PersonalAgentAccessTokens`, `PersonalAgentProtocolRuntime`, `PersonalAgentGrantSummary`, `PersonalAgentConsoleSummary`, `ResolvedPersonalAgentExtension`, `AuthkitTable`; the functions `personalAgentExtensionRuntime`, `ensureAuthkitTables`, `sendAuthkitCodeEmail`, `signInAccountSession` and `signOutAccountSession`; and the `tables` option of `ensureAuthkitSchema`.
19
+
20
+ Breaking changes (`@adonis-agora/authkit-react`):
21
+
22
+ - `PersonalAgentProtocol` is `'pact'` or any extension id, and `PersonalAgentsOverview.protocols` has one entry per extension (`PersonalAgentExtensionOverview`) instead of a fixed `poppy` key. `AccountAgentGrant.protocol` uses `PersonalAgentProtocol`.
23
+
24
+ ## 1.0.0-rc.0
25
+
26
+ ### Major Changes
27
+
28
+ - [#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.
29
+
30
+ Breaking changes (`@adonis-agora/authkit-server`):
31
+
32
+ - `withMfa` is removed. MFA state lives in the lib-owned `auth_mfa` table, so drop the mixin from your `AuthUser` model's `compose(...)`.
33
+ - `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`.
34
+ - 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.
35
+ - 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.
36
+ - `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'`).
37
+ - The Admin API client body reads `grantTypes` only; the `grants` alias is gone (responses still return `grants`).
38
+ - `lucidAccountStore` always mounts password history over the model's connection (`auth_password_history`).
39
+ - `/account/orgs/json`, `/account/orgs/invitations/json` and `/account/orgs/:id/json` are removed; use `/account/api/orgs/*`.
40
+ - `GET /account/api/apps` entries gain `name` and `logoUrl`.
41
+
42
+ - 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.
43
+ - 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.
44
+ - 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.
45
+ - 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.
46
+
47
+ Breaking changes (`@adonis-agora/authkit-core`):
48
+
49
+ - `ClientConfig` and `ResolvedAuthServerConfig.clients` are removed.
50
+
51
+ Breaking changes (`@adonis-agora/authkit-client`):
52
+
53
+ - `@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`).
54
+ - `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.
55
+ - `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.
56
+ - `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.
57
+ - New `authkitIdentityProvider()`: a user provider with no database; `ctx.auth.user` is the AuthKit `Identity`.
58
+ - New `authkitClientGuard({ provider, resolver })` option: a per-guard resolver for API routes (bearer JWT, opaque, PAT).
59
+ - `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`.
60
+ - `UnauthorizedAccessConstructor` is no longer exported, and `AuthkitClientGuard` no longer takes an exception class; it always throws `@adonisjs/auth`'s `E_UNAUTHORIZED_ACCESS`.
61
+
62
+ Breaking changes (`@adonis-agora/authkit-sdk`):
63
+
64
+ - `clients.*` return `grantTypes` (was `grants`), plus `clientName` and `logoUri`.
65
+
66
+ Breaking changes (`@adonis-agora/authkit-react`):
67
+
68
+ - `createAuthkitClient()` no longer reads `window.__AUTHKIT__`: pass `baseUrl` for `client.admin.*` and `csrfToken`.
69
+ - 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`.
70
+ - New: `client.account.agents.list()` / `revoke()`, `useAccountAgentsQueryOptions`, `useRevokeAccountAgentMutationOptions`.
71
+ - Peers: `react` / `react-dom` `^19.0.0`, `@inertiajs/react` `^2.0.0 || ^3.0.0`.
72
+
73
+ - `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`, …).
74
+ - `UserProfile`, `AuthorizedApps`, `OrganizationSwitcher` and `OrganizationProfile` need `QueryClientProvider` and `AuthkitClientProvider`.
75
+
76
+ All packages:
77
+
78
+ - `@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).
79
+ - Node.js `>=24` is required (tested on 24 and 26).
80
+
81
+ ### Patch Changes
82
+
83
+ - Updated dependencies [[`c942fe3`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/c942fe30483346217c9c89112e13db0d4a65c647)]:
84
+ - @adonis-agora/authkit-core@1.0.0-rc.0
85
+
86
+ ## 0.26.0
87
+
88
+ ### Minor Changes
89
+
90
+ - [#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 }`.
91
+
92
+ 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.
93
+
94
+ ## 0.25.2
95
+
96
+ ### Patch Changes
97
+
98
+ - [#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.
99
+
100
+ 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:
101
+
102
+ - 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.
103
+ - Editing roles answers `409 roles_managed_externally` (console `PATCH /api/users/:id/roles`, Admin API `PATCH /users/:id` with `globalRoles`). Other fields stay editable.
104
+ - The console shows the effective roles as read-only, with a note that the application manages them (`features.rolesManagedExternally` in the injected config).
105
+ - `AdminUser.roles?: string[]` in `@adonis-agora/authkit-react`.
106
+
107
+ Hosts without `resolveTokenRoles` keep editing `globalRoles` as before.
108
+
109
+ ## 0.25.1
110
+
111
+ ### Patch Changes
112
+
113
+ - [#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.
114
+
115
+ - 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.
116
+ - `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.
117
+ - Updated dependencies [[`1b9c90c`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/1b9c90ced4356d2c754e850e307954455ddeeb3a)]:
118
+ - @adonis-agora/authkit-core@0.10.1
119
+
120
+ ## 0.25.0
121
+
122
+ ### Minor Changes
123
+
124
+ - [#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.
125
+
126
+ ### Patch Changes
127
+
128
+ - Updated dependencies [[`b0ca480`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/b0ca4802419aba93a9f913775f697cc4075cff88)]:
129
+ - @adonis-agora/authkit-core@0.10.0
130
+
131
+ ## 0.24.1
132
+
133
+ ### Patch Changes
134
+
135
+ - [#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.
136
+
137
+ ## 0.24.0
138
+
139
+ ### Minor Changes
140
+
141
+ - [#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
142
+ connection count, lists and revokes connections across all accounts, and allows or blocks agents
143
+ at runtime on top of `defineConfig` (lib-owned `auth_agent_registry` table). Blocking also revokes
144
+ every connection and ends the agent's Poppy sessions. Writes need sudo and are audited.
145
+ `@adonis-agora/authkit-react` gets the matching `client.admin.personalAgents.*` methods and query
146
+ options.
147
+
148
+ ## 0.23.0
149
+
150
+ ### Minor Changes
151
+
152
+ - [#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
153
+
154
+ `ClientConfig` (core) e `AdminClient`/`CreateClientInput` (react) ganham o campo opcional
155
+ `applicationType`, para os clientes nativos (RFC 8252) do `@adonis-agora/authkit-server`.
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies [[`94644e6`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/94644e6b1d8d10e0fd3c4b57706cce46b70412cb)]:
160
+ - @adonis-agora/authkit-core@0.9.0
161
+
162
+ ## 0.22.0
163
+
164
+ ### Minor Changes
165
+
166
+ - [#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)
167
+
168
+ Lado React do espelho JSON de `/account/api/*`, para telas do próprio host.
169
+
170
+ - `client.account.orgs` ganha `create`, `activate`, `deactivate`, `leave`, `invite`,
171
+ `revokeInvitation`, `updateMemberRole`, `removeMember` e `acceptInvitation`.
172
+ - `client.account.mfa` vira uma FUNÇÃO COM PROPRIEDADES: `mfa()` continua sendo a leitura do
173
+ status (assinatura preservada) e as escritas penduram nela — `mfa.enroll()`,
174
+ `mfa.confirm(code)`, `mfa.disable()`, `mfa.regenerateRecoveryCodes()` e
175
+ `mfa.passkeys.{options,verify}`.
176
+ - Hooks novos: `useAccount{Create,Activate,Deactivate,Leave}OrgMutationOptions`,
177
+ `useAccount{InviteOrgMember,RevokeOrgInvitation,AcceptOrgInvitation,UpdateOrgMemberRole,RemoveOrgMember}MutationOptions`,
178
+ `use{Enroll,Confirm,Disable}TotpMutationOptions`,
179
+ `useRegenerateRecoveryCodesMutationOptions` e `useRegisterPasskeyMutationOptions`. O
180
+ prefixo `useAccount…` nos de org evita colidir com os homônimos da superfície ADMIN, que
181
+ agem sobre qualquer org.
182
+ - `registerPasskeyJson(client, deps?)`: a cerimônia de registro de passkey inteira por
183
+ fetch (options → `startRegistration` → verify), o par headless do `usePasskeyRegistration`
184
+ (que é por form de página inteira e não muda). Sem React, para quem não usa TanStack.
185
+ - `authkitKeys.account.mutations.*`: as chaves das novas mutations, com prefixos `orgs()` e
186
+ `mfa()` para `useIsMutating`.
187
+ - `AccountMfaStatus.recovery` ganha `remaining` e `regenerable`.
188
+
189
+ ## 0.21.0
190
+
191
+ ### Minor Changes
192
+
193
+ - 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.
194
+
195
+ 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/*`.
196
+
197
+ 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.
198
+
199
+ ### O que mudou
200
+
201
+ - **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.
202
+ - **Tipos do servidor** — `ListAccountsParams.limit` → `.size` e `ListAuditParams.limit` → `.size`. Stores de conta e sinks de auditoria customizados precisam ler o novo campo.
203
+ - **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).
204
+ - **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.
205
+ - **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).
206
+ - **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`.
207
+ - **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`.
208
+
209
+ ### Migração
210
+
211
+ ```diff
212
+ // HTTP
213
+ - GET /api/authkit/v1/users?page=2&limit=50
214
+ + GET /api/authkit/v1/users?page=2&size=50
215
+
216
+ // HTTP — resposta
217
+ - { "data": [...], "total": 137, "page": 2, "size": 50 }
218
+ + { "meta": { "page": 2, "size": 50, "total": 137 }, "data": [...] }
219
+
220
+ // SDK
221
+ - const { data, total, page, limit } = await authkit.users.list({ page: 2, limit: 50 })
222
+ + const { data, meta } = await authkit.users.list({ page: 2, size: 50 })
223
+ + // meta.page / meta.size / meta.total
224
+
225
+ // React
226
+ - useUsersQueryOptions({ search, page, limit: 20 })
227
+ + useUsersQueryOptions({ search, page, size: 20 })
228
+ - const total = data?.total ?? 0
229
+ + const total = data?.meta.total ?? 0
230
+
231
+ // AccountStore / AuditSink customizados
232
+ - async listAccounts({ search, page = 1, limit = 20 }: ListAccountsParams) {
233
+ - return { data: rows.slice((page - 1) * limit, page * limit), total }
234
+ + async listAccounts({ search, page = 1, size = 20 }: ListAccountsParams) {
235
+ + return { data: rows.slice((page - 1) * size, page * size), total }
236
+ }
237
+ ```
238
+
239
+ Callers que pediam `limit > 200` via HTTP passam a receber 200 itens por página — pagine com `page` para cobrir o resto.
240
+
241
+ ### Patch Changes
242
+
243
+ - bc32ea4: Bump runtime dependencies to their latest releases.
244
+
245
+ - `@simplewebauthn/server` and `@simplewebauthn/browser` go to `14.x`. The committed
246
+ `src/host/assets/webauthn.js` bundle was regenerated from the new `@simplewebauthn/browser`
247
+ (the `check:webauthn-bundle` guard would have caught the drift otherwise). The `authkit-react`
248
+ peer was **widened** to `^13.3.0 || ^14.0.0` instead of moved, so apps still on 13 keep
249
+ installing cleanly.
250
+ - `oidc-provider` 9.12.0 → 9.12.2 and `jose` 6.2.10 → 6.2.12 (patch releases on the token/JWT path).
251
+
252
+ No API change on our side: typecheck, tests, packaging smoke and the WebAuthn bundle check all pass.
253
+
254
+ ## 0.20.1
255
+
256
+ ### Patch Changes
257
+
258
+ - 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.
259
+
260
+ ## 0.20.0
261
+
262
+ ### Minor Changes
263
+
264
+ - cbc19f5: Hooks e tipos para a preferência de tipos de login por usuário
265
+
266
+ Novos hooks TanStack Query sobre a Account API `GET/PUT
267
+ /account/api/login-methods` (requer authkit-server com a feature):
268
+
269
+ - `useLoginMethodsQueryOptions()` — preferência do usuário + estado final
270
+ (`available`) + o que está travado (`locked`).
271
+ - `useUpdateLoginMethodsMutationOptions()` — grava a preferência; `{}` volta a
272
+ herdar os globais.
273
+
274
+ Tipos exportados: `AccountLoginMethodsResult`, `UpdateLoginMethodsResult`,
275
+ `UserLoginMethodsInput`. Query key nova: `authkitKeys.account.loginMethods()`.
276
+
277
+ ## 0.19.1
278
+
279
+ ### Patch Changes
280
+
281
+ - Updated dependencies [813a321]
282
+ - @adonis-agora/authkit-core@0.8.0
283
+
284
+ ## 0.19.0
285
+
286
+ ### Minor Changes
287
+
288
+ - 8f23a85: Fix the admin console's "Impersonate" button, both halves of it.
289
+
290
+ **It could never have worked.** The panel was built from `cfg.clients`, which is
291
+ always `[]` in a real installation — clients live in the OIDC adapter, created
292
+ through the console, the Admin API or `authkit:clients:create`, and the resolved
293
+ config never carries them. So the endpoint answered `404 no_token_exchange_client`
294
+ on every host that had not kept legacy static clients. Only the test suite, which
295
+ declared static clients, ever saw it succeed. `buildImpersonationPanel` now takes
296
+ the candidate clients as an argument and the controller reads them from the
297
+ adapter, falling back to static config clients for legacy hosts and for adapters
298
+ that cannot enumerate. A confidential runtime client renders a `<CLIENT_SECRET>`
299
+ placeholder rather than an empty secret, because the adapter cannot hand back a
300
+ secret that was shown once at creation.
301
+
302
+ **And the audit trail lied about it.** The endpoint recorded
303
+ `impersonation.started` before the UI had done anything — so a request that then
304
+ 404'd, or that the admin abandoned, left a record claiming an impersonation had
305
+ begun. Viewing the exchange parameters is not assuming an identity. The console
306
+ now records `impersonation.panel_viewed`, emitted only once a usable panel
307
+ exists; `impersonation` still belongs to the token-exchange handler, which is
308
+ where an identity is actually assumed. `impersonation.started` is gone from
309
+ `AuditEventType` — nothing emitted it under a truthful reading.
310
+
311
+ **The UI opened a field that never existed.** `result.data.url` type-checked only
312
+ because `ImpersonationPanel` in `@adonis-agora/authkit-react` carried an
313
+ `[key: string]: unknown` index signature; at runtime it was always
314
+ `window.open(undefined)`. The type is now closed over the real response, so that
315
+ line no longer compiles, and the console renders the exchange parameters with a
316
+ copyable request instead of trying to navigate somewhere.
317
+
318
+ ## 0.18.1
319
+
320
+ ### Patch Changes
321
+
322
+ - 1f15367: Point `homepage` and `bugs.url` at the repository's current name.
323
+
324
+ The repository was renamed to `adonis-agora-authkit`; `repository.url` followed,
325
+ `homepage` and `bugs.url` did not. Every package therefore shipped a manifest
326
+ that disagreed with itself, and the "Repository"/"Homepage" links on npm leaned
327
+ on GitHub's rename redirect — which lasts only until someone claims the old
328
+ name. All three fields now name the same repository.
329
+
330
+ - Updated dependencies [1f15367]
331
+ - @adonis-agora/authkit-core@0.7.1
332
+
333
+ ## 0.18.0
334
+
335
+ ### Minor Changes
336
+
337
+ - Login OTP e anti-duplo-submit nos formulários de interaction:
338
+
339
+ - `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.
340
+ - `MagicLinkButton` aceita `channel` (`'code'` | `'link'` — o choose-first do server 0.51) e mostra `pendingChildren` durante o voo do POST.
341
+ - `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).
342
+
343
+ ## 0.17.0
344
+
345
+ ### Minor Changes
346
+
347
+ - efd30df: Adiciona hooks e utilitários headless para o "dance" de sudo/passkey por form
348
+ clássico, para hosts com telas React próprias.
349
+
350
+ - `submitClassicForm({ action, fields, method? })`: cria um `<form>` nativo com
351
+ campos hidden e o submete (navegação real) — necessário porque os fluxos de
352
+ sudo/passkey respondem 302, que um `fetch` não segue como navegação. SSR-safe.
353
+ - `usePasskeyAssertion({ optionsUrl, actionUrl, csrfToken, returnTo? })` →
354
+ `{ run, running, error }`: pega as options (`x-csrf-token`), roda
355
+ `startAuthentication` e submete o `response` via form clássico (com `_csrf` e
356
+ `return_to` quando fornecidos).
357
+ - `usePasskeyRegistration(...)`: idem, com `startRegistration`.
358
+
359
+ Também exporta as peças de tier mais baixo reusadas por eles (`runPasskeyAssertion`,
360
+ `runPasskeyRegistration`, `registerPasskey`, `loadStartRegistration`). O
361
+ `submitPasskeyVerification` existente passa a delegar ao `submitClassicForm`,
362
+ sem mudança de comportamento.
363
+
364
+ ## 0.16.0
365
+
366
+ ### Minor Changes
367
+
368
+ - 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:
369
+ - **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.
370
+ - **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.
371
+ - **Componentes prontos (`MagicLinkButton`, `OAuthButton`)** — o "faz tudo", construídos sobre o primitivo/as funções, temáveis via `className`/`children`.
372
+ - **Helper `buttonClass(variant, extra)`** — centraliza a mescla de className dos botões do authkit (base + variante + extra do host), que os componentes repetiam.
373
+
374
+ ## 0.15.0
375
+
376
+ ### Minor Changes
377
+
378
+ - 9909753: Login por passkey disparado por clique, nas três camadas do ecossistema — o app deixa de reescrever a cerimônia à mão:
379
+
380
+ - **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.
381
+ - **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.
382
+ - **Componente pronto (`PasskeyButton`)** — o "faz tudo": botão + estado + erro, temável via `className`/`children`. Construído sobre o hook.
383
+
384
+ `@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).
385
+
386
+ ## 0.14.0
387
+
388
+ ### Minor Changes
389
+
390
+ - c12bac9: `authkit-react` drops app-role/authorization gating — that concern moved to
391
+ `@adonis-agora/authz-react`.
392
+
393
+ Removed:
394
+
395
+ - `AuthUser.appRoles`, `AuthSharedProps.authkit.appRoles`.
396
+ - `AuthState.appRoles`/`AuthState.hasAppRole()`.
397
+ - `hasAppRole`, `hasAnyAppRole`, `hasAllAppRoles` (from `roles.ts` and the package barrel).
398
+ - The `<Can>` component (`components/can.tsx`) and its `CanProps` type — it now lives in
399
+ `@adonis-agora/authz-react`, backed by the Authz service instead of app roles resolved
400
+ on the host.
401
+
402
+ `AuthState` is now `{ user, isAuthenticated, globalRoles, hasGlobalRole, hasAnyGlobalRole,
403
+ hasAllGlobalRoles }`.
404
+
405
+ Kept: `user`, `globalRoles`, `hasGlobalRole`/`hasAnyGlobalRole`/`hasAllGlobalRoles` — these
406
+ read from the IdP token via `@adonis-agora/authkit-client`, not from app-defined roles.
407
+ `<CanPermission>`/`useCan` (permission checks against the Authz `/authz/can` endpoint) are
408
+ unaffected.
409
+
410
+ ## 0.13.1
411
+
412
+ ### Patch Changes
413
+
414
+ - 70f5721: Ship peer dependencies as ranges instead of exact versions
415
+
416
+ `peerDependencies` pointed at the pinned `adonis`/`frontend` catalogs, and pnpm
417
+ inlines a catalog's literal value at publish time — so every published peer came
418
+ out exact. `@adonis-agora/authkit-server@0.34.1` on npm requires
419
+ `"@adonisjs/core": "7.3.3"`, which no app on 7.3.5 can satisfy;
420
+ `@adonis-agora/authkit-react@0.13.0` requires `"react": "19.2.6"`, which locks
421
+ out every consumer not on that exact patch.
422
+
423
+ Peers now resolve from three new range-only catalogs (`adonisPeers`,
424
+ `frontendPeers`, `miscPeers`). Dependencies keep the pinned catalogs — a pin is
425
+ right for reproducible installs and wrong for consumer compatibility, and the
426
+ two were sharing one source.
427
+
428
+ No source or runtime behaviour changes.
429
+
430
+ ## 0.13.0
431
+
432
+ ### Minor Changes
433
+
434
+ - 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`).
435
+ - 4bccbe9: fix: invalidate can-permission cache on principal change (stale authz after logout/org-switch)
436
+
437
+ The in-memory `useCan`/`checkCan` cache was process-global and keyed only by
438
+ `(path, permission, resource)`, so resolved permission decisions kept being
439
+ served across logout / user-switch / org-switch — a decision could outlive the
440
+ session that authorized it. The current principal (`useAuth().user?.id`, or an
441
+ `anon` sentinel when logged out) is now folded into the cache key, so a new
442
+ principal naturally misses the previous principal's answers and re-checks.
443
+
444
+ Also: `UseCanResult` now exposes an optional `error?: Error` (fail-closed:
445
+ `allowed` stays `false` on error), symmetric with `ResourceState<T>`; a public
446
+ `invalidateCanCache()` is exported to force a global refetch; and the warm-cache
447
+ render no longer triggers a redundant second `setState`.
448
+
449
+ ## 0.12.0
450
+
451
+ ### Minor Changes
452
+
453
+ - 0542665: Re-scope to @adonis-agora/authkit-\* (join the Agora ecosystem)
454
+
455
+ ### Patch Changes
456
+
457
+ - Updated dependencies [0542665]
458
+ - @adonis-agora/authkit-core@0.7.0
459
+
460
+ ## 0.11.0
461
+
462
+ ### Minor Changes
463
+
464
+ - 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`).
465
+
466
+ ## 0.10.0
467
+
468
+ ### Minor Changes
469
+
470
+ - 386a0df: feat: gestão de rotação de chave JWKS no React SDK. Novo `client.admin.keys.status()`
471
+ e `client.admin.keys.rotate()` (console API session-authed — sem API key no browser),
472
+ hooks headless TanStack `useKeysQueryOptions`/`useRotateKeysMutationOptions`, e o
473
+ componente `<KeyRotation>` (idade da chave, política, ETA e botão "Rotacionar agora").
474
+
475
+ ### Patch Changes
476
+
477
+ - Updated dependencies [93eaf69]
478
+ - Updated dependencies [e2582b8]
479
+ - @adonis-agora/authkit-core@0.6.0
480
+
481
+ ## 0.9.1
482
+
483
+ ### Patch Changes
484
+
485
+ - Updated dependencies [df4b41f]
486
+ - @adonis-agora/authkit-core@0.5.0
487
+
488
+ ## 0.9.0
489
+
490
+ ### Minor Changes
491
+
492
+ - a6ca8a7: Bring your own IdP — use AuthKit against any OIDC-compliant provider
493
+ - **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.
494
+ - **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.
495
+ - New "Bring your own IdP" docs page tying the two together.
496
+
497
+ ## 0.8.0
498
+
499
+ ### Minor Changes
500
+
501
+ - feat(account): global sign-out — revoke all sessions across all devices
502
+
503
+ **Server (`@adonis-agora/authkit-server`):**
504
+
505
+ - `POST /account/api/sessions/revoke-all` — revokes all OIDC sessions/grants for the account
506
+ and terminates the current Adonis console session (global logout).
507
+ Returns `{ ok: true, signedOut: true }` so the UI can redirect to login.
508
+ Emits audit event `account.signed_out_all`.
509
+
510
+ **React SDK (`@adonis-agora/authkit-react`):**
511
+
512
+ - `RevokeAllResult` type (`{ ok, signedOut, ...rest }`)
513
+ - `client.account.sessions.revokeAll()` method
514
+ - `useAccountRevokeAllSessionsMutationOptions()` hook (account namespace;
515
+ distinct from the admin `useRevokeAllSessionsMutationOptions`)
516
+
517
+ ## 0.7.0
518
+
519
+ ### Minor Changes
520
+
521
+ - feat(settings): org-scoped runtime settings (org → global → default resolution)
522
+ - `auth_settings` table gains `organization_id` column (nullable; NULL = global). Unique constraint on (key, organization_id).
523
+ - `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.
524
+ - Cache is org-scope-aware (cache key includes orgId).
525
+ - `resolveEffectiveOrganizationsPolicy` and `resolveEffectiveRolesCatalog` accept optional `orgId` and resolve org → global → default. All other resolvers remain global-only.
526
+ - Console JSON API (`/api/settings`) and Admin REST API accept `?organizationId=` query param for scoped reads/writes/deletes.
527
+ - 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.
528
+ - `@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?)`.
529
+ - `SettingEntry` type gains `organizationId: string | null` field.
530
+ - Existing rows default to `organization_id = NULL` (global) — no data migration needed.
531
+
532
+ ## 0.6.0
533
+
534
+ ### Minor Changes
535
+
536
+ - feat(console): gestão completa de organizations no console admin React
537
+
538
+ Adiciona CRUD completo de organizações na JSON API do console React
539
+ (console_orgs_controller) e na SPA (Orgs.tsx + orgs.containers.tsx):
540
+
541
+ **Novos endpoints no console React JSON API (`{adminPrefix}/api/orgs/*`):**
542
+
543
+ - `POST /api/orgs` → criar org (name + slug + ownerAccountId)
544
+ - `PATCH /api/orgs/:id` → editar nome/logo
545
+ - `DELETE /api/orgs/:id` → remover org
546
+ - `POST /api/orgs/:id/members` → adicionar membro (accountId + role)
547
+ - `PATCH /api/orgs/:id/members/:accountId` → alterar role do membro
548
+ - `DELETE /api/orgs/:id/members/:accountId` → remover membro
549
+ - `POST /api/orgs/:id/invitations` → criar convite (email + role)
550
+ - `DELETE /api/orgs/:id/invitations/:invitationId` → revogar convite
551
+
552
+ Todos os endpoints retornam 404 `capability_unsupported` quando o store não
553
+ suporta organizações. Lógica reutiliza `AdminOrgsService` (sem duplicação).
554
+
555
+ **SDK `@adonis-agora/authkit-react`:**
556
+
557
+ - `client.admin.orgs`: novos métodos `addMember`, `removeMember`,
558
+ `updateMemberRole`, `createInvitation`, `revokeInvitation`
559
+ - Novos hooks: `useAddOrgMemberMutationOptions`, `useRemoveOrgMemberMutationOptions`,
560
+ `useUpdateOrgMemberRoleMutationOptions`, `useCreateOrgInvitationMutationOptions`,
561
+ `useRevokeOrgInvitationMutationOptions`
562
+
563
+ **SPA do console:**
564
+
565
+ - Botão "New organization" na header (modal com name + slug auto-gerado + ownerAccountId)
566
+ - Empty state com CTA de criar
567
+ - Drawer da org: editar nome/logo, deletar (com confirmação), listar membros com
568
+ add/mudar-role/remover, convites pendentes com criar e revogar
569
+ - Padrão containers + skeleton + QueryBoundary + toasts
570
+
571
+ i18n: strings em inglês (interface do console); mensagens de erro do servidor em pt-BR.
572
+
573
+ ## 0.5.3
574
+
575
+ ### Patch Changes
576
+
577
+ - fix(sessions): listagem global no console admin quando accountId ausente
578
+ - `ConsoleSessionsController.index`: sem `accountId` retorna lista global de todas as sessões ativas (todas as contas) em vez de 400
579
+ - `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`
580
+ - `AdminSession`: novo campo opcional `email`
581
+ - `sessionDto`: inclui `email` na projeção JSON
582
+ - `AdminSessionEntry` (react types): campo `email: string | null`
583
+ - `UserSessionsResult` (react types): campo `truncated?: boolean`; renomeia `canList` → `supported` para alinhar com a resposta real do servidor
584
+ - SPA `sessions.containers.tsx`: exibe email acima do accountId na coluna Account quando presente
585
+ - Testes: cobre listagem global, truncamento a 500, capability ausente e resolução de email
586
+
587
+ ## 0.5.2
588
+
589
+ ### Patch Changes
590
+
591
+ - 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`.
592
+
593
+ ## 0.5.1
594
+
595
+ ### Patch Changes
596
+
597
+ - 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.
598
+
599
+ ## 0.5.0
600
+
601
+ ### Minor Changes
602
+
603
+ - Typed front-end client, TanStack Query hooks, and account JSON API:
604
+ - **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.
605
+ - **Typed front-end client** in `@adonis-agora/authkit-react`: `createAuthkitClient()` (auto-reads `window.__AUTHKIT__`) exposing `client.admin.*` and `client.account.*`, plus `AuthkitClientError`.
606
+ - **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.
607
+ - **Admin console SPA** now consumes these hooks internally (client-side fetching via TanStack Query) instead of a bespoke fetch wrapper.
608
+
609
+ ## 0.4.0
610
+
611
+ ### Minor Changes
612
+
613
+ - Rodauth parity completion + React admin console:
614
+ - **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.
615
+ - **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).
616
+ - **Common-password block**: `password_policy.blockCommon` (default on) rejects the ~10k most common passwords offline, before the HIBP check.
617
+ - **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.
618
+ - **WebAuthn autofill**: `auth_methods.passkeyAutofill` enables conditional-mediation passkey suggestions on the login field; new `usePasskeyAutofill` React hook.
619
+ - **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.
620
+
621
+ ## 0.3.2
622
+
623
+ ### Patch Changes
624
+
625
+ - Updated dependencies
626
+ - @adonis-agora/authkit-core@0.4.0
627
+
628
+ ## 0.3.1
629
+
630
+ ### Patch Changes
631
+
632
+ - Updated dependencies
633
+ - @adonis-agora/authkit-core@0.3.1
634
+
635
+ ## 0.3.0
636
+
637
+ ### Minor Changes
638
+
639
+ - Round 7 — production pack + multi-tenancy:
640
+ - **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.
641
+ - **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()`.
642
+ - **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 />`.
643
+ - **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.
644
+ - **Bot protection**: pluggable vendor-agnostic `botProtection` config (Turnstile/hCaptcha-ready, fail-safe) on login/signup/reset.
645
+ - **New-device login notification**: `notifications.newDeviceEmail` + `mail.onNewDeviceLogin` hook driven by the trusted-device signal.
646
+ - **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()`.
647
+
648
+ ### Patch Changes
649
+
650
+ - Updated dependencies
651
+ - @adonis-agora/authkit-core@0.3.0
652
+
653
+ ## 0.2.0
654
+
655
+ ### Minor Changes
656
+
657
+ - 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.
658
+
659
+ ## 0.1.2
660
+
661
+ ### Patch Changes
662
+
663
+ - Updated dependencies [1872a30]
664
+ - @adonis-agora/authkit-core@0.2.0
665
+
666
+ ## 0.1.1
667
+
668
+ ### Patch Changes
669
+
670
+ - Refactors do code review (comportamento preservado, contratos mais limpos):
671
+
672
+ **server (minor):**
673
+
674
+ - `AccountStore` decomposto em interfaces de capacidade (`CoreAccountStore`,
675
+ `MfaCapability`, `WebauthnCapability`, `ProviderIdentityCapability`) com type
676
+ guards (`supportsMfa`/`supportsPasskeys`/`supportsProviderIdentity`). O tipo
677
+ `AccountStore` continua existindo (core & Partial<capacidades>) — compatível.
678
+ `lucidAccountStore` agora OMITE os métodos de capacidades não configuradas em
679
+ vez de lançar em runtime; social login sem provider-identity degrada pro login.
680
+ - Sequência login+lockout centralizada em `attemptPasswordLogin` (era duplicada
681
+ em 2 controllers).
682
+ - `adminGuard` agora retorna 404 quando `admin.enabled: false` (fecha bypass de
683
+ drift entre config e `AuthHostOptions.admin`).
684
+ - `dynamicRegistration.management: true` sem `enabled: true` agora falha no
685
+ resolve do config (RFC 7592 exige 7591).
686
+ - Serialização JSON dos mixins unificada em `jsonColumn()` (semântica por coluna
687
+ preservada).
688
+
689
+ **client (minor):**
690
+
691
+ - POST ao token endpoint unificado (`exchangeCode`/`refreshTokens`/`exchangeToken`).
692
+ - Introspection + claims→Identity compartilhados entre resolvers; `pat`/`opaque`
693
+ agora também mapeiam `picture→profile.avatarUrl` e `sid→sessionId` (alinhados
694
+ ao `jwt`).
695
+
696
+ **react (patch):**
697
+
698
+ - Helpers genéricos de roles; warn de dev no `useAuth` quando não há
699
+ `AuthProvider` nem shared prop do Inertia.