@passflow/core 0.35.1 → 0.35.3

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
@@ -2,6 +2,102 @@
2
2
 
3
3
  ## Changelog
4
4
 
5
+ ### Version 0.35.3
6
+
7
+ - Fixed: in cookie and BFF mode a call answered 401 refreshes the session once and is sent once
8
+ more, so an expired access cookie with a good refresh cookie no longer fails the call or marks
9
+ the session invalid. Calls answered 401 together share one refresh. When the refresh fails, the
10
+ session has ended, or the second send is also answered 401, the call rejects with the 401 and
11
+ the session is marked invalid, as before. `/auth/refresh`, logout, the sign-in calls, the hosted
12
+ session's calls, calls made with their own bearer and step-up 401s are not sent again. This
13
+ needs a Passflow server that answers 401 for a missing or expired access token.
14
+ - Fixed: after the first cookie-mode sign-in on a page, API calls carry `withCredentials` and the
15
+ `X-CSRF-Token` header at once. Each API client kept the delivery mode it read when it was built,
16
+ so those calls went out without them until the next page load.
17
+ - Fixed: `setAppId()` reloads the in-memory token cache, so `getCachedTokens()` returns what is
18
+ stored for the new app and no longer the previous app's tokens.
19
+ - Fixed: a token refresh, step-up commit or page-load session check still unanswered when
20
+ `setAppId()` switches from one app id to another no longer applies its answer to the new app,
21
+ and `setAppId()` then checks the new app's cookie or BFF session itself. A step-up commit
22
+ answered after the switch rejects with `UpgradeCommitInterruptedError` (`superseded`).
23
+ `setAppId()` with the app id the instance already has changes nothing, and the first app id
24
+ given to an instance built without one keeps what is on its way.
25
+ - Fixed: a sign-in answer whose tokens were issued for another app than the current app id is
26
+ refused with an error and stores nothing.
27
+
28
+ ### Version 0.35.2
29
+
30
+ - Fixed: the cookie and BFF session is stored per app. The session state, delivery mode, CSRF token
31
+ and cookie-mode ID token are kept under `passflow_session_state:<appId>`,
32
+ `passflow_delivery_mode:<appId>`, `passflow_csrf_token:<appId>` and `passflow_id_token:<appId>`,
33
+ so two apps on one origin no longer change each other's session: one app's sign-in, sign-out or
34
+ delivery mode leaves the other's alone. With no app id the keys are unchanged. Values stored by
35
+ an earlier version under the plain keys are not read once an app id is set. After updating, users
36
+ of an app that sets an app id and uses cookie or BFF delivery sign in once again. `setAppId()`
37
+ reads the delivery mode and session state of the new app.
38
+ - Fixed: in cookie mode the session check on load (`GET /user/me`) takes a 2xx answer that holds the
39
+ user (an object with an `id`) as a valid session and passes that user to `SessionRestored`. It
40
+ looked for a `valid` field the server does not send, so every load marked a good session invalid
41
+ and `isAuthenticated()` returned false. A 2xx with any other body, a 401, any other error or a
42
+ network failure marks the session invalid. `PassflowSessionValidationResponse` is replaced by
43
+ `PassflowSessionUser`, the user object.
44
+
45
+ ### Version 0.35.1
46
+
47
+ - Fixed: a federated start that answers with an `auth_url` (a `human_only` app, or the `agentTool`
48
+ option) is followed only when the address is `http` or `https`. Any other address fails the start
49
+ with an `Error` whose operation is `federated.redirect` or `federated.popup`, and a pending popup
50
+ is closed.
51
+
52
+ ### Version 0.35.0
53
+
54
+ - Fixed: a session with an access token and no refresh token stays signed in when the page becomes
55
+ visible again and when another tab signs the same user in. It ends when its access token is gone
56
+ from storage, when the user signs out, or when another user signs in.
57
+ - Changed: a new session (a sign-in, tokens in the URL, `setTokens()`) replaces the stored one. A
58
+ call to `setTokens()` with only a new access token drops the stored refresh token, ID token and
59
+ scopes. Pass every token you want to keep; read the current ones with `getTokens()` or
60
+ `getCachedTokens()`.
61
+ - A tab that holds a refresh token gets `SignOut` with origin `other-tab` after 2 s when another tab
62
+ replaces the session with one that has no refresh token.
63
+ - `getTokens(true)` and `session({ doRefresh: true })` resolve `undefined` for an expired access
64
+ token with no refresh token, so `expiredSession` is called.
65
+
66
+ ### Version 0.34.0
67
+
68
+ - App settings carry `bot_mode` and `anti_bot`. On a `human_only` app the SDK adds
69
+ `X-Passflow-Anti-Bot` to the covered sign-in calls: login, register, passwordless start, passkey
70
+ register and authenticate start, password reset send and federated start. The value is a built-in
71
+ proof of work, solved in `dist/anti-bot-worker.js` (`antiBotWorkerUrl`) or on the main thread, or
72
+ a token from `setAntiBotTokenProvider()`. A `bot_friendly` app, or an unknown bot mode, sends the
73
+ same requests as before. See [docs/anti-bot.md](docs/anti-bot.md).
74
+ - `antiBotToken()` gives the header value for calls the SDK does not make itself. The per-call
75
+ `agentTool` option sends `X-Passflow-Agent-Tool: 1`. New events: `anti-bot:solving` and
76
+ `anti-bot:solved`.
77
+ - A challenge whose `max` is above 5,000,000 is refused, and a solve still running after 60 s is
78
+ stopped. Both reject with `error.anti_bot.solve_failed`.
79
+ - Fixed: `federatedAuthWithPopup` opens the popup inside the click, before any request, and fills in
80
+ the address afterwards, so a slow settings read no longer gets the popup blocked.
81
+
82
+ ### Version 0.33.0
83
+
84
+ - `listSessions()` lists the signed-in user's sessions; the caller's own has `current: true`.
85
+ `revokeSession(sessionId)` ends one; ending the session this instance is signed in with signs out
86
+ like `logOut()`. `signOutOtherSessions()` ends every other session and resolves to `{ revoked }`.
87
+ - New types: `PassflowUserSession`, `PassflowSessionDevice`, `PassflowUserSessionList` and
88
+ `PassflowRevokeOtherSessionsResponse`. Errors carry the operation `session.list`,
89
+ `session.revoke` or `session.revoke-others`.
90
+
91
+ ### Version 0.32.1
92
+
93
+ - Fixed: `new Passflow()` no longer reads or creates the device id in constructors; the first
94
+ request does. Constructing the SDK during a server render no longer calls `crypto.randomUUID()`.
95
+ - Fixed: the device id, scopes, invitation token and previous redirect URL keys honour
96
+ `keyStoragePrefix`. A value stored under the old unprefixed key is still used, and moved to the
97
+ prefixed key on first read. With no prefix nothing changes.
98
+ - Fixed: with storage that keeps nothing, one `Passflow` instance sends one device id instead of a
99
+ new one per request. An empty stored scope list is kept as empty.
100
+
5
101
  ### Version 0.32.0
6
102
 
7
103
  - `passflow.withAuth(fetch, { origins })`, `passflow.attachAuth(axios, { origins })` and
@@ -83,7 +179,7 @@ Matches the SDK to the server's real two-factor, step-up and sign-out answers.
83
179
  `sign_in_required: true` first. After the fresh sign-in, the level refusal follows as
84
180
  `UpgradeUnsatisfiableError`, so that sign-in cannot help.
85
181
  - A cookie or BFF session that stores no ID token makes another app's session undetectable, so this
86
- app's `logOut()` clears the shared delivery mode and session state. It fails safe: the other app is
182
+ app's `logOut()` clears the shared delivery mode. It fails safe: the other app is
87
183
  signed out, never wrongly signed in.
88
184
 
89
185
  ### Version 0.30.1