@turnkey/sdk-react 5.0.1 → 5.1.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.
@@ -21,12 +21,8 @@ var useTurnkey = require('../../hooks/use-turnkey.js');
21
21
  var constants = require('./constants.js');
22
22
  var sdkServer = require('@turnkey/sdk-server');
23
23
  var parsePhoneNumberFromString = require('libphonenumber-js');
24
+ var sdkTypes = require('@turnkey/sdk-types');
24
25
 
25
- exports.SessionType = void 0;
26
- (function (SessionType) {
27
- SessionType["READ_ONLY"] = "SESSION_TYPE_READ_ONLY";
28
- SessionType["READ_WRITE"] = "SESSION_TYPE_READ_WRITE";
29
- })(exports.SessionType || (exports.SessionType = {}));
30
26
  const passkeyIcon = jsxRuntime.jsxs("svg", {
31
27
  xmlns: "http://www.w3.org/2000/svg",
32
28
  width: "43",
@@ -100,10 +96,6 @@ const Auth = ({
100
96
  React.useEffect(() => {
101
97
  const manageClient = async () => {
102
98
  if (indexedDbClient && turnkey$1) {
103
- const session = await turnkey$1.getSession();
104
- if (!session) {
105
- await indexedDbClient.resetKeyPair();
106
- }
107
99
  const retrievedPublicKey = await indexedDbClient.getPublicKey();
108
100
  if (retrievedPublicKey) {
109
101
  setComponentReady(true);
@@ -175,9 +167,10 @@ const Auth = ({
175
167
  constants.authErrors.passkey.createFailed;
176
168
  }
177
169
  }
170
+ await indexedDbClient.resetKeyPair();
178
171
  const pubKey = await indexedDbClient.getPublicKey();
179
172
  await passkeyClient?.loginWithPasskey({
180
- sessionType: exports.SessionType.READ_WRITE,
173
+ sessionType: sdkTypes.SessionType.READ_WRITE,
181
174
  publicKey: pubKey,
182
175
  expirationSeconds: authConfig.sessionLengthSeconds?.toString()
183
176
  });
@@ -190,9 +183,10 @@ const Auth = ({
190
183
  const handleLoginWithPasskey = async () => {
191
184
  try {
192
185
  setLoading("passkey");
186
+ await indexedDbClient?.resetKeyPair();
193
187
  const pubKey = await indexedDbClient.getPublicKey();
194
188
  await passkeyClient?.loginWithPasskey({
195
- sessionType: exports.SessionType.READ_WRITE,
189
+ sessionType: sdkTypes.SessionType.READ_WRITE,
196
190
  publicKey: pubKey,
197
191
  expirationSeconds: authConfig.sessionLengthSeconds?.toString()
198
192
  });
@@ -299,9 +293,10 @@ const Auth = ({
299
293
  onError(constants.authErrors.wallet.loginFailed);
300
294
  return;
301
295
  }
296
+ await indexedDbClient.resetKeyPair();
302
297
  const pubKey = await indexedDbClient.getPublicKey();
303
298
  await walletClient.loginWithWallet({
304
- sessionType: exports.SessionType.READ_WRITE,
299
+ sessionType: sdkTypes.SessionType.READ_WRITE,
305
300
  publicKey: pubKey,
306
301
  expirationSeconds: authConfig.sessionLengthSeconds?.toString()
307
302
  });