@hyper.authio/testing 0.1.1 → 0.8.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/README.md CHANGED
@@ -27,12 +27,42 @@ const token = await authio.issueAccessToken({
27
27
  await authio.close();
28
28
  ```
29
29
 
30
- - Endpoints: discovery, JWKS, token (client credentials, authorization code via `createAuthorizationCode`, refresh
31
- with rotation, token exchange including connected accounts, password, device code), introspection (answered
32
- according to who asks, like Authio), revocation, UserInfo (JSON, or a signed JWT with `userInfoAsJwt`) and device
33
- authorization.
34
- - Client authentication: `client_secret_basic`, `client_secret_post`, `private_key_jwt` (register `publicKey`) and
35
- `none`.
30
+ - Endpoints: discovery (every endpoint it advertises is served), JWKS, authorization, token (client credentials,
31
+ authorization code with ID tokens, refresh with rotation, token exchange including connected accounts, password,
32
+ device code, personal access token), introspection (answered according to who asks, like Authio), revocation,
33
+ UserInfo (JSON, or a signed JWT with `userInfoAsJwt`), device authorization and end session.
34
+ - Sign-in: `authorize(url)` follows an authorization URL as a browser would and returns the callback URL (or, for
35
+ `response_mode=web_message`, the posted parameters). It signs in `signInAs`, the `login_hint` or the first user;
36
+ honours PKCE (S256, plain; `code_challenge_method` is required), `prompt` (`none` answers `login_required` without a
37
+ session, `login` signs in again),
38
+ `max_age`, `acr_values`, and sends RFC 9207 `iss` (`omitAuthorizationIssuer` leaves it out). ID tokens carry `nonce`,
39
+ `sid`, `auth_time`, `acr`, `amr` and `at_hash`. `createAuthorizationCode` still mints a code directly.
40
+ - Sign-out: the end-session endpoint checks `post_logout_redirect_uri`, echoes `state`, and posts a logout token to the
41
+ `backchannelLogoutUri` of every client of the session (`backchannelDeliveries`); `deliverBackchannelLogout` and
42
+ `createLogoutToken` do it by hand. Ending a session revokes its refresh tokens; `revokeRefreshTokens({ sub | sid })`
43
+ and `revokeToken(token)` revoke them by hand.
44
+ - Refresh tokens carry the session's `sid` through refreshes and are introspectable by the client they were issued to
45
+ (`token_type` `Refresh`), as a BFF's session check needs.
46
+ - JWE: a client with `encryption: { key, algorithm }` (RSA-OAEP or RSA-OAEP-256) gets its ID tokens, UserInfo, and
47
+ optionally access and logout tokens encrypted; `issueAccessToken({ encryptTo })` mints one directly.
48
+ - Personal access tokens: `personalAccessTokens: [{ token: "pat_…", sub, clientId? }]`.
49
+ - Clients are configured as in Authio's console, and the fake enforces it as Authio does, refusing with an error that
50
+ names the setting and accepting what the client does not require:
51
+ - `tokenEndpointAuthMethod`: `client_secret_basic` (default with `clientSecret`), `client_secret_post`,
52
+ `private_key_jwt` (default with only `publicKey`) or `none` (default with neither), matched exactly
53
+ (`invalid_client`); a secret sent by a `none` client is ignored.
54
+ - `requirePkce` (default `true`, as Authio creates clients) refuses an authorization request without
55
+ `code_challenge`: declare `requirePkce: false` for a client with PKCE off. `pkceMethods` (default `["S256"]`)
56
+ refuses another method even when PKCE is not required; PKCE sent to a client that does not require it is checked
57
+ and accepted.
58
+ - `signingAlgorithm`: `RS256` (default) or `HS256`/`HS384`/`HS512` with the client secret, for the client's ID
59
+ tokens, UserInfo and logout tokens; `accessTokenSigningAlgorithm` the same for its access tokens, as Authio keeps
60
+ two settings. The secret needs at least 32, 48 or 64 bytes (RFC 7518 §3.2), or the client is refused.
61
+ - `issueIdTokenOnRefresh` adds a new ID token to every refresh.
62
+ - `frontchannelLogoutUri` (with `frontchannelLogoutSessionRequired` for `iss` and `sid`) is loaded when a session of
63
+ the client ends (`frontchannelDeliveries`); `frontchannelLogoutUrl` and `deliverFrontchannelLogout` do it by hand.
64
+ - `response_mode` other than `query` and `web_message` is refused.
65
+ - `clock` (such as the `ManualClock` the library uses) is the time tokens are issued and checked with.
36
66
  - `issueAccessToken` options: `expiresIn` (negative for an expired token), `type` (`ID` for a non-access token),
37
67
  `issuer`, `untrusted` (a signature that does not verify).
38
68
  - `failures.set("token", [{ status: 503 }])` answers the next calls to an endpoint with errors; `deviceOutcomes`