@jskit-ai/auth-core 0.2.27 → 0.2.29

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - **Breaking:** `./server/passSignIn` is gone. `signPass`, `verifyPass` and `resolvePassSignInFromEnv` moved unchanged to `@jskit-ai/auth-pass/server`, a package that installs no providers, so an application with its own sign-in can check passes without auth-core's runtime. `AUTH_TEXTS` loses the seven `pass*` entries and `locales/en.json` the `auth.pass.*` texts; they are `PASS_TEXTS` and `createPassError` in auth-pass, whose catalog has the same English. Import from `@jskit-ai/auth-pass/server` instead. `AUTH_PATHS.LOGIN_PASS` and the auth service's `signInWithPass({ pass })` stay here.
6
+ - One-time pass sign-in: `./server/passSignIn` exports `signPass` (for the issuer, which holds an Ed25519 private key), `verifyPass` and `resolvePassSignInFromEnv`. A pass is a compact JWS (`alg` EdDSA, `typ` `pass+jwt`) naming one person (`sub`), one application (`aud`), one resource (`resource`) and its id (`jti`), lasting 60 seconds by default and at most five minutes. `AUTH_PASS_PUBLIC_KEY` (PEM, or base64 DER on one line) turns it on, with `AUTH_PASS_AUDIENCE` and `AUTH_PASS_RESOURCE` required. A refused pass is a 401 coded `auth.pass.malformed`, `auth.pass.badSignature`, `auth.pass.wrongAudience`, `auth.pass.wrongResource`, `auth.pass.expired` or `auth.pass.replayed`, or a 403 `auth.pass.unmapped`, each with an English text in `locales/en.json`. `AUTH_PATHS.LOGIN_PASS` is `/api/login/pass`, and the auth service gains the optional `signInWithPass({ pass })`.
5
7
  - `AUTH_COOKIE_SAME_SITE` sets the CSRF cookie's SameSite: `lax` (the default, unset or blank) or `strict`, as local auth's cookies take it; any other value stops the auth policy's startup with `AUTH_COOKIE_SAME_SITE must be lax or strict, not "<value>".` `./server/utils` exports `resolveAuthCookieSameSite(env)`, which reads it. Applications that leave it unset are unchanged.
6
8
 
7
9
  - **Second factor.** A route asks for one with the kernel's `secondFactor` option (`true`, or `{ maxAgeSeconds }` for a dangerous action), and the auth policy enforces it: a signed-in session that has not proved its second factor, or proved it longer ago than `maxAgeSeconds`, is refused with 403 `auth.secondFactor.required` (params `{ maxAgeSeconds }` when the route names one), checked after the CSRF token, the sign-in and the route's permission. The policy sets `request.secondFactorAt`, when the session last proved it (`""` when it has not), from the provider's `authenticate` result. `./server/secondFactor` gives `requireSecondFactor(request, requirement)`, the same refusal for an action whose requirement depends on more than its route (the actor's role, say; a call without a request, as from the server's own code, is refused too), with `isSecondFactorMet()` and `secondFactorRequiredParams()`; `./shared/authSecondFactor` gives `SECOND_FACTOR_REQUIRED` and `isSecondFactorRequired(error)` for clients.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/auth-core",
3
- "version": "0.2.27",
3
+ "version": "0.2.29",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "jskit test"
@@ -165,6 +165,8 @@
165
165
  * whose staff lost their authenticator. `byUserId` names who reset it, for the audit event.
166
166
  * @property {(reply: object, result: object) => void} [writeOAuthStartCookies] Keeps the state of an OAuth sign-in that oauthStart() began.
167
167
  * @property {(reply: object) => void} [clearOAuthStartCookies]
168
+ * @property {(input: { pass: string }) => Promise<object>} [signInWithPass] Signs in the account a one-time signed pass
169
+ * names (`@jskit-ai/auth-pass/server`), once per pass; local auth has it, with AUTH_PASS_PUBLIC_KEY set.
168
170
  * @property {(request: object, options?: { everywhere?: boolean }) => Promise<any>} [logoutEverywhere]
169
171
  * @property {() => object} [getSettingsProfileAuthInfo] What the account settings show about the provider's profile.
170
172
  * @property {() => object} [getOAuthProviderCatalog] The OAuth providers the sign-in screen offers.
@@ -5,6 +5,7 @@ const AUTH_PATHS = Object.freeze({
5
5
  LOGIN: "/api/login",
6
6
  LOGIN_OTP_REQUEST: "/api/login/otp/request",
7
7
  LOGIN_OTP_VERIFY: "/api/login/otp/verify",
8
+ LOGIN_PASS: "/api/login/pass",
8
9
  OAUTH_START_TEMPLATE: "/api/oauth/:provider/start",
9
10
  OAUTH_COMPLETE: "/api/oauth/complete",
10
11
  PASSWORD_FORGOT: "/api/password/forgot",