@turnkey/sdk-browser 1.9.0 → 1.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @turnkey/sdk-browser
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ ##### `TurnkeyWalletClient`
8
+
9
+ - Added new `TurnkeyWalletClient` to the `@turnkey/sdk-browser`
10
+ **Reason**: Allows using the `WalletStamper` with the browser sdk
11
+ - Added `getPublicKey` method to `TurnkeyWalletClient`
12
+ **Reason**: Enables easy access to wallet public key for sub-organization creation and future authentication flows
13
+ - Updated `TurnkeyWalletClient` to use new `WalletInterface`
14
+ **Reason**: Ensures compatibility with the updated Wallet Stamper interfaces
15
+
16
+ ##### `AuthClient` (new enum)
17
+
18
+ - Introduced a new enum to track which client is authenticated (Passkey, Wallet, Iframe)
19
+
20
+ ##### `TurnkeyBrowserClient`, `TurnkeyIframeClient`, `TurnkeyPasskeyClient`, `TurnkeyWalletClient`
21
+
22
+ - Added a static `authClient` property to base `TurnkeyBrowserClient` to be used by the child classes to track which client was used for the initial authentication
23
+
24
+ ##### `UserSession` interface
25
+
26
+ - Added a new `UserSession` interface which is to be stored in local storage to track the authentication state of the user and to eliminate the need to store the write and read sessions separately.
27
+ - Added `authClient` in the session object to store the authentication method used in the user's session data. Will be used in the `@turnkey/sdk-react` to determine which client to return.
28
+ - Added new versioned `UserSession` key: `"@turnkey/session/v1"`
29
+
30
+ ##### `login` and `loginWithReadWriteSession` methods
31
+
32
+ - Updated to use the new `authClient` property to track and store the authentication method used during login
33
+
34
+ ### Patch Changes
35
+
36
+ - Updated dependencies [8bea78f]
37
+ - @turnkey/wallet-stamper@2.0.0
38
+ - @turnkey/crypto@2.2.0
39
+
3
40
  ## 1.9.0
4
41
 
5
42
  ### Minor Changes
package/README.md CHANGED
@@ -12,27 +12,95 @@ Turnkey API documentation lives here: https://docs.turnkey.com.
12
12
  $ npm install @turnkey/sdk-browser
