@turnkey/sdk-react 4.2.6 → 5.0.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/CHANGELOG.md +37 -0
- package/README.md +7 -6
- package/dist/assets/apple.svg.js +3 -1
- package/dist/assets/apple.svg.js.map +1 -1
- package/dist/assets/caution.svg.js +3 -1
- package/dist/assets/caution.svg.js.map +1 -1
- package/dist/assets/export.svg.js +3 -1
- package/dist/assets/export.svg.js.map +1 -1
- package/dist/assets/eye.svg.js +3 -1
- package/dist/assets/eye.svg.js.map +1 -1
- package/dist/assets/facebook.svg.js +3 -1
- package/dist/assets/facebook.svg.js.map +1 -1
- package/dist/assets/google.svg.js +3 -1
- package/dist/assets/google.svg.js.map +1 -1
- package/dist/assets/import.svg.js +3 -1
- package/dist/assets/import.svg.js.map +1 -1
- package/dist/assets/turnkey.svg.js +3 -1
- package/dist/assets/turnkey.svg.js.map +1 -1
- package/dist/assets/unlock.svg.js +3 -1
- package/dist/assets/unlock.svg.js.map +1 -1
- package/dist/components/auth/Apple.d.ts +0 -1
- package/dist/components/auth/Apple.d.ts.map +1 -1
- package/dist/components/auth/Apple.js +18 -9
- package/dist/components/auth/Apple.js.map +1 -1
- package/dist/components/auth/Apple.mjs +93 -60
- package/dist/components/auth/Apple.mjs.map +1 -1
- package/dist/components/auth/Auth.d.ts.map +1 -1
- package/dist/components/auth/Auth.js +91 -108
- package/dist/components/auth/Auth.js.map +1 -1
- package/dist/components/auth/Auth.mjs +106 -109
- package/dist/components/auth/Auth.mjs.map +1 -1
- package/dist/components/auth/Auth.module.css.js +3 -1
- package/dist/components/auth/Auth.module.css.js.map +1 -1
- package/dist/components/auth/Facebook.d.ts +0 -1
- package/dist/components/auth/Facebook.d.ts.map +1 -1
- package/dist/components/auth/Facebook.js +17 -8
- package/dist/components/auth/Facebook.js.map +1 -1
- package/dist/components/auth/Facebook.mjs +18 -6
- package/dist/components/auth/Facebook.mjs.map +1 -1
- package/dist/components/auth/Google.d.ts +0 -1
- package/dist/components/auth/Google.d.ts.map +1 -1
- package/dist/components/auth/Google.js +17 -8
- package/dist/components/auth/Google.js.map +1 -1
- package/dist/components/auth/Google.mjs +23 -11
- package/dist/components/auth/Google.mjs.map +1 -1
- package/dist/components/auth/OtpVerification.d.ts +0 -1
- package/dist/components/auth/OtpVerification.d.ts.map +1 -1
- package/dist/components/auth/OtpVerification.js +51 -21
- package/dist/components/auth/OtpVerification.js.map +1 -1
- package/dist/components/auth/OtpVerification.mjs +68 -27
- package/dist/components/auth/OtpVerification.mjs.map +1 -1
- package/dist/components/auth/OtpVerification.module.css.js +3 -1
- package/dist/components/auth/OtpVerification.module.css.js.map +1 -1
- package/dist/components/auth/Socials.module.css.js +3 -1
- package/dist/components/auth/Socials.module.css.js.map +1 -1
- package/dist/components/auth/TurnkeyThemeProvider.js.map +1 -1
- package/dist/components/auth/TurnkeyThemeProvider.mjs.map +1 -1
- package/dist/components/auth/constants.js +1 -1
- package/dist/components/auth/constants.js.map +1 -1
- package/dist/components/auth/constants.mjs +1 -1
- package/dist/components/auth/constants.mjs.map +1 -1
- package/dist/components/auth/facebookUtils.js.map +1 -1
- package/dist/components/auth/otp.js +3 -1
- package/dist/components/auth/otp.js.map +1 -1
- package/dist/components/auth/otp.mjs.map +1 -1
- package/dist/components/export/Export.js +25 -23
- package/dist/components/export/Export.js.map +1 -1
- package/dist/components/export/Export.mjs +4 -4
- package/dist/components/export/Export.mjs.map +1 -1
- package/dist/components/export/Export.module.css.js +3 -1
- package/dist/components/export/Export.module.css.js.map +1 -1
- package/dist/components/import/Import.js +13 -11
- package/dist/components/import/Import.js.map +1 -1
- package/dist/components/import/Import.mjs +4 -4
- package/dist/components/import/Import.mjs.map +1 -1
- package/dist/components/import/Import.module.css.js +3 -1
- package/dist/components/import/Import.module.css.js.map +1 -1
- package/dist/contexts/TurnkeyContext.d.ts +2 -2
- package/dist/contexts/TurnkeyContext.d.ts.map +1 -1
- package/dist/contexts/TurnkeyContext.js +23 -43
- package/dist/contexts/TurnkeyContext.js.map +1 -1
- package/dist/contexts/TurnkeyContext.mjs +50 -102
- package/dist/contexts/TurnkeyContext.mjs.map +1 -1
- package/dist/hooks/use-session.d.ts +16 -33
- package/dist/hooks/use-session.d.ts.map +1 -1
- package/dist/hooks/use-session.js +15 -51
- package/dist/hooks/use-session.js.map +1 -1
- package/dist/hooks/use-session.mjs +17 -52
- package/dist/hooks/use-session.mjs.map +1 -1
- package/dist/hooks/use-turnkey.js.map +1 -1
- package/dist/hooks/use-turnkey.mjs.map +1 -1
- package/dist/index.js +3 -3
- package/package.json +6 -5
|
@@ -71,9 +71,10 @@ var Auth = function Auth(_ref) {
|
|
|
71
71
|
passkeyConfig = _ref.passkeyConfig,
|
|
72
72
|
otpConfig = _ref.otpConfig;
|
|
73
73
|
var _useTurnkey = useTurnkey(),
|
|
74
|
-
authIframeClient = _useTurnkey.authIframeClient,
|
|
75
74
|
passkeyClient = _useTurnkey.passkeyClient,
|
|
76
|
-
walletClient = _useTurnkey.walletClient
|
|
75
|
+
walletClient = _useTurnkey.walletClient,
|
|
76
|
+
indexedDbClient = _useTurnkey.indexedDbClient,
|
|
77
|
+
turnkey = _useTurnkey.turnkey;
|
|
77
78
|
var _useState = useState(""),
|
|
78
79
|
_useState2 = _slicedToArray(_useState, 2),
|
|
79
80
|
email = _useState2[0],
|
|
@@ -98,30 +99,26 @@ var Auth = function Auth(_ref) {
|
|
|
98
99
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
99
100
|
oauthLoading = _useState12[0],
|
|
100
101
|
setOauthLoading = _useState12[1];
|
|
101
|
-
var _useState13 = useState(
|
|
102
|
+
var _useState13 = useState(false),
|
|
102
103
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
passkeySignupScreen = _useState14[0],
|
|
105
|
+
setPasskeySignupScreen = _useState14[1];
|
|
105
106
|
var _useState15 = useState(false),
|
|
106
107
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var _useState17 = useState(
|
|
108
|
+
passkeyCreationScreen = _useState16[0],
|
|
109
|
+
setPasskeyCreationScreen = _useState16[1];
|
|
110
|
+
var _useState17 = useState(""),
|
|
110
111
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var _useState19 = useState(
|
|
112
|
+
passkeySignupError = _useState18[0],
|
|
113
|
+
setPasskeySignupError = _useState18[1];
|
|
114
|
+
var _useState19 = useState(false),
|
|
114
115
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
componentReady = _useState20[0],
|
|
117
|
+
setComponentReady = _useState20[1];
|
|
117
118
|
var _useState21 = useState(false),
|
|
118
119
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var _useState23 = useState(false),
|
|
122
|
-
_useState24 = _slicedToArray(_useState23, 2),
|
|
123
|
-
passkeyCreated = _useState24[0],
|
|
124
|
-
setPasskeyCreated = _useState24[1];
|
|
120
|
+
passkeyCreated = _useState22[0],
|
|
121
|
+
setPasskeyCreated = _useState22[1];
|
|
125
122
|
var handleResendCode = /*#__PURE__*/function () {
|
|
126
123
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
127
124
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -154,28 +151,48 @@ var Auth = function Auth(_ref) {
|
|
|
154
151
|
};
|
|
155
152
|
}();
|
|
156
153
|
useEffect(function () {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
_context2.next =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
154
|
+
var manageClient = /*#__PURE__*/function () {
|
|
155
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
156
|
+
var session, retrievedPublicKey;
|
|
157
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
158
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
if (!(indexedDbClient && turnkey)) {
|
|
161
|
+
_context2.next = 11;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
_context2.next = 3;
|
|
165
|
+
return turnkey.getSession();
|
|
166
|
+
case 3:
|
|
167
|
+
session = _context2.sent;
|
|
168
|
+
if (session) {
|
|
169
|
+
_context2.next = 7;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
_context2.next = 7;
|
|
173
|
+
return indexedDbClient.resetKeyPair();
|
|
174
|
+
case 7:
|
|
175
|
+
_context2.next = 9;
|
|
176
|
+
return indexedDbClient.getPublicKey();
|
|
177
|
+
case 9:
|
|
178
|
+
retrievedPublicKey = _context2.sent;
|
|
179
|
+
if (retrievedPublicKey) {
|
|
180
|
+
setComponentReady(true);
|
|
181
|
+
} else {
|
|
182
|
+
onError("Failed to retrieve public key.");
|
|
183
|
+
}
|
|
184
|
+
case 11:
|
|
185
|
+
case "end":
|
|
186
|
+
return _context2.stop();
|
|
187
|
+
}
|
|
188
|
+
}, _callee2);
|
|
189
|
+
}));
|
|
190
|
+
return function manageClient() {
|
|
191
|
+
return _ref3.apply(this, arguments);
|
|
192
|
+
};
|
|
193
|
+
}();
|
|
194
|
+
manageClient();
|
|
195
|
+
}, [indexedDbClient, turnkey]);
|
|
179
196
|
if (!componentReady) {
|
|
180
197
|
return jsx("div", {
|
|
181
198
|
className: styles.defaultLoader,
|
|
@@ -196,7 +213,7 @@ var Auth = function Auth(_ref) {
|
|
|
196
213
|
};
|
|
197
214
|
var handleSignupWithPasskey = /*#__PURE__*/function () {
|
|
198
215
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
199
|
-
var siteInfo, _authConfig$sessionLe, _passkeyConfig$name, _passkeyConfig$displa, _ref5, encodedChallenge, attestation, response,
|
|
216
|
+
var siteInfo, _authConfig$sessionLe, _passkeyConfig$name, _passkeyConfig$displa, _ref5, encodedChallenge, attestation, response, pubKey;
|
|
200
217
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
201
218
|
while (1) switch (_context3.prev = _context3.next) {
|
|
202
219
|
case 0:
|
|
@@ -261,14 +278,13 @@ var Auth = function Auth(_ref) {
|
|
|
261
278
|
case 21:
|
|
262
279
|
case 22:
|
|
263
280
|
_context3.next = 24;
|
|
264
|
-
return
|
|
281
|
+
return indexedDbClient.getPublicKey();
|
|
265
282
|
case 24:
|
|
266
|
-
|
|
283
|
+
pubKey = _context3.sent;
|
|
267
284
|
_context3.next = 27;
|
|
268
285
|
return passkeyClient === null || passkeyClient === void 0 ? void 0 : passkeyClient.loginWithPasskey({
|
|
269
286
|
sessionType: SessionType.READ_WRITE,
|
|
270
|
-
|
|
271
|
-
targetPublicKey: iframePublicKey,
|
|
287
|
+
publicKey: pubKey,
|
|
272
288
|
expirationSeconds: (_authConfig$sessionLe = authConfig.sessionLengthSeconds) === null || _authConfig$sessionLe === void 0 ? void 0 : _authConfig$sessionLe.toString()
|
|
273
289
|
});
|
|
274
290
|
case 27:
|
|
@@ -294,21 +310,20 @@ var Auth = function Auth(_ref) {
|
|
|
294
310
|
}();
|
|
295
311
|
var handleLoginWithPasskey = /*#__PURE__*/function () {
|
|
296
312
|
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
297
|
-
var _authConfig$sessionLe2,
|
|
313
|
+
var _authConfig$sessionLe2, pubKey;
|
|
298
314
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
299
315
|
while (1) switch (_context4.prev = _context4.next) {
|
|
300
316
|
case 0:
|
|
301
317
|
_context4.prev = 0;
|
|
302
318
|
setLoading("passkey");
|
|
303
319
|
_context4.next = 4;
|
|
304
|
-
return
|
|
320
|
+
return indexedDbClient.getPublicKey();
|
|
305
321
|
case 4:
|
|
306
|
-
|
|
322
|
+
pubKey = _context4.sent;
|
|
307
323
|
_context4.next = 7;
|
|
308
324
|
return passkeyClient === null || passkeyClient === void 0 ? void 0 : passkeyClient.loginWithPasskey({
|
|
309
325
|
sessionType: SessionType.READ_WRITE,
|
|
310
|
-
|
|
311
|
-
targetPublicKey: iframePublicKey,
|
|
326
|
+
publicKey: pubKey,
|
|
312
327
|
expirationSeconds: (_authConfig$sessionLe2 = authConfig.sessionLengthSeconds) === null || _authConfig$sessionLe2 === void 0 ? void 0 : _authConfig$sessionLe2.toString()
|
|
313
328
|
});
|
|
314
329
|
case 7:
|
|
@@ -339,7 +354,7 @@ var Auth = function Auth(_ref) {
|
|
|
339
354
|
var handleOtpLogin = /*#__PURE__*/function () {
|
|
340
355
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(type, value, otpType) {
|
|
341
356
|
var _otpConfig$otpLength, _otpConfig$alphanumer;
|
|
342
|
-
var createSuborgData,
|
|
357
|
+
var createSuborgData, publicKey, initAuthResponse;
|
|
343
358
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
344
359
|
while (1) switch (_context5.prev = _context5.next) {
|
|
345
360
|
case 0:
|
|
@@ -354,29 +369,11 @@ var Auth = function Auth(_ref) {
|
|
|
354
369
|
createSuborgData.customAccounts = customAccounts;
|
|
355
370
|
}
|
|
356
371
|
_context5.next = 6;
|
|
357
|
-
return
|
|
358
|
-
filterType: type,
|
|
359
|
-
filterValue: value,
|
|
360
|
-
additionalData: createSuborgData
|
|
361
|
-
});
|
|
372
|
+
return indexedDbClient.getPublicKey();
|
|
362
373
|
case 6:
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
if (!(!suborgIds || suborgIds.length === 0)) {
|
|
366
|
-
_context5.next = 11;
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
369
|
-
onError(authErrors.otp.sendFailed);
|
|
370
|
-
return _context5.abrupt("return");
|
|
371
|
-
case 11:
|
|
372
|
-
suborgId = suborgIds[0];
|
|
373
|
-
_context5.next = 14;
|
|
374
|
-
return authIframeClient.initEmbeddedKey();
|
|
375
|
-
case 14:
|
|
376
|
-
iframePublicKey = _context5.sent;
|
|
377
|
-
_context5.next = 17;
|
|
374
|
+
publicKey = _context5.sent;
|
|
375
|
+
_context5.next = 9;
|
|
378
376
|
return server.sendOtp(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
379
|
-
suborgID: suborgId,
|
|
380
377
|
otpType: otpType,
|
|
381
378
|
contact: value
|
|
382
379
|
}, emailCustomization && {
|
|
@@ -388,19 +385,18 @@ var Auth = function Auth(_ref) {
|
|
|
388
385
|
}), {}, {
|
|
389
386
|
otpLength: (_otpConfig$otpLength = otpConfig === null || otpConfig === void 0 ? void 0 : otpConfig.otpLength) !== null && _otpConfig$otpLength !== void 0 ? _otpConfig$otpLength : 6,
|
|
390
387
|
alphanumeric: (_otpConfig$alphanumer = otpConfig === null || otpConfig === void 0 ? void 0 : otpConfig.alphanumeric) !== null && _otpConfig$alphanumer !== void 0 ? _otpConfig$alphanumer : false,
|
|
391
|
-
userIdentifier:
|
|
388
|
+
userIdentifier: publicKey
|
|
392
389
|
}));
|
|
393
|
-
case
|
|
390
|
+
case 9:
|
|
394
391
|
initAuthResponse = _context5.sent;
|
|
395
392
|
if (initAuthResponse && initAuthResponse.otpId) {
|
|
396
|
-
setSuborgId(suborgId);
|
|
397
393
|
setOtpId(initAuthResponse === null || initAuthResponse === void 0 ? void 0 : initAuthResponse.otpId);
|
|
398
394
|
setStep(otpType);
|
|
399
395
|
} else {
|
|
400
396
|
onError(authErrors.otp.sendFailed);
|
|
401
397
|
}
|
|
402
398
|
setLoading(undefined);
|
|
403
|
-
case
|
|
399
|
+
case 12:
|
|
404
400
|
case "end":
|
|
405
401
|
return _context5.stop();
|
|
406
402
|
}
|
|
@@ -412,10 +408,20 @@ var Auth = function Auth(_ref) {
|
|
|
412
408
|
}();
|
|
413
409
|
var handleOAuthLogin = /*#__PURE__*/function () {
|
|
414
410
|
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(credential, providerName) {
|
|
415
|
-
var createSuborgData, resp, suborgIds, suborgId,
|
|
411
|
+
var pubKey, createSuborgData, resp, suborgIds, suborgId, sessionResponse;
|
|
416
412
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
417
413
|
while (1) switch (_context6.prev = _context6.next) {
|
|
418
414
|
case 0:
|
|
415
|
+
_context6.next = 2;
|
|
416
|
+
return indexedDbClient === null || indexedDbClient === void 0 ? void 0 : indexedDbClient.getPublicKey();
|
|
417
|
+
case 2:
|
|
418
|
+
pubKey = _context6.sent;
|
|
419
|
+
if (pubKey) {
|
|
420
|
+
_context6.next = 5;
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
423
|
+
return _context6.abrupt("return");
|
|
424
|
+
case 5:
|
|
419
425
|
setOauthLoading(providerName);
|
|
420
426
|
createSuborgData = {
|
|
421
427
|
oauthProviders: [{
|
|
@@ -426,51 +432,47 @@ var Auth = function Auth(_ref) {
|
|
|
426
432
|
if (customAccounts) {
|
|
427
433
|
createSuborgData.customAccounts = customAccounts;
|
|
428
434
|
}
|
|
429
|
-
_context6.next =
|
|
435
|
+
_context6.next = 10;
|
|
430
436
|
return server.getOrCreateSuborg({
|
|
431
437
|
filterType: FilterType.OidcToken,
|
|
432
438
|
filterValue: credential,
|
|
433
439
|
additionalData: createSuborgData
|
|
434
440
|
});
|
|
435
|
-
case
|
|
441
|
+
case 10:
|
|
436
442
|
resp = _context6.sent;
|
|
437
443
|
suborgIds = resp === null || resp === void 0 ? void 0 : resp.subOrganizationIds;
|
|
438
444
|
if (!(!suborgIds || suborgIds.length === 0)) {
|
|
439
|
-
_context6.next =
|
|
445
|
+
_context6.next = 15;
|
|
440
446
|
break;
|
|
441
447
|
}
|
|
442
448
|
onError(authErrors.oauth.loginFailed);
|
|
443
449
|
return _context6.abrupt("return");
|
|
444
|
-
case
|
|
450
|
+
case 15:
|
|
445
451
|
suborgId = suborgIds[0];
|
|
446
|
-
_context6.next =
|
|
447
|
-
return
|
|
448
|
-
case 13:
|
|
449
|
-
iframePublicKey = _context6.sent;
|
|
450
|
-
_context6.next = 16;
|
|
451
|
-
return server.oauth({
|
|
452
|
+
_context6.next = 18;
|
|
453
|
+
return server.oauthLogin({
|
|
452
454
|
suborgID: suborgId,
|
|
453
455
|
oidcToken: credential,
|
|
454
|
-
|
|
456
|
+
publicKey: pubKey,
|
|
455
457
|
sessionLengthSeconds: authConfig.sessionLengthSeconds
|
|
456
458
|
});
|
|
457
|
-
case
|
|
458
|
-
|
|
459
|
-
if (!(
|
|
460
|
-
_context6.next =
|
|
459
|
+
case 18:
|
|
460
|
+
sessionResponse = _context6.sent;
|
|
461
|
+
if (!(sessionResponse && sessionResponse.session)) {
|
|
462
|
+
_context6.next = 26;
|
|
461
463
|
break;
|
|
462
464
|
}
|
|
463
|
-
_context6.next = 20;
|
|
464
|
-
return authIframeClient.loginWithSession(oauthSession);
|
|
465
|
-
case 20:
|
|
466
465
|
_context6.next = 22;
|
|
467
|
-
return
|
|
466
|
+
return indexedDbClient.loginWithSession(sessionResponse.session);
|
|
468
467
|
case 22:
|
|
469
|
-
_context6.next =
|
|
470
|
-
|
|
468
|
+
_context6.next = 24;
|
|
469
|
+
return onAuthSuccess();
|
|
471
470
|
case 24:
|
|
471
|
+
_context6.next = 27;
|
|
472
|
+
break;
|
|
473
|
+
case 26:
|
|
472
474
|
onError(authErrors.oauth.loginFailed);
|
|
473
|
-
case
|
|
475
|
+
case 27:
|
|
474
476
|
case "end":
|
|
475
477
|
return _context6.stop();
|
|
476
478
|
}
|
|
@@ -482,7 +484,7 @@ var Auth = function Auth(_ref) {
|
|
|
482
484
|
}();
|
|
483
485
|
var handleLoginWithWallet = /*#__PURE__*/function () {
|
|
484
486
|
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
485
|
-
var _authConfig$sessionLe3, publicKey, _walletClient$getWall, type, resp, suborgIds,
|
|
487
|
+
var _authConfig$sessionLe3, publicKey, _walletClient$getWall, type, resp, suborgIds, pubKey;
|
|
486
488
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
487
489
|
while (1) switch (_context7.prev = _context7.next) {
|
|
488
490
|
case 0:
|
|
@@ -527,14 +529,13 @@ var Auth = function Auth(_ref) {
|
|
|
527
529
|
return _context7.abrupt("return");
|
|
528
530
|
case 17:
|
|
529
531
|
_context7.next = 19;
|
|
530
|
-
return
|
|
532
|
+
return indexedDbClient.getPublicKey();
|
|
531
533
|
case 19:
|
|
532
|
-
|
|
534
|
+
pubKey = _context7.sent;
|
|
533
535
|
_context7.next = 22;
|
|
534
536
|
return walletClient.loginWithWallet({
|
|
535
537
|
sessionType: SessionType.READ_WRITE,
|
|
536
|
-
|
|
537
|
-
targetPublicKey: iframePublicKey,
|
|
538
|
+
publicKey: pubKey,
|
|
538
539
|
expirationSeconds: (_authConfig$sessionLe3 = authConfig.sessionLengthSeconds) === null || _authConfig$sessionLe3 === void 0 ? void 0 : _authConfig$sessionLe3.toString()
|
|
539
540
|
});
|
|
540
541
|
case 22:
|
|
@@ -595,7 +596,6 @@ var Auth = function Auth(_ref) {
|
|
|
595
596
|
children: [googleEnabled && jsx(GoogleAuthButton, {
|
|
596
597
|
layout: layout,
|
|
597
598
|
clientId: (_authConfig$googleCli = authConfig.googleClientId) !== null && _authConfig$googleCli !== void 0 ? _authConfig$googleCli : process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
|
|
598
|
-
iframePublicKey: authIframeClient.iframePublicKey,
|
|
599
599
|
openInPage: authConfig.openOAuthInPage,
|
|
600
600
|
onSuccess: function onSuccess(response) {
|
|
601
601
|
return handleOAuthLogin(response.idToken, "Google");
|
|
@@ -603,7 +603,6 @@ var Auth = function Auth(_ref) {
|
|
|
603
603
|
}), appleEnabled && jsx(AppleAuthButton, {
|
|
604
604
|
layout: layout,
|
|
605
605
|
clientId: (_authConfig$appleClie = authConfig.appleClientId) !== null && _authConfig$appleClie !== void 0 ? _authConfig$appleClie : process.env.NEXT_PUBLIC_APPLE_CLIENT_ID,
|
|
606
|
-
iframePublicKey: authIframeClient.iframePublicKey,
|
|
607
606
|
openInPage: authConfig.openOAuthInPage,
|
|
608
607
|
onSuccess: function onSuccess(response) {
|
|
609
608
|
return handleOAuthLogin(response.idToken, "Apple");
|
|
@@ -611,7 +610,6 @@ var Auth = function Auth(_ref) {
|
|
|
611
610
|
}), facebookEnabled && jsx(FacebookAuthButton, {
|
|
612
611
|
layout: layout,
|
|
613
612
|
clientId: (_authConfig$facebookC = authConfig.facebookClientId) !== null && _authConfig$facebookC !== void 0 ? _authConfig$facebookC : process.env.NEXT_PUBLIC_FACEBOOK_CLIENT_ID,
|
|
614
|
-
iframePublicKey: authIframeClient.iframePublicKey,
|
|
615
613
|
openInPage: authConfig.openOAuthInPage,
|
|
616
614
|
onSuccess: function onSuccess(response) {
|
|
617
615
|
return handleOAuthLogin(response.id_token, "Facebook");
|
|
@@ -846,7 +844,6 @@ var Auth = function Auth(_ref) {
|
|
|
846
844
|
}), otpId && jsx(OtpVerification, {
|
|
847
845
|
type: step,
|
|
848
846
|
contact: step === OtpType.Email ? email : phone,
|
|
849
|
-
suborgId: suborgId,
|
|
850
847
|
otpId: otpId,
|
|
851
848
|
alphanumeric: (_otpConfig$alphanumer2 = otpConfig === null || otpConfig === void 0 ? void 0 : otpConfig.alphanumeric) !== null && _otpConfig$alphanumer2 !== void 0 ? _otpConfig$alphanumer2 : false,
|
|
852
849
|
sessionLengthSeconds: authConfig.sessionLengthSeconds,
|