@koolbase/js 12.1.0 → 12.2.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +16 -0
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ is based on [Keep a Changelog][kac], and this project adheres to
7
7
  [kac]: https://keepachangelog.com/en/1.1.0/
8
8
  [semver]: https://semver.org/
9
9
 
10
+ ## 12.2.0
11
+
12
+ ### Added
13
+
14
+ - **Two-step sign-in (MFA).** Every sign-in method now throws `MfaRequiredError`
15
+ carrying a `challengeToken` when the person's account has an authenticator on
16
+ — including phone, Google and Apple, whose error parsers all map it, enforced
17
+ by a source test for any parser added later. `verifyMfa({ challengeToken, code
18
+ })` and `verifyRecoveryCode({ challengeToken, code })` finish sign-in and
19
+ store the session, returning `{ session, recoveryCodesRemaining }` for the
20
+ latter.
21
+ - `enrollMfa()`, `confirmMfaEnrollment(code)`, `mfaStatus()`, `stepUpMfa(…)`,
22
+ `disableMfa()`, and `regenerateRecoveryCodes()` manage it. Six new error
23
+ classes in the mapping table and fidelity list.
24
+
10
25
  ## 12.1.0
11
26
 
12
27
  ### Added
package/README.md CHANGED
@@ -98,6 +98,22 @@ If your app needs a different trade-off — an httpOnly cookie set by your own
98
98
  backend, say — implement `KoolbaseAuthStorage` and pass it as
99
99
  `config.authStorage`. The SDK will use yours instead of its own.
100
100
 
101
+ ### Two-step sign-in (MFA)
102
+
103
+ ```typescript
104
+ // After login() throws MfaRequiredError:
105
+ const session = await Koolbase.auth.verifyMfa({
106
+ challengeToken: err.challengeToken,
107
+ code: '123456', // from the person's authenticator app
108
+ });
109
+
110
+ // Enrol (within 10 minutes of signing in):
111
+ const { otpauthUri, secret } = await Koolbase.auth.enrollMfa();
112
+ // show otpauthUri as a QR code, then:
113
+ const codes = await Koolbase.auth.confirmMfaEnrollment('123456');
114
+ // save the recovery codes — shown this once only
115
+ ```
116
+
101
117
  ### Email code
102
118
 
103
119
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koolbase/js",
3
- "version": "12.1.0",
3
+ "version": "12.2.0",
4
4
  "description": "Koolbase SDK for the browser \u2014 auth, database, storage, realtime, functions, flags and offline sync in one package.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/koolbase/koolbase-react-native"
26
26
  },
27
27
  "dependencies": {
28
- "@koolbase/core": "12.1.0"
28
+ "@koolbase/core": "12.2.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"