@passflow/core 0.36.0 → 0.37.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 +58 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -3
- package/dist/index.d.ts +130 -3
- package/dist/index.mjs +58 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Changelog
|
|
4
4
|
|
|
5
|
+
### Version 0.37.0
|
|
6
|
+
|
|
7
|
+
- Added: the preferred second factor. `getPreferredTwoFactorMethod()` answers the method the
|
|
8
|
+
signed-in user prefers on this app, or `null`; `setPreferredTwoFactorMethod(method)` stores one
|
|
9
|
+
and answers it; `clearPreferredTwoFactorMethod()` removes it. The same calls are on
|
|
10
|
+
`passflow.twoFactor` as `getPreferredMethod()`, `setPreferredMethod(method)` and
|
|
11
|
+
`clearPreferredMethod()`. Their `Error` reports carry the operations
|
|
12
|
+
`2fa.preferred-method.read`, `2fa.preferred-method.set` and `2fa.preferred-method.clear`.
|
|
13
|
+
- Added: `suggested_method` and `account_hint` on `TwoFactorChallengeResponse`, and `account_hint`
|
|
14
|
+
on `TwoFactorEnrollmentResponse`.
|
|
15
|
+
- Added: `preferred` on `RegisteredTwoFactorMethod`, so `getRegisteredMethods()` marks the
|
|
16
|
+
preferred method.
|
|
17
|
+
- Added: `reset` on the answer of `validateTwoFactorSetupMagicLink`, on the session from
|
|
18
|
+
`getMagicLinkSession()` and on the `TwoFactorSetupMagicLinkValidated` payload. It is `true` for a
|
|
19
|
+
link an administrator sent to replace an enrolled authenticator, otherwise `false`.
|
|
20
|
+
- Changed on the server: a code check for a user with no second factor answers 400
|
|
21
|
+
`error.2fa.not_enabled` (it was 401). `verifyTwoFactor` and `useTwoFactorRecoveryCode` reject
|
|
22
|
+
with it, and the session and the pending sign-in are kept.
|
|
23
|
+
- These fields and calls need Passflow server v0.84.1 or later. An older server leaves the fields
|
|
24
|
+
out, and the preferred-method calls reject with its 404.
|
|
25
|
+
|
|
26
|
+
### Version 0.36.1
|
|
27
|
+
|
|
28
|
+
- Added: `AppSettings.connections` (type `AppSettingsConnection`, `{ id, name, provider }`), the
|
|
29
|
+
enabled, verified enterprise connections a sign-in button may offer, as `GET /app/settings`
|
|
30
|
+
answers them; absent when the server has no connection storage. Pass `` `conn_${id}` `` as the
|
|
31
|
+
provider to `federatedAuthWithRedirect` / `federatedAuthWithPopup`.
|
|
32
|
+
|
|
5
33
|
### Version 0.36.0
|
|
6
34
|
|
|
7
35
|
- Added: enterprise SSO. `enterpriseResolve(email)` answers which enterprise (OIDC or SAML)
|
|
@@ -951,6 +979,32 @@ switch (enrollment) {
|
|
|
951
979
|
codes still work until they are regenerated. The SDK checks only the form (letters, digits and
|
|
952
980
|
optional dashes) and upper-cases the code; the server decides whether it is valid. `remaining_recovery_codes` may be
|
|
953
981
|
absent from the answer.
|
|
982
|
+
- **Bypass code.** A bypass code from an administrator has the form `XXXX-XXXX-XXXX` and goes where
|
|
983
|
+
a recovery code goes: pass it to `useTwoFactorRecoveryCode`. The SDK sends it upper-cased with its
|
|
984
|
+
dashes. The answer does not say which kind of code it was. `remaining_recovery_codes`, when sent,
|
|
985
|
+
still counts the user's recovery codes, so `TwoFactorRecoveryCodesLow` or
|
|
986
|
+
`TwoFactorRecoveryCodesExhausted` can follow a bypass code; without the count neither is raised.
|
|
987
|
+
- **Preferred method.** A signed-in user can choose the factor sign-in offers first:
|
|
988
|
+
|
|
989
|
+
```typescript
|
|
990
|
+
const preferred = await passflow.getPreferredTwoFactorMethod(); // "totp", or null
|
|
991
|
+
await passflow.setPreferredTwoFactorMethod("email_otp"); // resolves "email_otp"
|
|
992
|
+
await passflow.clearPreferredTwoFactorMethod();
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
`null` means the user has no preference this app can use now. The server refuses `recovery_codes`
|
|
996
|
+
and a method the user cannot present at this app with 400
|
|
997
|
+
`error.2fa.preferred_method.unavailable`. Clearing when nothing is stored is no error.
|
|
998
|
+
`passflow.twoFactor.getRegisteredMethods()` marks the preferred method with `preferred: true`.
|
|
999
|
+
- **Suggested method and account hint.** A v2 challenge carries `suggested_method`, the method
|
|
1000
|
+
sign-in offers first. From `requestChallenge` it equals `method`. From `switchToAlternative`,
|
|
1001
|
+
`method` is the one the user chose and `suggested_method` stays the one offered first.
|
|
1002
|
+
`account_hint`, on the challenge and on `getTwoFactorEnrollment()`, is a masked name of the account
|
|
1003
|
+
signing in: the email (`h***@example.com`), else the phone (`***-***-1234`), else the username
|
|
1004
|
+
(`u***`). It is absent when the user has none. Older servers send neither field.
|
|
1005
|
+
- **No second factor.** `verifyTwoFactor` and `useTwoFactorRecoveryCode` reject with 400
|
|
1006
|
+
`error.2fa.not_enabled` when the user has no second factor. The session and the pending sign-in
|
|
1007
|
+
are kept.
|
|
954
1008
|
- **Step-up offers what the server lists.** The step-up 403 from `/auth/session/exchange` carries
|
|
955
1009
|
`available_factors`, the factors this user can step up with, and the SDK offers exactly those in
|
|
956
1010
|
that order. Without it (older servers), TOTP is suggested before passkey. When the list is empty,
|
|
@@ -991,6 +1045,10 @@ switch (enrollment) {
|
|
|
991
1045
|
- **The emailed link.** Call `validateTwoFactorSetupMagicLink(token)` on its page. While that session
|
|
992
1046
|
is active, `getTwoFactorStatus`, `beginTwoFactorSetup` and `confirmTwoFactorSetup` run on it instead
|
|
993
1047
|
of the stored session, and a correct confirm ends it. A used link reads as error code `ALREADY_USED`.
|
|
1048
|
+
On a success, `reset` is `true` for a link an administrator sent to replace an enrolled
|
|
1049
|
+
authenticator: `beginTwoFactorSetup` on that session replaces it once, without a code. Otherwise
|
|
1050
|
+
`reset` is `false`. `getMagicLinkSession()` and the `TwoFactorSetupMagicLinkValidated` payload
|
|
1051
|
+
carry the same `reset`.
|
|
994
1052
|
|
|
995
1053
|
## Token Management
|
|
996
1054
|
|