@passflow/core 0.38.0 → 0.39.1
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 +81 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +358 -138
- package/dist/index.d.ts +358 -138
- package/dist/index.mjs +1372 -1255
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
## Changelog
|
|
4
4
|
|
|
5
|
+
### Version 0.39.1
|
|
6
|
+
|
|
7
|
+
- Changed: errors the SDK passes on carry no request data. A rejected `AxiosError` that reaches the
|
|
8
|
+
caller, or the `Error` event as `originalError`, keeps its url, method, status and answer; its
|
|
9
|
+
`config` has no `data` and no headers, and `request` is `undefined`. A credential in the request
|
|
10
|
+
path is replaced by a placeholder in the error's url and in `PassflowError.location`
|
|
11
|
+
(`/auth/2fa-setup/:token`, `/cli/auth/status/:sessionId`).
|
|
12
|
+
- Docs: `PassflowSendLimitError` on `updateProfile` can also come from the proof check.
|
|
13
|
+
|
|
14
|
+
### Version 0.39.0
|
|
15
|
+
|
|
16
|
+
- Added: emailed and texted second-factor codes (`email_otp`, `sms_otp`). `resend` on
|
|
17
|
+
`TwoFactorChallengeRequest` and `TwoFactorAlternativeRequest` sends a new code (new
|
|
18
|
+
`challenge_id`, the previous code stops working); without it a live code is answered again and
|
|
19
|
+
nothing is sent. `expires_in_minutes` on `TwoFactorChallengeResponse`, next to `code_sent_to`.
|
|
20
|
+
`verify_address` on `TwoFactorEnrollmentResponse`. See
|
|
21
|
+
[docs/two-factor-codes.md](docs/two-factor-codes.md).
|
|
22
|
+
- Added: `PassflowSmsQuotaExceededError` (429 `error.2fa.sms.quota.exceeded`) and
|
|
23
|
+
`PassflowSendLimitError` (429 `error.2fa.rate_limit_exceeded`, with `retryAfter` in seconds) on
|
|
24
|
+
the calls that send a code, with the ids exported as `TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID` and
|
|
25
|
+
`TWO_FACTOR_SEND_LIMIT_ERROR_ID`.
|
|
26
|
+
- Added: recovery codes for a user whose factor is an emailed or texted code:
|
|
27
|
+
`passflow.twoFactor.startRecoveryCodesByCode(via)` and
|
|
28
|
+
`passflow.twoFactor.completeRecoveryCodesByCode(setupId, code)`. Below level 2 they reject with
|
|
29
|
+
`PassflowRecoveryCodesStepUpRequiredError` (403 `error.2fa.recovery_codes.step_up_required`,
|
|
30
|
+
`RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID`), whose `challenge` holds the level to step up to.
|
|
31
|
+
- Added: `requestAddressChangeProof(method)` and `updateProfile(patch, proof?)` (`PATCH
|
|
32
|
+
/user/profile`), the `AddressChangeProof` and `PassflowProfileUpdate` types, and
|
|
33
|
+
`PassflowAddressChangeProofRequiredError` (403 `error.user.address.change.proof.required`,
|
|
34
|
+
`ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID`).
|
|
35
|
+
- Added: `getRegisteredMethods(query?)` takes an optional `{ purpose, required_acr, max_age }`
|
|
36
|
+
query, and `RegisteredTwoFactorMethod` carries `reaches_acr_max`, `requires_prepare`,
|
|
37
|
+
`code_sent_to_hint` and `recommended`.
|
|
38
|
+
- Added: the `Error` operations `2fa.recovery-codes.start`, `2fa.recovery-codes.complete`,
|
|
39
|
+
`profile.update` and `profile.address-proof`.
|
|
40
|
+
- Changed: `requestChallenge` and `switchToAlternative` reject a 429 `error.2fa.sms.quota.exceeded`
|
|
41
|
+
or `error.2fa.rate_limit_exceeded` with the typed errors above instead of the raw axios error.
|
|
42
|
+
Other 429s on them, and every 429 on any other call, are unchanged. Code that caught these two
|
|
43
|
+
429s as an `AxiosError` (`error.response.status === 429`) now gets a `PassflowError` subclass:
|
|
44
|
+
read `error.status` and `error.id` instead. This holds for TOTP challenges too.
|
|
45
|
+
- These need Passflow server v0.114.0 or later.
|
|
46
|
+
|
|
5
47
|
### Version 0.38.0
|
|
6
48
|
|
|
7
49
|
- Added: `getDeviceId()` returns the id that identifies this browser or device to Passflow, the
|
|
@@ -1059,8 +1101,15 @@ switch (enrollment) {
|
|
|
1059
1101
|
- **The sign-in is over** on a 401 `error.tfa.token.invalid` or `error.otp.already.used`: sign in again.
|
|
1060
1102
|
- **Rate limits are per user.** `sendTwoFactorSetupLink`, `beginTwoFactorEnrollment`,
|
|
1061
1103
|
`requestChallenge` and `switchToAlternative` share 3 requests in 5 minutes, then a 10-minute
|
|
1062
|
-
lockout. `confirmTwoFactorEnrollment` and `verifyTwoFactor` share 5 in 15 minutes.
|
|
1063
|
-
|
|
1104
|
+
lockout. `confirmTwoFactorEnrollment` and `verifyTwoFactor` share 5 in 15 minutes. On
|
|
1105
|
+
`requestChallenge` and `switchToAlternative`, a 429 `error.2fa.rate_limit_exceeded` rejects with
|
|
1106
|
+
`PassflowSendLimitError` (`retryAfter` in seconds) and a 429 `error.2fa.sms.quota.exceeded` with
|
|
1107
|
+
`PassflowSmsQuotaExceededError`. Every other 429 rejects with the raw axios error
|
|
1108
|
+
(`error.response.status`).
|
|
1109
|
+
- **Emailed and texted codes.** `email_otp` and `sms_otp` challenges carry `code_sent_to` and
|
|
1110
|
+
`expires_in_minutes`; `resend: true` sends a new code. Recovery codes for these users, the
|
|
1111
|
+
address-change proof and the discovery fields are in
|
|
1112
|
+
[docs/two-factor-codes.md](docs/two-factor-codes.md).
|
|
1064
1113
|
- **The emailed link.** Call `validateTwoFactorSetupMagicLink(token)` on its page. While that session
|
|
1065
1114
|
is active, `getTwoFactorStatus`, `beginTwoFactorSetup` and `confirmTwoFactorSetup` run on it instead
|
|
1066
1115
|
of the stored session, and a correct confirm ends it. A used link reads as error code `ALREADY_USED`.
|
|
@@ -1370,6 +1419,36 @@ A password sign-in for a user who must change the password first rejects with
|
|
|
1370
1419
|
`error.api.password.change.required`, exported as `PASSWORD_CHANGE_REQUIRED_ERROR_ID`). No token
|
|
1371
1420
|
comes with it.
|
|
1372
1421
|
|
|
1422
|
+
### Code send refused
|
|
1423
|
+
|
|
1424
|
+
A call that sends a code (`requestChallenge`, `switchToAlternative`, `startRecoveryCodesByCode`,
|
|
1425
|
+
`completeRecoveryCodesByCode`, `requestAddressChangeProof`, `updateProfile`) can be refused with 429:
|
|
1426
|
+
|
|
1427
|
+
- `PassflowSmsQuotaExceededError` (id `error.2fa.sms.quota.exceeded`,
|
|
1428
|
+
`TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID`): the user's monthly text quota is spent. Offer another
|
|
1429
|
+
method.
|
|
1430
|
+
- `PassflowSendLimitError` (id `error.2fa.rate_limit_exceeded`, `TWO_FACTOR_SEND_LIMIT_ERROR_ID`):
|
|
1431
|
+
the app's send limit is spent. `retryAfter` is the seconds to wait, or `undefined` when the server
|
|
1432
|
+
sent no `Retry-After`. On `updateProfile` it can also come from the proof check: too many wrong
|
|
1433
|
+
codes, not a spent send limit.
|
|
1434
|
+
|
|
1435
|
+
Any other 429 on these calls rejects with the raw axios error, as on every other call.
|
|
1436
|
+
|
|
1437
|
+
### Recovery codes step-up required
|
|
1438
|
+
|
|
1439
|
+
`startRecoveryCodesByCode` and `completeRecoveryCodesByCode` below level 2 reject with
|
|
1440
|
+
`PassflowRecoveryCodesStepUpRequiredError` (status 403, id
|
|
1441
|
+
`error.2fa.recovery_codes.step_up_required`, `RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID`), unless an
|
|
1442
|
+
installed step-up handles it. Its `challenge` is the RFC 9470 challenge, at least
|
|
1443
|
+
`{ acrValues: '2', requiredLevel: 2, status: 403 }`. Step up or sign in again, then repeat the call.
|
|
1444
|
+
|
|
1445
|
+
### Address change proof required
|
|
1446
|
+
|
|
1447
|
+
`updateProfile` that changes `email` or `phone_number` without a proof that holds rejects with
|
|
1448
|
+
`PassflowAddressChangeProofRequiredError` (status 403, id
|
|
1449
|
+
`error.user.address.change.proof.required`, `ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID`). Get a code
|
|
1450
|
+
with `requestAddressChangeProof`, or use a TOTP or recovery code, and save again with the proof.
|
|
1451
|
+
|
|
1373
1452
|
### Service unavailable
|
|
1374
1453
|
|
|
1375
1454
|
In a browser, when the Passflow API cannot be reached or its gateway answers 502, 503 or 504 itself,
|