@injectivelabs/wallet-turnkey 1.20.24 → 1.20.25

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.
@@ -411,13 +411,13 @@ var TurnkeyWallet = class {
411
411
  providerName: provider,
412
412
  oauthLoginPath: this.metadata.oauthLoginPath || TURNKEY_OAUTH_PATH
413
413
  });
414
- if (!oauthResult || !oauthResult.credentialBundle) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Unexpected OAuth result"));
414
+ if (!(oauthResult === null || oauthResult === void 0 ? void 0 : oauthResult.credentialBundle)) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error("Unexpected OAuth result"));
415
415
  await indexedDbClient.loginWithSession(oauthResult.credentialBundle);
416
416
  this.userOrganizationId = oauthResult.organizationId;
417
417
  return oauthResult.credentialBundle;
418
418
  }
419
419
  async confirmOAuth2({ nonce, authCode, codeVerifier, providerName, targetPublicKey }) {
420
- var _response$data, _response$data2;
420
+ var _responseData$credent;
421
421
  const indexedDbClient = await this.getIndexedDbClient();
422
422
  const path = this.metadata.oauth2ExchangePath || "turnkey/oauth2";
423
423
  const response = await this.client.post(path, {
@@ -427,13 +427,18 @@ var TurnkeyWallet = class {
427
427
  targetPublicKey,
428
428
  providerName
429
429
  });
430
- if (!(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.credentialBundle) || !(response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.organizationId)) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`${providerName} OAuth2 exchange failed`));
431
- const { credentialBundle, organizationId, email } = response.data;
430
+ const responseData = response === null || response === void 0 ? void 0 : response.data;
431
+ const credentialBundle = (_responseData$credent = responseData === null || responseData === void 0 ? void 0 : responseData.credentialBundle) !== null && _responseData$credent !== void 0 ? _responseData$credent : responseData === null || responseData === void 0 ? void 0 : responseData.session;
432
+ const organizationId = responseData === null || responseData === void 0 ? void 0 : responseData.organizationId;
433
+ if (!credentialBundle || !organizationId) throw new __injectivelabs_exceptions.WalletException(/* @__PURE__ */ new Error(`${providerName} OAuth2 exchange failed`));
434
+ const { email, userName, profileImageUrl } = responseData;
432
435
  await indexedDbClient.loginWithSession(credentialBundle);
433
436
  this.userOrganizationId = organizationId;
434
437
  return {
435
438
  session: credentialBundle,
436
- email
439
+ email,
440
+ userName,
441
+ profileImageUrl
437
442
  };
438
443
  }
439
444
  async refreshSession() {
@@ -65,6 +65,12 @@ type TurnkeyConfirmEmailOTPResponse = {
65
65
  session: string;
66
66
  organizationId: string;
67
67
  };
68
+ type TurnkeyOAuth2ConfirmResponse = {
69
+ email?: string;
70
+ session: string;
71
+ userName?: string;
72
+ profileImageUrl?: string;
73
+ };
68
74
  //#endregion
69
75
  //#region src/strategy/turnkey/turnkey.d.ts
70
76
  declare class TurnkeyWallet {
@@ -115,10 +121,7 @@ declare class TurnkeyWallet {
115
121
  codeVerifier: string;
116
122
  targetPublicKey: string;
117
123
  providerName: TurnkeyOAuthProvider;
118
- }): Promise<{
119
- session: string;
120
- email: string | undefined;
121
- }>;
124
+ }): Promise<TurnkeyOAuth2ConfirmResponse>;
122
125
  refreshSession(): Promise<string>;
123
126
  private initClient;
124
127
  }
@@ -65,6 +65,12 @@ type TurnkeyConfirmEmailOTPResponse = {
65
65
  session: string;
66
66
  organizationId: string;
67
67
  };
68
+ type TurnkeyOAuth2ConfirmResponse = {
69
+ email?: string;
70
+ session: string;
71
+ userName?: string;
72
+ profileImageUrl?: string;
73
+ };
68
74
  //#endregion
69
75
  //#region src/strategy/turnkey/turnkey.d.ts
