@alore/auth-react-sdk 1.0.1-alpha → 1.0.2-alpha
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/dist/types.d.ts +1 -0
- package/dist/utils/AloreAuth.js +11 -12
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
package/dist/utils/AloreAuth.js
CHANGED
|
@@ -48,13 +48,11 @@ export class AloreAuth {
|
|
|
48
48
|
sessionId: context.sessionId,
|
|
49
49
|
}),
|
|
50
50
|
});
|
|
51
|
-
if (
|
|
52
|
-
const data = yield response.json();
|
|
53
|
-
throw new Error((data === null || data === void 0 ? void 0 : data.message) || (data === null || data === void 0 ? void 0 : data.error) || data);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
51
|
+
if (response.ok) {
|
|
56
52
|
return {};
|
|
57
53
|
}
|
|
54
|
+
const data = yield response.json();
|
|
55
|
+
throw new Error((data === null || data === void 0 ? void 0 : data.message) || (data === null || data === void 0 ? void 0 : data.error) || data);
|
|
58
56
|
}),
|
|
59
57
|
completeRegistration: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
60
58
|
const { email, nickname, passwordHash, device } = event.payload;
|
|
@@ -176,15 +174,15 @@ export class AloreAuth {
|
|
|
176
174
|
// Passkey registration flow
|
|
177
175
|
startRegisterPasskey: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
178
176
|
const { rpDomain } = context.authProviderConfigs || {};
|
|
179
|
-
const { email, nickname, device } = event.payload;
|
|
177
|
+
const { email, nickname, device } = event.payload || context.registerUser;
|
|
180
178
|
const startPasskeyRegistrationResponse = yield this.fetchWithProgressiveBackoff('/auth/v1/account-registration-passkey', {
|
|
181
179
|
method: 'POST',
|
|
182
180
|
headers: {
|
|
183
181
|
'Content-Type': 'application/json',
|
|
184
182
|
},
|
|
185
183
|
body: JSON.stringify({
|
|
186
|
-
userEmail: email,
|
|
187
|
-
userNickname: nickname,
|
|
184
|
+
userEmail: email || null,
|
|
185
|
+
userNickname: nickname || null,
|
|
188
186
|
userDevice: device,
|
|
189
187
|
rpOrigin: rpDomain,
|
|
190
188
|
}),
|
|
@@ -194,15 +192,15 @@ export class AloreAuth {
|
|
|
194
192
|
}),
|
|
195
193
|
finishRegisterPasskey: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
196
194
|
const { rpDomain } = context.authProviderConfigs || {};
|
|
197
|
-
const { email, nickname, device, passkeyRegistration } = event.payload;
|
|
195
|
+
const { email, nickname, device, passkeyRegistration } = event.payload || {};
|
|
198
196
|
const response = yield this.fetchWithProgressiveBackoff('/auth/v1/account-registration-passkey-finish', {
|
|
199
197
|
method: 'POST',
|
|
200
198
|
headers: {
|
|
201
199
|
'Content-Type': 'application/json',
|
|
202
200
|
},
|
|
203
201
|
body: JSON.stringify({
|
|
204
|
-
userEmail: email,
|
|
205
|
-
userNickname: nickname,
|
|
202
|
+
userEmail: email || null,
|
|
203
|
+
userNickname: nickname || null,
|
|
206
204
|
userDevice: device,
|
|
207
205
|
passkeyRegistration,
|
|
208
206
|
sessionId: context.sessionId,
|
|
@@ -217,7 +215,7 @@ export class AloreAuth {
|
|
|
217
215
|
startPasskeyAuth: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
218
216
|
var _c;
|
|
219
217
|
const { rpDomain } = context.authProviderConfigs || {};
|
|
220
|
-
const email =
|
|
218
|
+
const email = (_c = event.payload) === null || _c === void 0 ? void 0 : _c.email;
|
|
221
219
|
const searchParams = new URLSearchParams();
|
|
222
220
|
const url = '/auth/v1/login-passkey';
|
|
223
221
|
if (rpDomain) {
|
|
@@ -231,6 +229,7 @@ export class AloreAuth {
|
|
|
231
229
|
const data = yield startAuthResponse.json();
|
|
232
230
|
if (startAuthResponse.ok)
|
|
233
231
|
return data;
|
|
232
|
+
throw new Error(data.message || data.error || data);
|
|
234
233
|
}),
|
|
235
234
|
finishPasskeyAuth: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
236
235
|
const { rpDomain } = context.authProviderConfigs || {};
|