@adonis-agora/authkit-sdk 0.7.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 +340 -0
- package/build/src/embedded_driver.js +3 -1
- package/build/src/types.d.ts +5 -1
- package/package.json +13 -9
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
# @adonis-agora/authkit-sdk
|
|
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
|
+
## 0.8.0
|
|
61
|
+
|
|
62
|
+
### Minor Changes
|
|
63
|
+
|
|
64
|
+
- [#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.
|
|
65
|
+
|
|
66
|
+
## 0.7.2
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- [#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.
|
|
71
|
+
|
|
72
|
+
## 0.7.1
|
|
73
|
+
|
|
74
|
+
### Patch Changes
|
|
75
|
+
|
|
76
|
+
- [#230](https://github.com/DavideCarvalho/adonis-agora-authkit/pull/230) [`4e424bf`](https://github.com/DavideCarvalho/adonis-agora-authkit/commit/4e424bf18f8c0cea30ae1352056b2017f661510d) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - O claim de organização passa a refletir a membership atual, e remover um membro revoga o acesso na hora
|
|
77
|
+
|
|
78
|
+
O `org_id`/`org_slug`/`org_role` do token vinha do `activeOrg` gravado no `Grant` no
|
|
79
|
+
consent, e o refresh o reemitia **sem perguntar se a conta ainda era membro** da org,
|
|
80
|
+
nem se a org ainda existia. Com refresh token de 30 dias, quem era removido da equipe
|
|
81
|
+
seguia recebendo token com o claim da org por até um mês — e um rebaixado seguia com
|
|
82
|
+
o papel antigo.
|
|
83
|
+
|
|
84
|
+
- **Emissão/refresh:** antes de emitir `org_*`, a lib confere no account store que a
|
|
85
|
+
conta ainda é membro da org (`getOrgMembership`) e que a org existe (`findOrgById`).
|
|
86
|
+
Se não for, o token sai **sem** claims de org. `org_role` é sempre o papel **atual**
|
|
87
|
+
da membership e `org_slug` o slug atual — nunca o retrato do consent. O
|
|
88
|
+
`resolveTokenRoles` recebe o `activeOrg` já conferido.
|
|
89
|
+
- **Remoção:** sair da org, remover um membro (form `/account/orgs`, `/account/api/orgs`,
|
|
90
|
+
console admin e Admin API) ou apagar a org revoga os grants que carregam aquela org
|
|
91
|
+
para aquela conta (ou para todas, no `deleteOrg`), com os access/refresh tokens deles,
|
|
92
|
+
e grava a revogação por `sub` para clients cookie-based. Grants de outras orgs e sem
|
|
93
|
+
org ficam intactos. Novo método `AdminSessionsService.revokeOrgGrants(orgId, accountId?)`.
|
|
94
|
+
O driver embedded do `@adonis-agora/authkit-sdk` (`organizations.delete`,
|
|
95
|
+
`organizations.members.remove`) revoga do mesmo jeito.
|
|
96
|
+
|
|
97
|
+
Mudança de comportamento: um store sem `findOrgById`/`getOrgMembership` não tem como
|
|
98
|
+
conferir a membership, então deixa de emitir `org_*` (antes emitia o que viesse do
|
|
99
|
+
cookie/grant). As rotas que gravam o cookie de org só existem com a capacidade.
|
|
100
|
+
|
|
101
|
+
## 0.7.0
|
|
102
|
+
|
|
103
|
+
### Minor Changes
|
|
104
|
+
|
|
105
|
+
- 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.
|
|
106
|
+
|
|
107
|
+
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/*`.
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
### O que mudou
|
|
112
|
+
|
|
113
|
+
- **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.
|
|
114
|
+
- **Tipos do servidor** — `ListAccountsParams.limit` → `.size` e `ListAuditParams.limit` → `.size`. Stores de conta e sinks de auditoria customizados precisam ler o novo campo.
|
|
115
|
+
- **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).
|
|
116
|
+
- **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.
|
|
117
|
+
- **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).
|
|
118
|
+
- **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`.
|
|
119
|
+
- **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`.
|
|
120
|
+
|
|
121
|
+
### Migração
|
|
122
|
+
|
|
123
|
+
```diff
|
|
124
|
+
// HTTP
|
|
125
|
+
- GET /api/authkit/v1/users?page=2&limit=50
|
|
126
|
+
+ GET /api/authkit/v1/users?page=2&size=50
|
|
127
|
+
|
|
128
|
+
// HTTP — resposta
|
|
129
|
+
- { "data": [...], "total": 137, "page": 2, "size": 50 }
|
|
130
|
+
+ { "meta": { "page": 2, "size": 50, "total": 137 }, "data": [...] }
|
|
131
|
+
|
|
132
|
+
// SDK
|
|
133
|
+
- const { data, total, page, limit } = await authkit.users.list({ page: 2, limit: 50 })
|
|
134
|
+
+ const { data, meta } = await authkit.users.list({ page: 2, size: 50 })
|
|
135
|
+
+ // meta.page / meta.size / meta.total
|
|
136
|
+
|
|
137
|
+
// React
|
|
138
|
+
- useUsersQueryOptions({ search, page, limit: 20 })
|
|
139
|
+
+ useUsersQueryOptions({ search, page, size: 20 })
|
|
140
|
+
- const total = data?.total ?? 0
|
|
141
|
+
+ const total = data?.meta.total ?? 0
|
|
142
|
+
|
|
143
|
+
// AccountStore / AuditSink customizados
|
|
144
|
+
- async listAccounts({ search, page = 1, limit = 20 }: ListAccountsParams) {
|
|
145
|
+
- return { data: rows.slice((page - 1) * limit, page * limit), total }
|
|
146
|
+
+ async listAccounts({ search, page = 1, size = 20 }: ListAccountsParams) {
|
|
147
|
+
+ return { data: rows.slice((page - 1) * size, page * size), total }
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Callers que pediam `limit > 200` via HTTP passam a receber 200 itens por página — pagine com `page` para cobrir o resto.
|
|
152
|
+
|
|
153
|
+
## 0.6.4
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- f287ade: Widen the `@adonis-agora/*` peer ranges so they survive the peer's next minor.
|
|
158
|
+
|
|
159
|
+
Below 1.0.0 a caret does not mean "this minor and up" — it stops at the next
|
|
160
|
+
minor, so `^0.22.0` expands to `>=0.22.0 <0.23.0`. Every sibling package in this
|
|
161
|
+
ecosystem ships minors constantly, which meant **all four** `@adonis-agora/*`
|
|
162
|
+
peers were unsatisfiable against the current release of the package they name.
|
|
163
|
+
Under npm this is not a warning: installing `@adonis-agora/authkit-server`
|
|
164
|
+
alongside `@adonis-agora/durable@0.24.0` failed outright with
|
|
165
|
+
`ERESOLVE — Conflicting peer dependency: @adonis-agora/durable@0.22.0`.
|
|
166
|
+
|
|
167
|
+
Each floor was chosen from what the code actually calls, not from what the range
|
|
168
|
+
happened to say:
|
|
169
|
+
|
|
170
|
+
| peer | was | now | why that floor |
|
|
171
|
+
| -------------------------- | --------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
172
|
+
| `@adonis-agora/durable` | `^0.22.0` | `>=0.7.0 <1.0.0` | first release with `ctx.localStep`, absent in 0.6.1 |
|
|
173
|
+
| `@adonis-agora/media` | `^0.1.0` | `>=0.5.0 <1.0.0` | first release exporting the `./single-file` subpath the avatar uploader imports, absent in 0.4.0 |
|
|
174
|
+
| `@adonis-agora/telescope` | `^0.1.0` | `>=0.1.0 <1.0.0` | all five imported types are shape-identical from 0.1.0 through 0.8.1 |
|
|
175
|
+
| `@adonis-agora/resilience` | `^0.1.0` | `>=0.1.0 <1.0.0` | `wrap()` has existed since 0.1.0, and the policy is duck-typed against a locally declared interface rather than imported |
|
|
176
|
+
|
|
177
|
+
The `^0.22.0` on durable in particular came from the `ctx.step` → `ctx.localStep`
|
|
178
|
+
migration and recorded the version current on that day, some fifteen minors above
|
|
179
|
+
what the migration actually required.
|
|
180
|
+
|
|
181
|
+
`@adonis-agora/authkit-sdk`'s peer on `@adonis-agora/authkit-server` gains the
|
|
182
|
+
same upper bound (`>=0.10.0 <1.0.0`), which it was missing entirely — it would
|
|
183
|
+
have accepted a future 1.0 with breaking changes.
|
|
184
|
+
|
|
185
|
+
A spec now scans every package manifest and fails on a caret or tilde over a 0.x
|
|
186
|
+
`@adonis-agora/*` peer, so this cannot come back quietly.
|
|
187
|
+
|
|
188
|
+
## 0.6.3
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- 8f23a85: Organization invitations send an email even without a `mail.onOrgInvitation` hook.
|
|
193
|
+
|
|
194
|
+
`onOrgInvitation` was the only hook in `MailHooks` with no default-mailer
|
|
195
|
+
fallback. Every other one degrades to a branded, translated email the host kit
|
|
196
|
+
sends itself; this one was guarded by a bare `if (cfg.mail?.onOrgInvitation)`
|
|
197
|
+
with no `else`, so a host that had not written the hook created the invitation
|
|
198
|
+
row and sent nothing. The invited person was never told they had been invited,
|
|
199
|
+
and nothing anywhere reported a problem.
|
|
200
|
+
|
|
201
|
+
`sendOrgInvitationEmail` now exists alongside the other `send*Email` functions,
|
|
202
|
+
with `mail.org_invitation.*` messages in both the English and pt-BR tables, and
|
|
203
|
+
both HTTP call sites — the account-facing controller and the admin service — use
|
|
204
|
+
the host hook when present and the library default otherwise. Delivery stays
|
|
205
|
+
best-effort: a mail failure never breaks invitation creation.
|
|
206
|
+
|
|
207
|
+
The SDK's embedded driver reached the same service through a third door and had
|
|
208
|
+
to be fixed with it. Its out-of-band context now carries the container resolver
|
|
209
|
+
and a logger, which is all the default mailer reads, so an invitation created
|
|
210
|
+
through `authkit.organizations.invitations.create()` reaches an inbox too rather
|
|
211
|
+
than reproducing the original silent failure one layer down.
|
|
212
|
+
|
|
213
|
+
One latent bug fell out of the rework: the account controller resolved the
|
|
214
|
+
organization and the issuer origin _outside_ its `try`, so a config with an
|
|
215
|
+
unresolvable issuer would have thrown out of a path that must never break
|
|
216
|
+
invitation creation. Both are inside the guarded block now.
|
|
217
|
+
|
|
218
|
+
## 0.6.2
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- 1f15367: Point `homepage` and `bugs.url` at the repository's current name.
|
|
223
|
+
|
|
224
|
+
The repository was renamed to `adonis-agora-authkit`; `repository.url` followed,
|
|
225
|
+
`homepage` and `bugs.url` did not. Every package therefore shipped a manifest
|
|
226
|
+
that disagreed with itself, and the "Repository"/"Homepage" links on npm leaned
|
|
227
|
+
on GitHub's rename redirect — which lasts only until someone claims the old
|
|
228
|
+
name. All three fields now name the same repository.
|
|
229
|
+
|
|
230
|
+
## 0.6.1
|
|
231
|
+
|
|
232
|
+
### Patch Changes
|
|
233
|
+
|
|
234
|
+
- 70f5721: Ship peer dependencies as ranges instead of exact versions
|
|
235
|
+
|
|
236
|
+
`peerDependencies` pointed at the pinned `adonis`/`frontend` catalogs, and pnpm
|
|
237
|
+
inlines a catalog's literal value at publish time — so every published peer came
|
|
238
|
+
out exact. `@adonis-agora/authkit-server@0.34.1` on npm requires
|
|
239
|
+
`"@adonisjs/core": "7.3.3"`, which no app on 7.3.5 can satisfy;
|
|
240
|
+
`@adonis-agora/authkit-react@0.13.0` requires `"react": "19.2.6"`, which locks
|
|
241
|
+
out every consumer not on that exact patch.
|
|
242
|
+
|
|
243
|
+
Peers now resolve from three new range-only catalogs (`adonisPeers`,
|
|
244
|
+
`frontendPeers`, `miscPeers`). Dependencies keep the pinned catalogs — a pin is
|
|
245
|
+
right for reproducible installs and wrong for consumer compatibility, and the
|
|
246
|
+
two were sharing one source.
|
|
247
|
+
|
|
248
|
+
No source or runtime behaviour changes.
|
|
249
|
+
|
|
250
|
+
## 0.6.0
|
|
251
|
+
|
|
252
|
+
### Minor Changes
|
|
253
|
+
|
|
254
|
+
- 0542665: Re-scope to @adonis-agora/authkit-\* (join the Agora ecosystem)
|
|
255
|
+
|
|
256
|
+
## 0.5.0
|
|
257
|
+
|
|
258
|
+
### Minor Changes
|
|
259
|
+
|
|
260
|
+
- 6fe2aa7: feat: rotação automática de chaves JWKS (age-based) + política + endpoints + SDK.
|
|
261
|
+
|
|
262
|
+
Nova setting `key_rotation` (`{enabled,maxAgeDays,keep}`, default OFF). Um scheduler
|
|
263
|
+
de housekeeping (web-only, fail-safe) rotaciona a chave quando ela passa de
|
|
264
|
+
`maxAgeDays` e aplica AO VIVO (sem restart, via `reloadKeys` da Fatia C), com
|
|
265
|
+
single-flight via `@adonisjs/lock` (peer opcional; sem ele assume single-instance).
|
|
266
|
+
`OidcService` ganha `rotateKeys()`/`keystoreAgeDays()` (rotate+reload serializados).
|
|
267
|
+
|
|
268
|
+
Dois tiers de endpoint admin para status + "rotacionar agora":
|
|
269
|
+
|
|
270
|
+
- **REST API** `GET/POST /api/authkit/v1/keys` (Bearer key) — para backend/automação;
|
|
271
|
+
- **Console API** `GET/POST {adminPrefix}/api/keys` (sessão + role admin) — para o browser.
|
|
272
|
+
|
|
273
|
+
`@adonis-agora/authkit-sdk` expõe `authkit.keys.status()` / `authkit.keys.rotate()`
|
|
274
|
+
(drivers remote + embedded). `@adonisjs/lock` é peer OPCIONAL.
|
|
275
|
+
|
|
276
|
+
Default OFF: nada rotaciona automaticamente até um admin habilitar `key_rotation`.
|
|
277
|
+
|
|
278
|
+
## 0.4.1
|
|
279
|
+
|
|
280
|
+
### Patch Changes
|
|
281
|
+
|
|
282
|
+
- RuntimeSettings now probes the `auth_settings` table with a real `SELECT` (search_path-aware) instead of `schema.hasTable`, and follows the account store's named connection (`lucidAccountStore` exposes `connectionName` from the model). Hosts storing auth on a named connection (e.g. `connection: 'auth'`) no longer see every runtime setting as "table absent".
|
|
283
|
+
|
|
284
|
+
## 0.4.0
|
|
285
|
+
|
|
286
|
+
### Patch Changes
|
|
287
|
+
|
|
288
|
+
- Re-baseline de versionamento: 1.3.0 → 0.4.0 (código idêntico ao 1.3.0). O SDK nasceu por engano em 1.0.0; volta para 0.x para sinalizar a mesma maturidade dos demais pacotes do ecossistema (server 0.13, client 0.4, react 0.3). As versões 1.x ficam deprecadas no npm.
|
|
289
|
+
|
|
290
|
+
## 1.3.0
|
|
291
|
+
|
|
292
|
+
### Minor Changes
|
|
293
|
+
|
|
294
|
+
- Configurable Admin REST API prefix: `registerAuthHost(router, { adminApi: { prefix: '/authkit/api' } })` mounts the API under a custom prefix (default `/api/authkit/v1` unchanged; `adminApi: true` keeps working). The SDK remote driver gains a matching `apiPrefix` option in `createAuthkit`.
|
|
295
|
+
|
|
296
|
+
## 1.2.0
|
|
297
|
+
|
|
298
|
+
### Minor Changes
|
|
299
|
+
|
|
300
|
+
- Runtime settings + bot protection UI toggle:
|
|
301
|
+
- **Runtime settings store**: optional capability-probed `auth_settings` table with `SettingsCapability`, `supportsSettings` type guard and a `RuntimeSettings` service (15s TTL cache, fail-safe fallback to static config on any DB error or missing table).
|
|
302
|
+
- **Bot protection runtime toggle**: the `bot_protection` setting key (`{ enabled, on? }`) turns bot protection on/off and overrides protected actions without redeploying — the `verify` hook still comes from config (it is code). No setting/table = static config, zero breaking changes.
|
|
303
|
+
- **Admin console**: new `/admin/settings` page with the bot-protection card (toggle + action checkboxes, disabled state when `verify` is not configured, schema hint when the table is absent). Audit event `settings.updated`.
|
|
304
|
+
- **Admin REST API**: `GET/PUT/DELETE /api/authkit/v1/settings[/:key]` (404 when capability absent).
|
|
305
|
+
- **SDK**: `authkit.settings.list()/get()/set()/delete()` in both remote and embedded drivers.
|
|
306
|
+
- **Doctor**: `checkSettings` warns about an orphan `bot_protection` setting when `botProtection.verify` is absent from config.
|
|
307
|
+
|
|
308
|
+
### Patch Changes
|
|
309
|
+
|
|
310
|
+
- Updated dependencies
|
|
311
|
+
- @adonis-agora/authkit-server@0.10.0
|
|
312
|
+
|
|
313
|
+
## 1.1.0
|
|
314
|
+
|
|
315
|
+
### Minor Changes
|
|
316
|
+
|
|
317
|
+
- Round 7 — production pack + multi-tenancy:
|
|
318
|
+
- **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.
|
|
319
|
+
- **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()`.
|
|
320
|
+
- **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 />`.
|
|
321
|
+
- **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.
|
|
322
|
+
- **Bot protection**: pluggable vendor-agnostic `botProtection` config (Turnstile/hCaptcha-ready, fail-safe) on login/signup/reset.
|
|
323
|
+
- **New-device login notification**: `notifications.newDeviceEmail` + `mail.onNewDeviceLogin` hook driven by the trusted-device signal.
|
|
324
|
+
- **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()`.
|
|
325
|
+
|
|
326
|
+
### Patch Changes
|
|
327
|
+
|
|
328
|
+
- Updated dependencies
|
|
329
|
+
- @adonis-agora/authkit-server@0.9.0
|
|
330
|
+
|
|
331
|
+
## 1.0.0
|
|
332
|
+
|
|
333
|
+
### Minor Changes
|
|
334
|
+
|
|
335
|
+
- b205782: Primeiro release do SDK backend (@adonis-agora/authkit-sdk): uma interface tipada com dois drivers — `remote` (HTTP contra a Admin REST API `/api/authkit/v1` com Bearer API key) e `embedded` (in-process, quando o IdP roda no mesmo app AdonisJS). Cobre users, sessions, clients, audit e tokens.verify, com erros mapeados para `AuthkitApiError`.
|
|
336
|
+
|
|
337
|
+
### Patch Changes
|
|
338
|
+
|
|
339
|
+
- Updated dependencies [93bfc4f]
|
|
340
|
+
- @adonis-agora/authkit-server@0.8.0
|
|
@@ -78,10 +78,12 @@ export async function createEmbeddedAuthkit(opts) {
|
|
|
78
78
|
return {
|
|
79
79
|
clientId: client.clientId,
|
|
80
80
|
confidential: client.confidential,
|
|
81
|
-
|
|
81
|
+
grantTypes: client.grantTypes,
|
|
82
82
|
redirectUris: client.redirectUris,
|
|
83
83
|
postLogoutRedirectUris: client.postLogoutRedirectUris,
|
|
84
84
|
tokenEndpointAuthMethod: client.tokenEndpointAuthMethod,
|
|
85
|
+
clientName: client.clientName ?? null,
|
|
86
|
+
logoUri: client.logoUri ?? null,
|
|
85
87
|
};
|
|
86
88
|
}
|
|
87
89
|
function sessionDto(s) {
|
package/build/src/types.d.ts
CHANGED
|
@@ -119,10 +119,14 @@ export interface RevokeSessionsResult {
|
|
|
119
119
|
export interface AuthkitClient {
|
|
120
120
|
clientId: string;
|
|
121
121
|
confidential: boolean;
|
|
122
|
-
|
|
122
|
+
grantTypes: string[];
|
|
123
123
|
redirectUris: string[];
|
|
124
124
|
postLogoutRedirectUris: string[];
|
|
125
125
|
tokenEndpointAuthMethod: string;
|
|
126
|
+
/** Registered `client_name`, or `null`. */
|
|
127
|
+
clientName: string | null;
|
|
128
|
+
/** Registered `logo_uri`, or `null`. */
|
|
129
|
+
logoUri: string | null;
|
|
126
130
|
}
|
|
127
131
|
export interface ListClientsResult {
|
|
128
132
|
data: AuthkitClient[];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonis-agora/authkit-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.0",
|
|
4
4
|
"description": "Backend SDK for the AuthKit Admin API with one typed interface and two drivers: remote (HTTP/Bearer) and embedded (in-process when the IdP runs in the same AdonisJS app).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "dudousxd",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/DavideCarvalho/adonis-agora-authkit.git",
|
|
9
|
+
"url": "git+https://github.com/DavideCarvalho/adonis-agora-authkit.git",
|
|
10
10
|
"directory": "packages/authkit-sdk"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://davidecarvalho.github.io/agora/docs/authkit",
|
|
@@ -28,14 +28,18 @@
|
|
|
28
28
|
"main": "./build/index.js",
|
|
29
29
|
"types": "./build/index.d.ts",
|
|
30
30
|
"files": [
|
|
31
|
-
"build"
|
|
31
|
+
"build",
|
|
32
|
+
"CHANGELOG.md"
|
|
32
33
|
],
|
|
33
34
|
"exports": {
|
|
34
35
|
".": "./build/index.js",
|
|
35
36
|
"./types": "./build/index.js"
|
|
36
37
|
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=24"
|
|
40
|
+
},
|
|
37
41
|
"peerDependencies": {
|
|
38
|
-
"@adonis-agora/authkit-server": ">=0.10.0 <1.0.0",
|
|
42
|
+
"@adonis-agora/authkit-server": ">=0.10.0 <2.0.0 || >=1.0.0-rc.0 <2.0.0",
|
|
39
43
|
"@adonisjs/core": "^7.5.0"
|
|
40
44
|
},
|
|
41
45
|
"peerDependenciesMeta": {
|
|
@@ -47,13 +51,13 @@
|
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
50
|
-
"@adonis-agora/authkit-server": "0.
|
|
51
|
-
"@adonisjs/core": "7.
|
|
54
|
+
"@adonis-agora/authkit-server": "1.0.0-rc.0",
|
|
55
|
+
"@adonisjs/core": "7.6.0",
|
|
52
56
|
"@adonisjs/tsconfig": "2.0.0",
|
|
53
57
|
"@japa/assert": "4.2.0",
|
|
54
|
-
"@japa/runner": "5.
|
|
55
|
-
"@poppinss/ts-exec": "1.
|
|
56
|
-
"@types/node": "26.5
|
|
58
|
+
"@japa/runner": "5.4.0",
|
|
59
|
+
"@poppinss/ts-exec": "1.5.2",
|
|
60
|
+
"@types/node": "26.6.5",
|
|
57
61
|
"typescript": "7.0.2"
|
|
58
62
|
},
|
|
59
63
|
"scripts": {
|