13
13
  ```
14
14
 
15
+ ### Initialize
16
+
17
+ ```typescript
18
+ import { Turnkey } from "@turnkey/sdk-browser";
19
+
20
+ const turnkey = new Turnkey({
21
+ apiBaseUrl: "https://api.turnkey.com",
22
+ defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
23
+ // Optional: Your relying party ID - for use with Passkey authentication
24
+ rpId: process.env.TURNKEY_RP_ID,
25
+ });
26
+ ```
27
+
28
+ ### Turnkey Clients
29
+
30
+ #### Passkey
31
+
32
+ The Passkey client allows for authentication to Turnkey's API using Passkeys.
33
+
34
+ ```typescript
35
+ const passkeyClient = turnkey.passkeyClient();
36
+
37
+ // User will be prompted to login with their passkey
38
+ await passkeyClient.login();
39
+
40
+ // Make authenticated requests to Turnkey API, such as listing user's wallets
41
+ const walletsResponse = await passkeyClient.getWallets();
42
+ ```
43
+
44
+ #### Iframe
45
+
46
+ The Iframe client can be initialized to interact with Turnkey's hosted iframes for sensitive operations.
47
+ The `iframeContainer` parameter is required, and should be a reference to the DOM element that will host the iframe.
48
+ The `iframeUrl` is the URL of the iframe you wish to interact with.
49
+
50
+ The example below demonstrates how to initialize the Iframe client for use with [Email Auth](https://docs.turnkey.com/embedded-wallets/sub-organization-auth)
51
+ by passing in `https://auth.turnkey.com` as the `iframeUrl`.
52
+
53
+ ```typescript
54
+ const iframeClient = await turnkey.iframeClient({
55
+ // The container element that will host the iframe
56
+ iframeContainer: document.getElementById("<iframe container id>"),
57
+ iframeUrl: "https://auth.turnkey.com",
58
+ });
59
+
60
+ const injectedResponse = await iframeClient.injectCredentialBundle(
61
+ "<Credential from Email>"
62
+ );
63
+ if (injectedResponse) {
64
+ await iframeClient.getWallets();
65
+ }
66
+ ```
67
+
68
+ ##### IFrame URLs:
69
+
70
+ | Flow | URL |
71
+ | ------------------------------------------------------------------------------------- | ---------------------------------------------------- |
72
+ | [Email Auth](https://docs.turnkey.com/embedded-wallets/sub-organization-auth) | [auth.turnkey.com](https://auth.turnkey.com) |
73
+ | [Email Recovery](https://docs.turnkey.com/embedded-wallets/sub-organization-recovery) | [recovery.turnkey.com](https://recovery.turnkey.com) |
74
+ | [Import Wallet](https://docs.turnkey.com/features/import-wallets) | [import.turnkey.com](https://import.turnkey.com) |
75
+ | [Export Wallet](https://docs.turnkey.com/features/export-wallets) | [export.turnkey.com](https://export.turnkey.com) |
76
+
77
+ #### Wallet
78
+
79
+ The Wallet client is designed for using your Solana or EVM wallet to stamp and approve activity requests for Turnkey's API.
80
+ This stamping process leverages the wallet's signature to authenticate requests.
81
+
82
+ The example below showcases how to use an injected Ethereum wallet to stamp requests to Turnkey's API.
83
+ The user will be prompted to sign a message containing the activity request payload to be sent to Turnkey.
84
+
15
85
  ```typescript
16
86
  import {
17
- TurnkeyBrowserSDK,
18
- TurnkeySDKBrowserConfig,
19
- TurnkeySDKBrowserClient,
20
- } from "@turnkey/sdk-browser";
87
+ createWalletClient,
88
+ custom,
89
+ recoverPublicKey,
90
+ hashMessage,
91
+ } from "viem";
92
+ import { privateKeyToAccount } from "viem/accounts";
93
+ import { mainnet } from "viem/chains";
21
94
 
22
- // This config contains parameters including base URLs, iframe URLs, org ID, and rp ID (relying party ID for WebAuthn)
23
- import turnkeyConfig from "./turnkey.json";
95
+ import { WalletStamper, EthereumWallet } from "@turnkey/wallet-stamper";
24
96
 
25
- // Use the config to instantiate a Turnkey Client
26
- const turnkeyClient = new TurnkeyBrowserSDK(turnkeyConfig);
97
+ const walletClient = turnkey.walletClient(new EthereumWallet());
27
98
 
28
- // Now you can make authenticated requests!
29
- const response = await turnkeyClient?.passkeySign.login();
99
+ // Make authenticated requests to Turnkey API, such as listing user's wallets
100
+ // User will be prompted to sign a message to authenticate the request
101
+ const walletsResponse = await walletClient.getWallets();
30
102
  ```
31
103
 
32
104
  ## Helpers
33
105
 
34
106
  `@turnkey/sdk-browser` provides `TurnkeySDKBrowserClient`, which offers wrappers around commonly used Turnkey activities, such as creating new wallets and wallet accounts.
35
-
36
- // TODO:
37
- // - explain subtypes within sdk-client.ts
38
- // - point to demo wallet
@@ -447,7 +447,7 @@ class TurnkeySDKClientBase {
447
447
  };
448
448
  this.approveActivity = async (input) => {
449
449
  const { organizationId, timestampMs, ...rest } = input;
450
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
450
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
451
451
  return this.activityDecision("/public/v1/submit/approve_activity", {
452
452
  parameters: rest,
453
453
  organizationId: organizationId ??
@@ -472,7 +472,7 @@ class TurnkeySDKClientBase {
472
472
  };
473
473
  this.createApiKeys = async (input) => {
474
474
  const { organizationId, timestampMs, ...rest } = input;
475
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
475
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
476
476
  return this.command("/public/v1/submit/create_api_keys", {
477
477
  parameters: rest,
478
478
  organizationId: organizationId ??
@@ -497,7 +497,7 @@ class TurnkeySDKClientBase {
497
497
  };
498
498
  this.createApiOnlyUsers = async (input) => {
499
499
  const { organizationId, timestampMs, ...rest } = input;
500
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
500
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
501
501
  return this.command("/public/v1/submit/create_api_only_users", {
502
502
  parameters: rest,
503
503
  organizationId: organizationId ??
@@ -522,7 +522,7 @@ class TurnkeySDKClientBase {
522
522
  };
523
523
  this.createAuthenticators = async (input) => {
524
524
  const { organizationId, timestampMs, ...rest } = input;
525
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
525
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
526
526
  return this.command("/public/v1/submit/create_authenticators", {
527
527
  parameters: rest,
528
528
  organizationId: organizationId ??
@@ -547,7 +547,7 @@ class TurnkeySDKClientBase {
547
547
  };
548
548
  this.createInvitations = async (input) => {
549
549
  const { organizationId, timestampMs, ...rest } = input;
550
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
550
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
551
551
  return this.command("/public/v1/submit/create_invitations", {
552
552
  parameters: rest,
553
553
  organizationId: organizationId ??
@@ -572,7 +572,7 @@ class TurnkeySDKClientBase {
572
572
  };
573
573
  this.createOauthProviders = async (input) => {
574
574
  const { organizationId, timestampMs, ...rest } = input;
575
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
575
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
576
576
  return this.command("/public/v1/submit/create_oauth_providers", {
577
577
  parameters: rest,
578
578
  organizationId: organizationId ??
@@ -597,7 +597,7 @@ class TurnkeySDKClientBase {
597
597
  };
598
598
  this.createPolicies = async (input) => {
599
599
  const { organizationId, timestampMs, ...rest } = input;
600
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
600
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
601
601
  return this.command("/public/v1/submit/create_policies", {
602
602
  parameters: rest,
603
603
  organizationId: organizationId ??
@@ -622,7 +622,7 @@ class TurnkeySDKClientBase {
622
622
  };
623
623
  this.createPolicy = async (input) => {
624
624
  const { organizationId, timestampMs, ...rest } = input;
625
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
625
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
626
626
  return this.command("/public/v1/submit/create_policy", {
627
627
  parameters: rest,
628
628
  organizationId: organizationId ??
@@ -647,7 +647,7 @@ class TurnkeySDKClientBase {
647
647
  };
648
648
  this.createPrivateKeyTag = async (input) => {
649
649
  const { organizationId, timestampMs, ...rest } = input;
650
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
650
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
651
651
  return this.command("/public/v1/submit/create_private_key_tag", {
652
652
  parameters: rest,
653
653
  organizationId: organizationId ??
@@ -672,7 +672,7 @@ class TurnkeySDKClientBase {
672
672
  };
673
673
  this.createPrivateKeys = async (input) => {
674
674
  const { organizationId, timestampMs, ...rest } = input;
675
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
675
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
676
676
  return this.command("/public/v1/submit/create_private_keys", {
677
677
  parameters: rest,
678
678
  organizationId: organizationId ??
@@ -697,7 +697,7 @@ class TurnkeySDKClientBase {
697
697
  };
698
698
  this.createReadOnlySession = async (input) => {
699
699
  const { organizationId, timestampMs, ...rest } = input;
700
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
700
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
701
701
  return this.command("/public/v1/submit/create_read_only_session", {
702
702
  parameters: rest,
703
703
  organizationId: organizationId ??
@@ -722,7 +722,7 @@ class TurnkeySDKClientBase {
722
722
  };
723
723
  this.createReadWriteSession = async (input) => {
724
724
  const { organizationId, timestampMs, ...rest } = input;
725
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
725
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
726
726
  return this.command("/public/v1/submit/create_read_write_session", {
727
727
  parameters: rest,
728
728
  organizationId: organizationId ??
@@ -747,7 +747,7 @@ class TurnkeySDKClientBase {
747
747
  };
748
748
  this.createSubOrganization = async (input) => {
749
749
  const { organizationId, timestampMs, ...rest } = input;
750
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
750
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
751
751
  return this.command("/public/v1/submit/create_sub_organization", {
752
752
  parameters: rest,
753
753
  organizationId: organizationId ??
@@ -772,7 +772,7 @@ class TurnkeySDKClientBase {
772
772
  };
773
773
  this.createUserTag = async (input) => {
774
774
  const { organizationId, timestampMs, ...rest } = input;
775
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
775
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
776
776
  return this.command("/public/v1/submit/create_user_tag", {
777
777
  parameters: rest,
778
778
  organizationId: organizationId ??
@@ -797,7 +797,7 @@ class TurnkeySDKClientBase {
797
797
  };
798
798
  this.createUsers = async (input) => {
799
799
  const { organizationId, timestampMs, ...rest } = input;
800
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
800
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
801
801
  return this.command("/public/v1/submit/create_users", {
802
802
  parameters: rest,
803
803
  organizationId: organizationId ??
@@ -822,7 +822,7 @@ class TurnkeySDKClientBase {
822
822
  };
823
823
  this.createWallet = async (input) => {
824
824
  const { organizationId, timestampMs, ...rest } = input;
825
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
825
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
826
826
  return this.command("/public/v1/submit/create_wallet", {
827
827
  parameters: rest,
828
828
  organizationId: organizationId ??
@@ -847,7 +847,7 @@ class TurnkeySDKClientBase {
847
847
  };
848
848
  this.createWalletAccounts = async (input) => {
849
849
  const { organizationId, timestampMs, ...rest } = input;
850
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
850
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
851
851
  return this.command("/public/v1/submit/create_wallet_accounts", {
852
852
  parameters: rest,
853
853
  organizationId: organizationId ??
@@ -872,7 +872,7 @@ class TurnkeySDKClientBase {
872
872
  };
873
873
  this.deleteApiKeys = async (input) => {
874
874
  const { organizationId, timestampMs, ...rest } = input;
875
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
875
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
876
876
  return this.command("/public/v1/submit/delete_api_keys", {
877
877
  parameters: rest,
878
878
  organizationId: organizationId ??
@@ -897,7 +897,7 @@ class TurnkeySDKClientBase {
897
897
  };
898
898
  this.deleteAuthenticators = async (input) => {
899
899
  const { organizationId, timestampMs, ...rest } = input;
900
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
900
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
901
901
  return this.command("/public/v1/submit/delete_authenticators", {
902
902
  parameters: rest,
903
903
  organizationId: organizationId ??
@@ -922,7 +922,7 @@ class TurnkeySDKClientBase {
922
922
  };
923
923
  this.deleteInvitation = async (input) => {
924
924
  const { organizationId, timestampMs, ...rest } = input;
925
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
925
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
926
926
  return this.command("/public/v1/submit/delete_invitation", {
927
927
  parameters: rest,
928
928
  organizationId: organizationId ??
@@ -947,7 +947,7 @@ class TurnkeySDKClientBase {
947
947
  };
948
948
  this.deleteOauthProviders = async (input) => {
949
949
  const { organizationId, timestampMs, ...rest } = input;
950
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
950
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
951
951
  return this.command("/public/v1/submit/delete_oauth_providers", {
952
952
  parameters: rest,
953
953
  organizationId: organizationId ??
@@ -972,7 +972,7 @@ class TurnkeySDKClientBase {
972
972
  };
973
973
  this.deletePolicy = async (input) => {
974
974
  const { organizationId, timestampMs, ...rest } = input;
975
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
975
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
976
976
  return this.command("/public/v1/submit/delete_policy", {
977
977
  parameters: rest,
978
978
  organizationId: organizationId ??
@@ -997,7 +997,7 @@ class TurnkeySDKClientBase {
997
997
  };
998
998
  this.deletePrivateKeyTags = async (input) => {
999
999
  const { organizationId, timestampMs, ...rest } = input;
1000
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1000
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1001
1001
  return this.command("/public/v1/submit/delete_private_key_tags", {
1002
1002
  parameters: rest,
1003
1003
  organizationId: organizationId ??
@@ -1022,7 +1022,7 @@ class TurnkeySDKClientBase {
1022
1022
  };
1023
1023
  this.deletePrivateKeys = async (input) => {
1024
1024
  const { organizationId, timestampMs, ...rest } = input;
1025
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1025
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1026
1026
  return this.command("/public/v1/submit/delete_private_keys", {
1027
1027
  parameters: rest,
1028
1028
  organizationId: organizationId ??
@@ -1047,7 +1047,7 @@ class TurnkeySDKClientBase {
1047
1047
  };
1048
1048
  this.deleteSubOrganization = async (input) => {
1049
1049
  const { organizationId, timestampMs, ...rest } = input;
1050
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1050
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1051
1051
  return this.command("/public/v1/submit/delete_sub_organization", {
1052
1052
  parameters: rest,
1053
1053
  organizationId: organizationId ??
@@ -1072,7 +1072,7 @@ class TurnkeySDKClientBase {
1072
1072
  };
1073
1073
  this.deleteUserTags = async (input) => {
1074
1074
  const { organizationId, timestampMs, ...rest } = input;
1075
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1075
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1076
1076
  return this.command("/public/v1/submit/delete_user_tags", {
1077
1077
  parameters: rest,
1078
1078
  organizationId: organizationId ??
@@ -1097,7 +1097,7 @@ class TurnkeySDKClientBase {
1097
1097
  };
1098
1098
  this.deleteUsers = async (input) => {
1099
1099
  const { organizationId, timestampMs, ...rest } = input;
1100
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1100
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1101
1101
  return this.command("/public/v1/submit/delete_users", {
1102
1102
  parameters: rest,
1103
1103
  organizationId: organizationId ??
@@ -1122,7 +1122,7 @@ class TurnkeySDKClientBase {
1122
1122
  };
1123
1123
  this.deleteWallets = async (input) => {
1124
1124
  const { organizationId, timestampMs, ...rest } = input;
1125
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1125
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1126
1126
  return this.command("/public/v1/submit/delete_wallets", {
1127
1127
  parameters: rest,
1128
1128
  organizationId: organizationId ??
@@ -1147,7 +1147,7 @@ class TurnkeySDKClientBase {
1147
1147
  };
1148
1148
  this.emailAuth = async (input) => {
1149
1149
  const { organizationId, timestampMs, ...rest } = input;
1150
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1150
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1151
1151
  return this.command("/public/v1/submit/email_auth", {
1152
1152
  parameters: rest,
1153
1153
  organizationId: organizationId ??
@@ -1172,7 +1172,7 @@ class TurnkeySDKClientBase {
1172
1172
  };
1173
1173
  this.exportPrivateKey = async (input) => {
1174
1174
  const { organizationId, timestampMs, ...rest } = input;
1175
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1175
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1176
1176
  return this.command("/public/v1/submit/export_private_key", {
1177
1177
  parameters: rest,
1178
1178
  organizationId: organizationId ??
@@ -1197,7 +1197,7 @@ class TurnkeySDKClientBase {
1197
1197
  };
1198
1198
  this.exportWallet = async (input) => {
1199
1199
  const { organizationId, timestampMs, ...rest } = input;
1200
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1200
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1201
1201
  return this.command("/public/v1/submit/export_wallet", {
1202
1202
  parameters: rest,
1203
1203
  organizationId: organizationId ??
@@ -1222,7 +1222,7 @@ class TurnkeySDKClientBase {
1222
1222
  };
1223
1223
  this.exportWalletAccount = async (input) => {
1224
1224
  const { organizationId, timestampMs, ...rest } = input;
1225
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1225
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1226
1226
  return this.command("/public/v1/submit/export_wallet_account", {
1227
1227
  parameters: rest,
1228
1228
  organizationId: organizationId ??
@@ -1247,7 +1247,7 @@ class TurnkeySDKClientBase {
1247
1247
  };
1248
1248
  this.importPrivateKey = async (input) => {
1249
1249
  const { organizationId, timestampMs, ...rest } = input;
1250
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1250
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1251
1251
  return this.command("/public/v1/submit/import_private_key", {
1252
1252
  parameters: rest,
1253
1253
  organizationId: organizationId ??
@@ -1272,7 +1272,7 @@ class TurnkeySDKClientBase {
1272
1272
  };
1273
1273
  this.importWallet = async (input) => {
1274
1274
  const { organizationId, timestampMs, ...rest } = input;
1275
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1275
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1276
1276
  return this.command("/public/v1/submit/import_wallet", {
1277
1277
  parameters: rest,
1278
1278
  organizationId: organizationId ??
@@ -1297,7 +1297,7 @@ class TurnkeySDKClientBase {
1297
1297
  };
1298
1298
  this.initImportPrivateKey = async (input) => {
1299
1299
  const { organizationId, timestampMs, ...rest } = input;
1300
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1300
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1301
1301
  return this.command("/public/v1/submit/init_import_private_key", {
1302
1302
  parameters: rest,
1303
1303
  organizationId: organizationId ??
@@ -1322,7 +1322,7 @@ class TurnkeySDKClientBase {
1322
1322
  };
1323
1323
  this.initImportWallet = async (input) => {
1324
1324
  const { organizationId, timestampMs, ...rest } = input;
1325
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1325
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1326
1326
  return this.command("/public/v1/submit/init_import_wallet", {
1327
1327
  parameters: rest,
1328
1328
  organizationId: organizationId ??
@@ -1347,7 +1347,7 @@ class TurnkeySDKClientBase {
1347
1347
  };
1348
1348
  this.initOtpAuth = async (input) => {
1349
1349
  const { organizationId, timestampMs, ...rest } = input;
1350
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1350
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1351
1351
  return this.command("/public/v1/submit/init_otp_auth", {
1352
1352
  parameters: rest,
1353
1353
  organizationId: organizationId ??
@@ -1372,7 +1372,7 @@ class TurnkeySDKClientBase {
1372
1372
  };
1373
1373
  this.initUserEmailRecovery = async (input) => {
1374
1374
  const { organizationId, timestampMs, ...rest } = input;
1375
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1375
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1376
1376
  return this.command("/public/v1/submit/init_user_email_recovery", {
1377
1377
  parameters: rest,
1378
1378
  organizationId: organizationId ??
@@ -1397,7 +1397,7 @@ class TurnkeySDKClientBase {
1397
1397
  };
1398
1398
  this.oauth = async (input) => {
1399
1399
  const { organizationId, timestampMs, ...rest } = input;
1400
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1400
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1401
1401
  return this.command("/public/v1/submit/oauth", {
1402
1402
  parameters: rest,
1403
1403
  organizationId: organizationId ??
@@ -1422,7 +1422,7 @@ class TurnkeySDKClientBase {
1422
1422
  };
1423
1423
  this.otpAuth = async (input) => {
1424
1424
  const { organizationId, timestampMs, ...rest } = input;
1425
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1425
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1426
1426
  return this.command("/public/v1/submit/otp_auth", {
1427
1427
  parameters: rest,
1428
1428
  organizationId: organizationId ??
@@ -1447,7 +1447,7 @@ class TurnkeySDKClientBase {
1447
1447
  };
1448
1448
  this.recoverUser = async (input) => {
1449
1449
  const { organizationId, timestampMs, ...rest } = input;
1450
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1450
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1451
1451
  return this.command("/public/v1/submit/recover_user", {
1452
1452
  parameters: rest,
1453
1453
  organizationId: organizationId ??
@@ -1472,7 +1472,7 @@ class TurnkeySDKClientBase {
1472
1472
  };
1473
1473
  this.rejectActivity = async (input) => {
1474
1474
  const { organizationId, timestampMs, ...rest } = input;
1475
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1475
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1476
1476
  return this.activityDecision("/public/v1/submit/reject_activity", {
1477
1477
  parameters: rest,
1478
1478
  organizationId: organizationId ??
@@ -1497,7 +1497,7 @@ class TurnkeySDKClientBase {
1497
1497
  };
1498
1498
  this.removeOrganizationFeature = async (input) => {
1499
1499
  const { organizationId, timestampMs, ...rest } = input;
1500
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1500
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1501
1501
  return this.command("/public/v1/submit/remove_organization_feature", {
1502
1502
  parameters: rest,
1503
1503
  organizationId: organizationId ??
@@ -1522,7 +1522,7 @@ class TurnkeySDKClientBase {
1522
1522
  };
1523
1523
  this.setOrganizationFeature = async (input) => {
1524
1524
  const { organizationId, timestampMs, ...rest } = input;
1525
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1525
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1526
1526
  return this.command("/public/v1/submit/set_organization_feature", {
1527
1527
  parameters: rest,
1528
1528
  organizationId: organizationId ??
@@ -1547,7 +1547,7 @@ class TurnkeySDKClientBase {
1547
1547
  };
1548
1548
  this.signRawPayload = async (input) => {
1549
1549
  const { organizationId, timestampMs, ...rest } = input;
1550
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1550
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1551
1551
  return this.command("/public/v1/submit/sign_raw_payload", {
1552
1552
  parameters: rest,
1553
1553
  organizationId: organizationId ??
@@ -1572,7 +1572,7 @@ class TurnkeySDKClientBase {
1572
1572
  };
1573
1573
  this.signRawPayloads = async (input) => {
1574
1574
  const { organizationId, timestampMs, ...rest } = input;
1575
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1575
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1576
1576
  return this.command("/public/v1/submit/sign_raw_payloads", {
1577
1577
  parameters: rest,
1578
1578
  organizationId: organizationId ??
@@ -1597,7 +1597,7 @@ class TurnkeySDKClientBase {
1597
1597
  };
1598
1598
  this.signTransaction = async (input) => {
1599
1599
  const { organizationId, timestampMs, ...rest } = input;
1600
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1600
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1601
1601
  return this.command("/public/v1/submit/sign_transaction", {
1602
1602
  parameters: rest,
1603
1603
  organizationId: organizationId ??
@@ -1622,7 +1622,7 @@ class TurnkeySDKClientBase {
1622
1622
  };
1623
1623
  this.updatePolicy = async (input) => {
1624
1624
  const { organizationId, timestampMs, ...rest } = input;
1625
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1625
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1626
1626
  return this.command("/public/v1/submit/update_policy", {
1627
1627
  parameters: rest,
1628
1628
  organizationId: organizationId ??
@@ -1647,7 +1647,7 @@ class TurnkeySDKClientBase {
1647
1647
  };
1648
1648
  this.updatePrivateKeyTag = async (input) => {
1649
1649
  const { organizationId, timestampMs, ...rest } = input;
1650
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1650
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1651
1651
  return this.command("/public/v1/submit/update_private_key_tag", {
1652
1652
  parameters: rest,
1653
1653
  organizationId: organizationId ??
@@ -1672,7 +1672,7 @@ class TurnkeySDKClientBase {
1672
1672
  };
1673
1673
  this.updateRootQuorum = async (input) => {
1674
1674
  const { organizationId, timestampMs, ...rest } = input;
1675
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1675
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1676
1676
  return this.command("/public/v1/submit/update_root_quorum", {
1677
1677
  parameters: rest,
1678
1678
  organizationId: organizationId ??
@@ -1697,7 +1697,7 @@ class TurnkeySDKClientBase {
1697
1697
  };
1698
1698
  this.updateUser = async (input) => {
1699
1699
  const { organizationId, timestampMs, ...rest } = input;
1700
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1700
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1701
1701
  return this.command("/public/v1/submit/update_user", {
1702
1702
  parameters: rest,
1703
1703
  organizationId: organizationId ??
@@ -1722,7 +1722,7 @@ class TurnkeySDKClientBase {
1722
1722
  };
1723
1723
  this.updateUserTag = async (input) => {
1724
1724
  const { organizationId, timestampMs, ...rest } = input;
1725
- const currentUser = await storage.getStorageValue(storage.StorageKeys.CurrentUser);
1725
+ const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1726
1726
  return this.command("/public/v1/submit/update_user_tag", {
1727
1727
  parameters: rest,
1728
1728
  organizationId: organizationId ??