@alore/auth-react-sdk 1.0.6-alpha → 1.0.7-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 CHANGED
@@ -36,12 +36,8 @@ export interface AuthProviderConfig {
36
36
  logoUrl?: string;
37
37
  socialProviders?: SocialProvider[];
38
38
  enableWalletCreation?: boolean;
39
- firebaseOptions?: FirebaseOptions;
40
- }
41
- type FirebaseOptions = {
42
39
  firebaseCompatible?: boolean;
43
- firebaseServiceAccountEmail?: string;
44
- };
40
+ }
45
41
  export interface AuthMachineContext {
46
42
  authProviderConfigs?: AuthProviderConfig;
47
43
  salt?: string;
@@ -56,10 +56,9 @@ export class AloreAuth {
56
56
  throw new Error((data === null || data === void 0 ? void 0 : data.message) || (data === null || data === void 0 ? void 0 : data.error) || data);
57
57
  }),
58
58
  completeRegistration: (context, event) => __awaiter(this, void 0, void 0, function* () {
59
- var _a;
60
59
  const { email, nickname, passwordHash, device } = event.payload;
61
- const { firebaseCompatible, firebaseServiceAccountEmail } = ((_a = context.authProviderConfigs) === null || _a === void 0 ? void 0 : _a.firebaseOptions) || {};
62
- const response = yield this.fetchWithProgressiveBackoff('/auth/v1/account-registration', {
60
+ const { firebaseCompatible } = context.authProviderConfigs || {};
61
+ const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/account-registration${firebaseCompatible ? `?firebaseCompatibleToken=${firebaseCompatible}` : ''}`, {
63
62
  method: 'POST',
64
63
  headers: {
65
64
  'Content-Type': 'application/json',
@@ -69,10 +68,6 @@ export class AloreAuth {
69
68
  nickname,
70
69
  passwordHash,
71
70
  device,
72
- firebaseOptions: {
73
- firebaseCompatible,
74
- firebaseServiceAccountEmail,
75
- },
76
71
  }),
77
72
  });
78
73
  const data = yield response.json();
@@ -143,7 +138,7 @@ export class AloreAuth {
143
138
  return {};
144
139
  }),
145
140
  verifyLogin: (context, event) => __awaiter(this, void 0, void 0, function* () {
146
- var _b, _c;
141
+ var _a, _b;
147
142
  const { email, passwordHash, device, locale } = event.payload;
148
143
  const { credentialEmail } = context;
149
144
  const searchParams = new URLSearchParams();
@@ -170,7 +165,7 @@ export class AloreAuth {
170
165
  if (response.status === 403) {
171
166
  return { active2fa: data };
172
167
  }
173
- if (((_b = data === null || data === void 0 ? void 0 : data.error) === null || _b === void 0 ? void 0 : _b.includes('2FA')) || ((_c = data === null || data === void 0 ? void 0 : data.error) === null || _c === void 0 ? void 0 : _c.includes('device'))) {
168
+ if (((_a = data === null || data === void 0 ? void 0 : data.error) === null || _a === void 0 ? void 0 : _a.includes('2FA')) || ((_b = data === null || data === void 0 ? void 0 : data.error) === null || _b === void 0 ? void 0 : _b.includes('device'))) {
174
169
  return { error: data === null || data === void 0 ? void 0 : data.error };
175
170
  }
176
171
  throw new Error((data === null || data === void 0 ? void 0 : data.message) || (data === null || data === void 0 ? void 0 : data.error) || data);
@@ -221,9 +216,9 @@ export class AloreAuth {
221
216
  }),
222
217
  // Passkey login flow
223
218
  startPasskeyAuth: (context, event) => __awaiter(this, void 0, void 0, function* () {
224
- var _d;
219
+ var _c;
225
220
  const { rpDomain } = context.authProviderConfigs || {};
226
- const email = (_d = event.payload) === null || _d === void 0 ? void 0 : _d.email;
221
+ const email = (_c = event.payload) === null || _c === void 0 ? void 0 : _c.email;
227
222
  const searchParams = new URLSearchParams();
228
223
  const url = '/auth/v1/login-passkey';
229
224
  if (rpDomain) {
@@ -240,9 +235,9 @@ export class AloreAuth {
240
235
  throw new Error(data.message || data.error || data);
241
236
  }),
242
237
  finishPasskeyAuth: (context, event) => __awaiter(this, void 0, void 0, function* () {
243
- const { rpDomain, firebaseOptions } = context.authProviderConfigs || {};
238
+ const { rpDomain, firebaseCompatible } = context.authProviderConfigs || {};
244
239
  const { passkeyAuth } = event.payload;
245
- const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/login-passkey-finish`, {
240
+ const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/login-passkey-finish${firebaseCompatible ? `?firebaseCompatibleToken=${firebaseCompatible}` : ''}`, {
246
241
  method: 'POST',
247
242
  headers: {
248
243
  'Content-Type': 'application/json',
@@ -251,7 +246,6 @@ export class AloreAuth {
251
246
  passkeyAuth,
252
247
  sessionId: context.sessionId,
253
248
  rpOrigin: rpDomain,
254
- firebaseOptions,
255
249
  }),
256
250
  });
257
251
  const data = yield response.json();
@@ -340,15 +334,14 @@ export class AloreAuth {
340
334
  verifyEmail2fa: (context, event) => __awaiter(this, void 0, void 0, function* () {
341
335
  const { email, passwordHash, secureCode } = event.payload;
342
336
  const { credentialEmail, authProviderConfigs } = context;
343
- const { firebaseOptions } = authProviderConfigs || {};
344
- const response = yield this.fetchWithProgressiveBackoff('/auth/v1/email-2fa-verification', {
337
+ const { firebaseCompatible } = authProviderConfigs || {};
338
+ const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/email-2fa-verification${firebaseCompatible ? `?firebaseCompatibleToken=${firebaseCompatible}` : ''}`, {
345
339
  method: 'POST',
346
340
  body: JSON.stringify({
347
341
  email: email || credentialEmail,
348
342
  passwordHash,
349
343
  emailCode: secureCode,
350
344
  sessionId: context.sessionId,
351
- firebaseOptions,
352
345
  }),
353
346
  headers: {
354
347
  'Content-Type': 'application/json',
@@ -405,8 +398,8 @@ export class AloreAuth {
405
398
  googleLogin: (context, event) => __awaiter(this, void 0, void 0, function* () {
406
399
  const { accessToken, providerName } = event.payload;
407
400
  const { authProviderConfigs } = context;
408
- const { firebaseOptions } = authProviderConfigs || {};
409
- const response = yield this.fetchWithProgressiveBackoff('/auth/v1/google-login', {
401
+ const { firebaseCompatible } = authProviderConfigs || {};
402
+ const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/google-login${firebaseCompatible ? `?firebaseCompatibleToken=${firebaseCompatible}` : ''}`, {
410
403
  method: 'POST',
411
404
  headers: {
412
405
  'Content-Type': 'application/json',
@@ -414,7 +407,6 @@ export class AloreAuth {
414
407
  body: JSON.stringify({
415
408
  accessToken,
416
409
  provider: providerName,
417
- firebaseOptions,
418
410
  }),
419
411
  });
420
412
  const data = yield response.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alore/auth-react-sdk",
3
- "version": "1.0.6-alpha",
3
+ "version": "1.0.7-alpha",
4
4
  "repository": "https://github.com/0xCarbon/alore-js",
5
5
  "description": "SDK for Alore Auth",
6
6
  "main": "dist/index.js",