@koolbase/js 12.1.0 → 12.3.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/CHANGELOG.md +15 -0
- package/README.md +16 -0
- package/dist/cjs/platform.js +7 -3
- package/dist/esm/platform.js +7 -3
- package/package.json +3 -3
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/dist/cjs/platform.js
CHANGED
|
@@ -137,10 +137,14 @@ function makeResolver() {
|
|
|
137
137
|
if (await probe(s))
|
|
138
138
|
return { tier: 'localstorage', store: s };
|
|
139
139
|
}
|
|
140
|
+
// Outside a browser (Node, a server rendering pages) memory is the
|
|
141
|
+
// expected store, not a symptom, so there is nothing to warn about.
|
|
142
|
+
const inBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
140
143
|
// eslint-disable-next-line no-console
|
|
141
|
-
|
|
142
|
-
'
|
|
143
|
-
|
|
144
|
+
if (inBrowser)
|
|
145
|
+
console.warn('[Koolbase] No persistent storage available in this browser ' +
|
|
146
|
+
'(private browsing, blocked site data, or an exhausted quota). ' +
|
|
147
|
+
'The session and the offline queue will not survive a reload.');
|
|
144
148
|
return { tier: 'memory', store: memoryStorage() };
|
|
145
149
|
})());
|
|
146
150
|
return resolving.then((r) => { resolved = r; return r; });
|
package/dist/esm/platform.js
CHANGED
|
@@ -134,10 +134,14 @@ function makeResolver() {
|
|
|
134
134
|
if (await probe(s))
|
|
135
135
|
return { tier: 'localstorage', store: s };
|
|
136
136
|
}
|
|
137
|
+
// Outside a browser (Node, a server rendering pages) memory is the
|
|
138
|
+
// expected store, not a symptom, so there is nothing to warn about.
|
|
139
|
+
const inBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
137
140
|
// eslint-disable-next-line no-console
|
|
138
|
-
|
|
139
|
-
'
|
|
140
|
-
|
|
141
|
+
if (inBrowser)
|
|
142
|
+
console.warn('[Koolbase] No persistent storage available in this browser ' +
|
|
143
|
+
'(private browsing, blocked site data, or an exhausted quota). ' +
|
|
144
|
+
'The session and the offline queue will not survive a reload.');
|
|
141
145
|
return { tier: 'memory', store: memoryStorage() };
|
|
142
146
|
})());
|
|
143
147
|
return resolving.then((r) => { resolved = r; return r; });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koolbase/js",
|
|
3
|
-
"version": "12.
|
|
4
|
-
"description": "Koolbase SDK for the browser
|
|
3
|
+
"version": "12.3.0",
|
|
4
|
+
"description": "Koolbase SDK for the browser — 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",
|
|
7
7
|
"files": [
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/koolbase/koolbase-react-native"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@koolbase/core": "12.
|
|
28
|
+
"@koolbase/core": "12.3.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|