@passflow/core 0.37.1 → 0.39.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 +83 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +363 -138
- package/dist/index.d.ts +363 -138
- package/dist/index.mjs +836 -729
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
## Changelog
|
|
4
4
|
|
|
5
|
+
### Version 0.39.0
|
|
6
|
+
|
|
7
|
+
- Added: emailed and texted second-factor codes (`email_otp`, `sms_otp`). `resend` on
|
|
8
|
+
`TwoFactorChallengeRequest` and `TwoFactorAlternativeRequest` sends a new code (new
|
|
9
|
+
`challenge_id`, the previous code stops working); without it a live code is answered again and
|
|
10
|
+
nothing is sent. `expires_in_minutes` on `TwoFactorChallengeResponse`, next to `code_sent_to`.
|
|
11
|
+
`verify_address` on `TwoFactorEnrollmentResponse`. See
|
|
12
|
+
[docs/two-factor-codes.md](docs/two-factor-codes.md).
|
|
13
|
+
- Added: `PassflowSmsQuotaExceededError` (429 `error.2fa.sms.quota.exceeded`) and
|
|
14
|
+
`PassflowSendLimitError` (429 `error.2fa.rate_limit_exceeded`, with `retryAfter` in seconds) on
|
|
15
|
+
the calls that send a code, with the ids exported as `TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID` and
|
|
16
|
+
`TWO_FACTOR_SEND_LIMIT_ERROR_ID`.
|
|
17
|
+
- Added: recovery codes for a user whose factor is an emailed or texted code:
|
|
18
|
+
`passflow.twoFactor.startRecoveryCodesByCode(via)` and
|
|
19
|
+
`passflow.twoFactor.completeRecoveryCodesByCode(setupId, code)`. Below level 2 they reject with
|
|
20
|
+
`PassflowRecoveryCodesStepUpRequiredError` (403 `error.2fa.recovery_codes.step_up_required`,
|
|
21
|
+
`RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID`), whose `challenge` holds the level to step up to.
|
|
22
|
+
- Added: `requestAddressChangeProof(method)` and `updateProfile(patch, proof?)` (`PATCH
|
|
23
|
+
/user/profile`), the `AddressChangeProof` and `PassflowProfileUpdate` types, and
|
|
24
|
+
`PassflowAddressChangeProofRequiredError` (403 `error.user.address.change.proof.required`,
|
|
25
|
+
`ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID`).
|
|
26
|
+
- Added: `getRegisteredMethods(query?)` takes an optional `{ purpose, required_acr, max_age }`
|
|
27
|
+
query, and `RegisteredTwoFactorMethod` carries `reaches_acr_max`, `requires_prepare`,
|
|
28
|
+
`code_sent_to_hint` and `recommended`.
|
|
29
|
+
- Added: the `Error` operations `2fa.recovery-codes.start`, `2fa.recovery-codes.complete`,
|
|
30
|
+
`profile.update` and `profile.address-proof`.
|
|
31
|
+
- Changed: `requestChallenge` and `switchToAlternative` reject a 429 `error.2fa.sms.quota.exceeded`
|
|
32
|
+
or `error.2fa.rate_limit_exceeded` with the typed errors above instead of the raw axios error.
|
|
33
|
+
Other 429s on them, and every 429 on any other call, are unchanged. Code that caught these two
|
|
34
|
+
429s as an `AxiosError` (`error.response.status === 429`) now gets a `PassflowError` subclass:
|
|
35
|
+
read `error.status` and `error.id` instead. This holds for TOTP challenges too.
|
|
36
|
+
- These need Passflow server v0.114.0 or later.
|
|
37
|
+
|
|
38
|
+
### Version 0.38.0
|
|
39
|
+
|
|
40
|
+
- Added: `getDeviceId()` returns the id that identifies this browser or device to Passflow, the
|
|
41
|
+
same value the SDK sends with every request. It is read from storage, and minted and stored on
|
|
42
|
+
first use.
|
|
43
|
+
|
|
5
44
|
### Version 0.37.1
|
|
6
45
|
|
|
7
46
|
- Changed: a step-up commit answered 401 with `error.grant.predates_credential_reset`,
|
|
@@ -1053,8 +1092,15 @@ switch (enrollment) {
|
|
|
1053
1092
|
- **The sign-in is over** on a 401 `error.tfa.token.invalid` or `error.otp.already.used`: sign in again.
|
|
1054
1093
|
- **Rate limits are per user.** `sendTwoFactorSetupLink`, `beginTwoFactorEnrollment`,
|
|
1055
1094
|
`requestChallenge` and `switchToAlternative` share 3 requests in 5 minutes, then a 10-minute
|
|
1056
|
-
lockout. `confirmTwoFactorEnrollment` and `verifyTwoFactor` share 5 in 15 minutes.
|
|
1057
|
-
|
|
1095
|
+
lockout. `confirmTwoFactorEnrollment` and `verifyTwoFactor` share 5 in 15 minutes. On
|
|
1096
|
+
`requestChallenge` and `switchToAlternative`, a 429 `error.2fa.rate_limit_exceeded` rejects with
|
|
1097
|
+
`PassflowSendLimitError` (`retryAfter` in seconds) and a 429 `error.2fa.sms.quota.exceeded` with
|
|
1098
|
+
`PassflowSmsQuotaExceededError`. Every other 429 rejects with the raw axios error
|
|
1099
|
+
(`error.response.status`).
|
|
1100
|
+
- **Emailed and texted codes.** `email_otp` and `sms_otp` challenges carry `code_sent_to` and
|
|
1101
|
+
`expires_in_minutes`; `resend: true` sends a new code. Recovery codes for these users, the
|
|
1102
|
+
address-change proof and the discovery fields are in
|
|
1103
|
+
[docs/two-factor-codes.md](docs/two-factor-codes.md).
|
|
1058
1104
|
- **The emailed link.** Call `validateTwoFactorSetupMagicLink(token)` on its page. While that session
|
|
1059
1105
|
is active, `getTwoFactorStatus`, `beginTwoFactorSetup` and `confirmTwoFactorSetup` run on it instead
|
|
1060
1106
|
of the stored session, and a correct confirm ends it. A used link reads as error code `ALREADY_USED`.
|
|
@@ -1364,6 +1410,35 @@ A password sign-in for a user who must change the password first rejects with
|
|
|
1364
1410
|
`error.api.password.change.required`, exported as `PASSWORD_CHANGE_REQUIRED_ERROR_ID`). No token
|
|
1365
1411
|
comes with it.
|
|
1366
1412
|
|
|
1413
|
+
### Code send refused
|
|
1414
|
+
|
|
1415
|
+
A call that sends a code (`requestChallenge`, `switchToAlternative`, `startRecoveryCodesByCode`,
|
|
1416
|
+
`completeRecoveryCodesByCode`, `requestAddressChangeProof`, `updateProfile`) can be refused with 429:
|
|
1417
|
+
|
|
1418
|
+
- `PassflowSmsQuotaExceededError` (id `error.2fa.sms.quota.exceeded`,
|
|
1419
|
+
`TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID`): the user's monthly text quota is spent. Offer another
|
|
1420
|
+
method.
|
|
1421
|
+
- `PassflowSendLimitError` (id `error.2fa.rate_limit_exceeded`, `TWO_FACTOR_SEND_LIMIT_ERROR_ID`):
|
|
1422
|
+
the app's send limit is spent. `retryAfter` is the seconds to wait, or `undefined` when the server
|
|
1423
|
+
sent no `Retry-After`.
|
|
1424
|
+
|
|
1425
|
+
Any other 429 on these calls rejects with the raw axios error, as on every other call.
|
|
1426
|
+
|
|
1427
|
+
### Recovery codes step-up required
|
|
1428
|
+
|
|
1429
|
+
`startRecoveryCodesByCode` and `completeRecoveryCodesByCode` below level 2 reject with
|
|
1430
|
+
`PassflowRecoveryCodesStepUpRequiredError` (status 403, id
|
|
1431
|
+
`error.2fa.recovery_codes.step_up_required`, `RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID`), unless an
|
|
1432
|
+
installed step-up handles it. Its `challenge` is the RFC 9470 challenge, at least
|
|
1433
|
+
`{ acrValues: '2', requiredLevel: 2, status: 403 }`. Step up or sign in again, then repeat the call.
|
|
1434
|
+
|
|
1435
|
+
### Address change proof required
|
|
1436
|
+
|
|
1437
|
+
`updateProfile` that changes `email` or `phone_number` without a proof that holds rejects with
|
|
1438
|
+
`PassflowAddressChangeProofRequiredError` (status 403, id
|
|
1439
|
+
`error.user.address.change.proof.required`, `ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID`). Get a code
|
|
1440
|
+
with `requestAddressChangeProof`, or use a TOTP or recovery code, and save again with the proof.
|
|
1441
|
+
|
|
1367
1442
|
### Service unavailable
|
|
1368
1443
|
|
|
1369
1444
|
In a browser, when the Passflow API cannot be reached or its gateway answers 502, 503 or 504 itself,
|
|
@@ -1480,6 +1555,12 @@ Configuration options:
|
|
|
1480
1555
|
| `deleteUserPasskey(passkeyId)` | Delete a passkey |
|
|
1481
1556
|
| `addUserPasskey(options)` | Add a passkey to user account |
|
|
1482
1557
|
|
|
1558
|
+
**Device Methods**
|
|
1559
|
+
|
|
1560
|
+
| Method | Description |
|
|
1561
|
+
| --------------- | ------------------------------------------------------------- |
|
|
1562
|
+
| `getDeviceId()` | The id that identifies this browser or device, sent with every request |
|
|
1563
|
+
|
|
1483
1564
|
**Event Methods**
|
|
1484
1565
|
|
|
1485
1566
|
| Method | Description |
|