70
76
  declare class TurnkeyWallet {
@@ -115,10 +121,7 @@ declare class TurnkeyWallet {
115
121
  codeVerifier: string;
116
122
  targetPublicKey: string;
117
123
  providerName: TurnkeyOAuthProvider;
118
- }): Promise<{
119
- session: string;
120
- email: string | undefined;
121
- }>;
124
+ }): Promise<TurnkeyOAuth2ConfirmResponse>;
122
125
  refreshSession(): Promise<string>;
123
126
  private initClient;
124
127
  }
package/dist/esm/index.js CHANGED
@@ -411,13 +411,13 @@ var TurnkeyWallet = class {
411
411
  providerName: provider,
412
412
  oauthLoginPath: this.metadata.oauthLoginPath || TURNKEY_OAUTH_PATH
413
413
  });
414
- if (!oauthResult || !oauthResult.credentialBundle) throw new WalletException(/* @__PURE__ */ new Error("Unexpected OAuth result"));
414
+ if (!(oauthResult === null || oauthResult === void 0 ? void 0 : oauthResult.credentialBundle)) throw new WalletException(/* @__PURE__ */ new Error("Unexpected OAuth result"));
415
415
  await indexedDbClient.loginWithSession(oauthResult.credentialBundle);
416
416
  this.userOrganizationId = oauthResult.organizationId;
417
417
  return oauthResult.credentialBundle;
418
418
  }
419
419
  async confirmOAuth2({ nonce, authCode, codeVerifier, providerName, targetPublicKey }) {
420
- var _response$data, _response$data2;
420
+ var _responseData$credent;
421
421
  const indexedDbClient = await this.getIndexedDbClient();
422
422
  const path = this.metadata.oauth2ExchangePath || "turnkey/oauth2";
423
423
  const response = await this.client.post(path, {
@@ -427,13 +427,18 @@ var TurnkeyWallet = class {
427
427
  targetPublicKey,
428
428
  providerName
429
429
  });
430
- if (!(response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.credentialBundle) || !(response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.organizationId)) throw new WalletException(/* @__PURE__ */ new Error(`${providerName} OAuth2 exchange failed`));
431
- const { credentialBundle, organizationId, email } = response.data;
430
+ const responseData = response === null || response === void 0 ? void 0 : response.data;
431
+ const credentialBundle = (_responseData$credent = responseData === null || responseData === void 0 ? void 0 : responseData.credentialBundle) !== null && _responseData$credent !== void 0 ? _responseData$credent : responseData === null || responseData === void 0 ? void 0 : responseData.session;
432
+ const organizationId = responseData === null || responseData === void 0 ? void 0 : responseData.organizationId;
433
+ if (!credentialBundle || !organizationId) throw new WalletException(/* @__PURE__ */ new Error(`${providerName} OAuth2 exchange failed`));
434
+ const { email, userName, profileImageUrl } = responseData;
432
435
  await indexedDbClient.loginWithSession(credentialBundle);
433
436
  this.userOrganizationId = organizationId;
434
437
  return {
435
438
  session: credentialBundle,
436
- email
439
+ email,
440
+ userName,
441
+ profileImageUrl
437
442
  };
438
443
  }
439
444
  async refreshSession() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@injectivelabs/wallet-turnkey",
3
- "version": "1.20.24",
3
+ "version": "1.20.25",
4
4
  "description": "Turnkey wallet strategy for use with @injectivelabs/wallet-core.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -44,12 +44,12 @@
44
44
  "dependencies": {
45
45
  "@turnkey/sdk-browser": "5.16.1",
46
46
  "@turnkey/viem": "0.13.1",
47
- "viem": "^2.41.2",
48
- "@injectivelabs/exceptions": "1.20.24",
49
- "@injectivelabs/sdk-ts": "1.20.24",
50
- "@injectivelabs/ts-types": "1.20.24",
51
- "@injectivelabs/utils": "1.20.24",
52
- "@injectivelabs/wallet-base": "1.20.24"
47
+ "viem": "^2.54.6",
48
+ "@injectivelabs/exceptions": "1.20.25",
49
+ "@injectivelabs/sdk-ts": "1.20.25",
50
+ "@injectivelabs/utils": "1.20.25",
51
+ "@injectivelabs/wallet-base": "1.20.25",
52
+ "@injectivelabs/ts-types": "1.20.25"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"