@turnkey/sdk-browser 1.16.0 → 2.0.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/__clients__/base-client.d.ts +7 -0
  3. package/dist/__clients__/base-client.d.ts.map +1 -0
  4. package/dist/__clients__/base-client.js +13 -0
  5. package/dist/__clients__/base-client.js.map +1 -0
  6. package/dist/__clients__/base-client.mjs +11 -0
  7. package/dist/__clients__/base-client.mjs.map +1 -0
  8. package/dist/__clients__/browser-clients.d.ts +243 -0
  9. package/dist/__clients__/browser-clients.d.ts.map +1 -0
  10. package/dist/__clients__/browser-clients.js +633 -0
  11. package/dist/__clients__/browser-clients.js.map +1 -0
  12. package/dist/__clients__/browser-clients.mjs +628 -0
  13. package/dist/__clients__/browser-clients.mjs.map +1 -0
  14. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  15. package/dist/__generated__/sdk-client-base.js +106 -110
  16. package/dist/__generated__/sdk-client-base.js.map +1 -1
  17. package/dist/__generated__/sdk-client-base.mjs +106 -110
  18. package/dist/__generated__/sdk-client-base.mjs.map +1 -1
  19. package/dist/__generated__/version.d.ts +1 -1
  20. package/dist/__generated__/version.d.ts.map +1 -1
  21. package/dist/__generated__/version.js +1 -1
  22. package/dist/__generated__/version.mjs +1 -1
  23. package/dist/__types__/base.d.ts +12 -0
  24. package/dist/__types__/base.d.ts.map +1 -1
  25. package/dist/__types__/base.js +5 -0
  26. package/dist/__types__/base.js.map +1 -1
  27. package/dist/__types__/base.mjs +6 -1
  28. package/dist/__types__/base.mjs.map +1 -1
  29. package/dist/constants.d.ts +2 -0
  30. package/dist/constants.d.ts.map +1 -0
  31. package/dist/constants.js +6 -0
  32. package/dist/constants.js.map +1 -0
  33. package/dist/constants.mjs +4 -0
  34. package/dist/constants.mjs.map +1 -0
  35. package/dist/index.d.ts +4 -4
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +9 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +3 -2
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/models.d.ts +1 -1
  42. package/dist/models.d.ts.map +1 -1
  43. package/dist/sdk-client.d.ts +14 -186
  44. package/dist/sdk-client.d.ts.map +1 -1
  45. package/dist/sdk-client.js +75 -437
  46. package/dist/sdk-client.js.map +1 -1
  47. package/dist/sdk-client.mjs +69 -431
  48. package/dist/sdk-client.mjs.map +1 -1
  49. package/dist/storage.d.ts +23 -3
  50. package/dist/storage.d.ts.map +1 -1
  51. package/dist/storage.js +17 -0
  52. package/dist/storage.js.map +1 -1
  53. package/dist/storage.mjs +17 -1
  54. package/dist/storage.mjs.map +1 -1
  55. package/package.json +6 -5
@@ -483,12 +483,10 @@ class TurnkeySDKClientBase {
483
483
  };
484
484
  this.approveActivity = async (input) => {
485
485
  const { organizationId, timestampMs, ...rest } = input;
486
- const currentUser = await getStorageValue(StorageKeys.UserSession);
486
+ const session = await getStorageValue(StorageKeys.Session);
487
487
  return this.activityDecision("/public/v1/submit/approve_activity", {
488
488
  parameters: rest,
489
- organizationId: organizationId ??
490
- currentUser?.organization?.organizationId ??
491
- this.config.organizationId,
489
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
492
490
  timestampMs: timestampMs ?? String(Date.now()),
493
491
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
494
492
  });
@@ -508,11 +506,11 @@ class TurnkeySDKClientBase {
508
506
  };
509
507
  this.createApiKeys = async (input) => {
510
508
  const { organizationId, timestampMs, ...rest } = input;
511
- const currentUser = await getStorageValue(StorageKeys.UserSession);
509
+ const session = await getStorageValue(StorageKeys.Session);
512
510
  return this.command("/public/v1/submit/create_api_keys", {
513
511
  parameters: rest,
514
512
  organizationId: organizationId ??
515
- currentUser?.organization?.organizationId ??
513
+ session?.organizationId ??
516
514
  this.config.organizationId,
517
515
  timestampMs: timestampMs ?? String(Date.now()),
518
516
  type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
@@ -533,11 +531,11 @@ class TurnkeySDKClientBase {
533
531
  };
534
532
  this.createApiOnlyUsers = async (input) => {
535
533
  const { organizationId, timestampMs, ...rest } = input;
536
- const currentUser = await getStorageValue(StorageKeys.UserSession);
534
+ const session = await getStorageValue(StorageKeys.Session);
537
535
  return this.command("/public/v1/submit/create_api_only_users", {
538
536
  parameters: rest,
539
537
  organizationId: organizationId ??
540
- currentUser?.organization?.organizationId ??
538
+ session?.organizationId ??
541
539
  this.config.organizationId,
542
540
  timestampMs: timestampMs ?? String(Date.now()),
543
541
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
@@ -558,11 +556,11 @@ class TurnkeySDKClientBase {
558
556
  };
559
557
  this.createAuthenticators = async (input) => {
560
558
  const { organizationId, timestampMs, ...rest } = input;
561
- const currentUser = await getStorageValue(StorageKeys.UserSession);
559
+ const session = await getStorageValue(StorageKeys.Session);
562
560
  return this.command("/public/v1/submit/create_authenticators", {
563
561
  parameters: rest,
564
562
  organizationId: organizationId ??
565
- currentUser?.organization?.organizationId ??
563
+ session?.organizationId ??
566
564
  this.config.organizationId,
567
565
  timestampMs: timestampMs ?? String(Date.now()),
568
566
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
@@ -583,11 +581,11 @@ class TurnkeySDKClientBase {
583
581
  };
584
582
  this.createInvitations = async (input) => {
585
583
  const { organizationId, timestampMs, ...rest } = input;
586
- const currentUser = await getStorageValue(StorageKeys.UserSession);
584
+ const session = await getStorageValue(StorageKeys.Session);
587
585
  return this.command("/public/v1/submit/create_invitations", {
588
586
  parameters: rest,
589
587
  organizationId: organizationId ??
590
- currentUser?.organization?.organizationId ??
588
+ session?.organizationId ??
591
589
  this.config.organizationId,
592
590
  timestampMs: timestampMs ?? String(Date.now()),
593
591
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
@@ -608,11 +606,11 @@ class TurnkeySDKClientBase {
608
606
  };
609
607
  this.createOauthProviders = async (input) => {
610
608
  const { organizationId, timestampMs, ...rest } = input;
611
- const currentUser = await getStorageValue(StorageKeys.UserSession);
609
+ const session = await getStorageValue(StorageKeys.Session);
612
610
  return this.command("/public/v1/submit/create_oauth_providers", {
613
611
  parameters: rest,
614
612
  organizationId: organizationId ??
615
- currentUser?.organization?.organizationId ??
613
+ session?.organizationId ??
616
614
  this.config.organizationId,
617
615
  timestampMs: timestampMs ?? String(Date.now()),
618
616
  type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
@@ -633,11 +631,11 @@ class TurnkeySDKClientBase {
633
631
  };
634
632
  this.createPolicies = async (input) => {
635
633
  const { organizationId, timestampMs, ...rest } = input;
636
- const currentUser = await getStorageValue(StorageKeys.UserSession);
634
+ const session = await getStorageValue(StorageKeys.Session);
637
635
  return this.command("/public/v1/submit/create_policies", {
638
636
  parameters: rest,
639
637
  organizationId: organizationId ??
640
- currentUser?.organization?.organizationId ??
638
+ session?.organizationId ??
641
639
  this.config.organizationId,
642
640
  timestampMs: timestampMs ?? String(Date.now()),
643
641
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
@@ -658,11 +656,11 @@ class TurnkeySDKClientBase {
658
656
  };
659
657
  this.createPolicy = async (input) => {
660
658
  const { organizationId, timestampMs, ...rest } = input;
661
- const currentUser = await getStorageValue(StorageKeys.UserSession);
659
+ const session = await getStorageValue(StorageKeys.Session);
662
660
  return this.command("/public/v1/submit/create_policy", {
663
661
  parameters: rest,
664
662
  organizationId: organizationId ??
665
- currentUser?.organization?.organizationId ??
663
+ session?.organizationId ??
666
664
  this.config.organizationId,
667
665
  timestampMs: timestampMs ?? String(Date.now()),
668
666
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
@@ -683,11 +681,11 @@ class TurnkeySDKClientBase {
683
681
  };
684
682
  this.createPrivateKeyTag = async (input) => {
685
683
  const { organizationId, timestampMs, ...rest } = input;
686
- const currentUser = await getStorageValue(StorageKeys.UserSession);
684
+ const session = await getStorageValue(StorageKeys.Session);
687
685
  return this.command("/public/v1/submit/create_private_key_tag", {
688
686
  parameters: rest,
689
687
  organizationId: organizationId ??
690
- currentUser?.organization?.organizationId ??
688
+ session?.organizationId ??
691
689
  this.config.organizationId,
692
690
  timestampMs: timestampMs ?? String(Date.now()),
693
691
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
@@ -708,11 +706,11 @@ class TurnkeySDKClientBase {
708
706
  };
709
707
  this.createPrivateKeys = async (input) => {
710
708
  const { organizationId, timestampMs, ...rest } = input;
711
- const currentUser = await getStorageValue(StorageKeys.UserSession);
709
+ const session = await getStorageValue(StorageKeys.Session);
712
710
  return this.command("/public/v1/submit/create_private_keys", {
713
711
  parameters: rest,
714
712
  organizationId: organizationId ??
715
- currentUser?.organization?.organizationId ??
713
+ session?.organizationId ??
716
714
  this.config.organizationId,
717
715
  timestampMs: timestampMs ?? String(Date.now()),
718
716
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
@@ -733,11 +731,11 @@ class TurnkeySDKClientBase {
733
731
  };
734
732
  this.createReadOnlySession = async (input) => {
735
733
  const { organizationId, timestampMs, ...rest } = input;
736
- const currentUser = await getStorageValue(StorageKeys.UserSession);
734
+ const session = await getStorageValue(StorageKeys.Session);
737
735
  return this.command("/public/v1/submit/create_read_only_session", {
738
736
  parameters: rest,
739
737
  organizationId: organizationId ??
740
- currentUser?.organization?.organizationId ??
738
+ session?.organizationId ??
741
739
  this.config.organizationId,
742
740
  timestampMs: timestampMs ?? String(Date.now()),
743
741
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
@@ -758,11 +756,11 @@ class TurnkeySDKClientBase {
758
756
  };
759
757
  this.createReadWriteSession = async (input) => {
760
758
  const { organizationId, timestampMs, ...rest } = input;
761
- const currentUser = await getStorageValue(StorageKeys.UserSession);
759
+ const session = await getStorageValue(StorageKeys.Session);
762
760
  return this.command("/public/v1/submit/create_read_write_session", {
763
761
  parameters: rest,
764
762
  organizationId: organizationId ??
765
- currentUser?.organization?.organizationId ??
763
+ session?.organizationId ??
766
764
  this.config.organizationId,
767
765
  timestampMs: timestampMs ?? String(Date.now()),
768
766
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
@@ -783,11 +781,11 @@ class TurnkeySDKClientBase {
783
781
  };
784
782
  this.createSubOrganization = async (input) => {
785
783
  const { organizationId, timestampMs, ...rest } = input;
786
- const currentUser = await getStorageValue(StorageKeys.UserSession);
784
+ const session = await getStorageValue(StorageKeys.Session);
787
785
  return this.command("/public/v1/submit/create_sub_organization", {
788
786
  parameters: rest,
789
787
  organizationId: organizationId ??
790
- currentUser?.organization?.organizationId ??
788
+ session?.organizationId ??
791
789
  this.config.organizationId,
792
790
  timestampMs: timestampMs ?? String(Date.now()),
793
791
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
@@ -808,11 +806,11 @@ class TurnkeySDKClientBase {
808
806
  };
809
807
  this.createUserTag = async (input) => {
810
808
  const { organizationId, timestampMs, ...rest } = input;
811
- const currentUser = await getStorageValue(StorageKeys.UserSession);
809
+ const session = await getStorageValue(StorageKeys.Session);
812
810
  return this.command("/public/v1/submit/create_user_tag", {
813
811
  parameters: rest,
814
812
  organizationId: organizationId ??
815
- currentUser?.organization?.organizationId ??
813
+ session?.organizationId ??
816
814
  this.config.organizationId,
817
815
  timestampMs: timestampMs ?? String(Date.now()),
818
816
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
@@ -833,11 +831,11 @@ class TurnkeySDKClientBase {
833
831
  };
834
832
  this.createUsers = async (input) => {
835
833
  const { organizationId, timestampMs, ...rest } = input;
836
- const currentUser = await getStorageValue(StorageKeys.UserSession);
834
+ const session = await getStorageValue(StorageKeys.Session);
837
835
  return this.command("/public/v1/submit/create_users", {
838
836
  parameters: rest,
839
837
  organizationId: organizationId ??
840
- currentUser?.organization?.organizationId ??
838
+ session?.organizationId ??
841
839
  this.config.organizationId,
842
840
  timestampMs: timestampMs ?? String(Date.now()),
843
841
  type: "ACTIVITY_TYPE_CREATE_USERS_V2",
@@ -858,11 +856,11 @@ class TurnkeySDKClientBase {
858
856
  };
859
857
  this.createWallet = async (input) => {
860
858
  const { organizationId, timestampMs, ...rest } = input;
861
- const currentUser = await getStorageValue(StorageKeys.UserSession);
859
+ const session = await getStorageValue(StorageKeys.Session);
862
860
  return this.command("/public/v1/submit/create_wallet", {
863
861
  parameters: rest,
864
862
  organizationId: organizationId ??
865
- currentUser?.organization?.organizationId ??
863
+ session?.organizationId ??
866
864
  this.config.organizationId,
867
865
  timestampMs: timestampMs ?? String(Date.now()),
868
866
  type: "ACTIVITY_TYPE_CREATE_WALLET",
@@ -883,11 +881,11 @@ class TurnkeySDKClientBase {
883
881
  };
884
882
  this.createWalletAccounts = async (input) => {
885
883
  const { organizationId, timestampMs, ...rest } = input;
886
- const currentUser = await getStorageValue(StorageKeys.UserSession);
884
+ const session = await getStorageValue(StorageKeys.Session);
887
885
  return this.command("/public/v1/submit/create_wallet_accounts", {
888
886
  parameters: rest,
889
887
  organizationId: organizationId ??
890
- currentUser?.organization?.organizationId ??
888
+ session?.organizationId ??
891
889
  this.config.organizationId,
892
890
  timestampMs: timestampMs ?? String(Date.now()),
893
891
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
@@ -908,11 +906,11 @@ class TurnkeySDKClientBase {
908
906
  };
909
907
  this.deleteApiKeys = async (input) => {
910
908
  const { organizationId, timestampMs, ...rest } = input;
911
- const currentUser = await getStorageValue(StorageKeys.UserSession);
909
+ const session = await getStorageValue(StorageKeys.Session);
912
910
  return this.command("/public/v1/submit/delete_api_keys", {
913
911
  parameters: rest,
914
912
  organizationId: organizationId ??
915
- currentUser?.organization?.organizationId ??
913
+ session?.organizationId ??
916
914
  this.config.organizationId,
917
915
  timestampMs: timestampMs ?? String(Date.now()),
918
916
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
@@ -933,11 +931,11 @@ class TurnkeySDKClientBase {
933
931
  };
934
932
  this.deleteAuthenticators = async (input) => {
935
933
  const { organizationId, timestampMs, ...rest } = input;
936
- const currentUser = await getStorageValue(StorageKeys.UserSession);
934
+ const session = await getStorageValue(StorageKeys.Session);
937
935
  return this.command("/public/v1/submit/delete_authenticators", {
938
936
  parameters: rest,
939
937
  organizationId: organizationId ??
940
- currentUser?.organization?.organizationId ??
938
+ session?.organizationId ??
941
939
  this.config.organizationId,
942
940
  timestampMs: timestampMs ?? String(Date.now()),
943
941
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
@@ -958,11 +956,11 @@ class TurnkeySDKClientBase {
958
956
  };
959
957
  this.deleteInvitation = async (input) => {
960
958
  const { organizationId, timestampMs, ...rest } = input;
961
- const currentUser = await getStorageValue(StorageKeys.UserSession);
959
+ const session = await getStorageValue(StorageKeys.Session);
962
960
  return this.command("/public/v1/submit/delete_invitation", {
963
961
  parameters: rest,
964
962
  organizationId: organizationId ??
965
- currentUser?.organization?.organizationId ??
963
+ session?.organizationId ??
966
964
  this.config.organizationId,
967
965
  timestampMs: timestampMs ?? String(Date.now()),
968
966
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
@@ -983,11 +981,11 @@ class TurnkeySDKClientBase {
983
981
  };
984
982
  this.deleteOauthProviders = async (input) => {
985
983
  const { organizationId, timestampMs, ...rest } = input;
986
- const currentUser = await getStorageValue(StorageKeys.UserSession);
984
+ const session = await getStorageValue(StorageKeys.Session);
987
985
  return this.command("/public/v1/submit/delete_oauth_providers", {
988
986
  parameters: rest,
989
987
  organizationId: organizationId ??
990
- currentUser?.organization?.organizationId ??
988
+ session?.organizationId ??
991
989
  this.config.organizationId,
992
990
  timestampMs: timestampMs ?? String(Date.now()),
993
991
  type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
@@ -1008,11 +1006,11 @@ class TurnkeySDKClientBase {
1008
1006
  };
1009
1007
  this.deletePolicy = async (input) => {
1010
1008
  const { organizationId, timestampMs, ...rest } = input;
1011
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1009
+ const session = await getStorageValue(StorageKeys.Session);
1012
1010
  return this.command("/public/v1/submit/delete_policy", {
1013
1011
  parameters: rest,
1014
1012
  organizationId: organizationId ??
1015
- currentUser?.organization?.organizationId ??
1013
+ session?.organizationId ??
1016
1014
  this.config.organizationId,
1017
1015
  timestampMs: timestampMs ?? String(Date.now()),
1018
1016
  type: "ACTIVITY_TYPE_DELETE_POLICY",
@@ -1033,11 +1031,11 @@ class TurnkeySDKClientBase {
1033
1031
  };
1034
1032
  this.deletePrivateKeyTags = async (input) => {
1035
1033
  const { organizationId, timestampMs, ...rest } = input;
1036
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1034
+ const session = await getStorageValue(StorageKeys.Session);
1037
1035
  return this.command("/public/v1/submit/delete_private_key_tags", {
1038
1036
  parameters: rest,
1039
1037
  organizationId: organizationId ??
1040
- currentUser?.organization?.organizationId ??
1038
+ session?.organizationId ??
1041
1039
  this.config.organizationId,
1042
1040
  timestampMs: timestampMs ?? String(Date.now()),
1043
1041
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
@@ -1058,11 +1056,11 @@ class TurnkeySDKClientBase {
1058
1056
  };
1059
1057
  this.deletePrivateKeys = async (input) => {
1060
1058
  const { organizationId, timestampMs, ...rest } = input;
1061
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1059
+ const session = await getStorageValue(StorageKeys.Session);
1062
1060
  return this.command("/public/v1/submit/delete_private_keys", {
1063
1061
  parameters: rest,
1064
1062
  organizationId: organizationId ??
1065
- currentUser?.organization?.organizationId ??
1063
+ session?.organizationId ??
1066
1064
  this.config.organizationId,
1067
1065
  timestampMs: timestampMs ?? String(Date.now()),
1068
1066
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
@@ -1083,11 +1081,11 @@ class TurnkeySDKClientBase {
1083
1081
  };
1084
1082
  this.deleteSubOrganization = async (input) => {
1085
1083
  const { organizationId, timestampMs, ...rest } = input;
1086
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1084
+ const session = await getStorageValue(StorageKeys.Session);
1087
1085
  return this.command("/public/v1/submit/delete_sub_organization", {
1088
1086
  parameters: rest,
1089
1087
  organizationId: organizationId ??
1090
- currentUser?.organization?.organizationId ??
1088
+ session?.organizationId ??
1091
1089
  this.config.organizationId,
1092
1090
  timestampMs: timestampMs ?? String(Date.now()),
1093
1091
  type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
@@ -1108,11 +1106,11 @@ class TurnkeySDKClientBase {
1108
1106
  };
1109
1107
  this.deleteUserTags = async (input) => {
1110
1108
  const { organizationId, timestampMs, ...rest } = input;
1111
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1109
+ const session = await getStorageValue(StorageKeys.Session);
1112
1110
  return this.command("/public/v1/submit/delete_user_tags", {
1113
1111
  parameters: rest,
1114
1112
  organizationId: organizationId ??
1115
- currentUser?.organization?.organizationId ??
1113
+ session?.organizationId ??
1116
1114
  this.config.organizationId,
1117
1115
  timestampMs: timestampMs ?? String(Date.now()),
1118
1116
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
@@ -1133,11 +1131,11 @@ class TurnkeySDKClientBase {
1133
1131
  };
1134
1132
  this.deleteUsers = async (input) => {
1135
1133
  const { organizationId, timestampMs, ...rest } = input;
1136
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1134
+ const session = await getStorageValue(StorageKeys.Session);
1137
1135
  return this.command("/public/v1/submit/delete_users", {
1138
1136
  parameters: rest,
1139
1137
  organizationId: organizationId ??
1140
- currentUser?.organization?.organizationId ??
1138
+ session?.organizationId ??
1141
1139
  this.config.organizationId,
1142
1140
  timestampMs: timestampMs ?? String(Date.now()),
1143
1141
  type: "ACTIVITY_TYPE_DELETE_USERS",
@@ -1158,11 +1156,11 @@ class TurnkeySDKClientBase {
1158
1156
  };
1159
1157
  this.deleteWallets = async (input) => {
1160
1158
  const { organizationId, timestampMs, ...rest } = input;
1161
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1159
+ const session = await getStorageValue(StorageKeys.Session);
1162
1160
  return this.command("/public/v1/submit/delete_wallets", {
1163
1161
  parameters: rest,
1164
1162
  organizationId: organizationId ??
1165
- currentUser?.organization?.organizationId ??
1163
+ session?.organizationId ??
1166
1164
  this.config.organizationId,
1167
1165
  timestampMs: timestampMs ?? String(Date.now()),
1168
1166
  type: "ACTIVITY_TYPE_DELETE_WALLETS",
@@ -1183,11 +1181,11 @@ class TurnkeySDKClientBase {
1183
1181
  };
1184
1182
  this.emailAuth = async (input) => {
1185
1183
  const { organizationId, timestampMs, ...rest } = input;
1186
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1184
+ const session = await getStorageValue(StorageKeys.Session);
1187
1185
  return this.command("/public/v1/submit/email_auth", {
1188
1186
  parameters: rest,
1189
1187
  organizationId: organizationId ??
1190
- currentUser?.organization?.organizationId ??
1188
+ session?.organizationId ??
1191
1189
  this.config.organizationId,
1192
1190
  timestampMs: timestampMs ?? String(Date.now()),
1193
1191
  type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
@@ -1208,11 +1206,11 @@ class TurnkeySDKClientBase {
1208
1206
  };
1209
1207
  this.exportPrivateKey = async (input) => {
1210
1208
  const { organizationId, timestampMs, ...rest } = input;
1211
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1209
+ const session = await getStorageValue(StorageKeys.Session);
1212
1210
  return this.command("/public/v1/submit/export_private_key", {
1213
1211
  parameters: rest,
1214
1212
  organizationId: organizationId ??
1215
- currentUser?.organization?.organizationId ??
1213
+ session?.organizationId ??
1216
1214
  this.config.organizationId,
1217
1215
  timestampMs: timestampMs ?? String(Date.now()),
1218
1216
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
@@ -1233,11 +1231,11 @@ class TurnkeySDKClientBase {
1233
1231
  };
1234
1232
  this.exportWallet = async (input) => {
1235
1233
  const { organizationId, timestampMs, ...rest } = input;
1236
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1234
+ const session = await getStorageValue(StorageKeys.Session);
1237
1235
  return this.command("/public/v1/submit/export_wallet", {
1238
1236
  parameters: rest,
1239
1237
  organizationId: organizationId ??
1240
- currentUser?.organization?.organizationId ??
1238
+ session?.organizationId ??
1241
1239
  this.config.organizationId,
1242
1240
  timestampMs: timestampMs ?? String(Date.now()),
1243
1241
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
@@ -1258,11 +1256,11 @@ class TurnkeySDKClientBase {
1258
1256
  };
1259
1257
  this.exportWalletAccount = async (input) => {
1260
1258
  const { organizationId, timestampMs, ...rest } = input;
1261
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1259
+ const session = await getStorageValue(StorageKeys.Session);
1262
1260
  return this.command("/public/v1/submit/export_wallet_account", {
1263
1261
  parameters: rest,
1264
1262
  organizationId: organizationId ??
1265
- currentUser?.organization?.organizationId ??
1263
+ session?.organizationId ??
1266
1264
  this.config.organizationId,
1267
1265
  timestampMs: timestampMs ?? String(Date.now()),
1268
1266
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
@@ -1283,11 +1281,11 @@ class TurnkeySDKClientBase {
1283
1281
  };
1284
1282
  this.importPrivateKey = async (input) => {
1285
1283
  const { organizationId, timestampMs, ...rest } = input;
1286
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1284
+ const session = await getStorageValue(StorageKeys.Session);
1287
1285
  return this.command("/public/v1/submit/import_private_key", {
1288
1286
  parameters: rest,
1289
1287
  organizationId: organizationId ??
1290
- currentUser?.organization?.organizationId ??
1288
+ session?.organizationId ??
1291
1289
  this.config.organizationId,
1292
1290
  timestampMs: timestampMs ?? String(Date.now()),
1293
1291
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
@@ -1308,11 +1306,11 @@ class TurnkeySDKClientBase {
1308
1306
  };
1309
1307
  this.importWallet = async (input) => {
1310
1308
  const { organizationId, timestampMs, ...rest } = input;
1311
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1309
+ const session = await getStorageValue(StorageKeys.Session);
1312
1310
  return this.command("/public/v1/submit/import_wallet", {
1313
1311
  parameters: rest,
1314
1312
  organizationId: organizationId ??
1315
- currentUser?.organization?.organizationId ??
1313
+ session?.organizationId ??
1316
1314
  this.config.organizationId,
1317
1315
  timestampMs: timestampMs ?? String(Date.now()),
1318
1316
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
@@ -1333,11 +1331,11 @@ class TurnkeySDKClientBase {
1333
1331
  };
1334
1332
  this.initImportPrivateKey = async (input) => {
1335
1333
  const { organizationId, timestampMs, ...rest } = input;
1336
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1334
+ const session = await getStorageValue(StorageKeys.Session);
1337
1335
  return this.command("/public/v1/submit/init_import_private_key", {
1338
1336
  parameters: rest,
1339
1337
  organizationId: organizationId ??
1340
- currentUser?.organization?.organizationId ??
1338
+ session?.organizationId ??
1341
1339
  this.config.organizationId,
1342
1340
  timestampMs: timestampMs ?? String(Date.now()),
1343
1341
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
@@ -1358,11 +1356,11 @@ class TurnkeySDKClientBase {
1358
1356
  };
1359
1357
  this.initImportWallet = async (input) => {
1360
1358
  const { organizationId, timestampMs, ...rest } = input;
1361
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1359
+ const session = await getStorageValue(StorageKeys.Session);
1362
1360
  return this.command("/public/v1/submit/init_import_wallet", {
1363
1361
  parameters: rest,
1364
1362
  organizationId: organizationId ??
1365
- currentUser?.organization?.organizationId ??
1363
+ session?.organizationId ??
1366
1364
  this.config.organizationId,
1367
1365
  timestampMs: timestampMs ?? String(Date.now()),
1368
1366
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
@@ -1383,11 +1381,11 @@ class TurnkeySDKClientBase {
1383
1381
  };
1384
1382
  this.initOtpAuth = async (input) => {
1385
1383
  const { organizationId, timestampMs, ...rest } = input;
1386
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1384
+ const session = await getStorageValue(StorageKeys.Session);
1387
1385
  return this.command("/public/v1/submit/init_otp_auth", {
1388
1386
  parameters: rest,
1389
1387
  organizationId: organizationId ??
1390
- currentUser?.organization?.organizationId ??
1388
+ session?.organizationId ??
1391
1389
  this.config.organizationId,
1392
1390
  timestampMs: timestampMs ?? String(Date.now()),
1393
1391
  type: "ACTIVITY_TYPE_INIT_OTP_AUTH",
@@ -1408,11 +1406,11 @@ class TurnkeySDKClientBase {
1408
1406
  };
1409
1407
  this.initUserEmailRecovery = async (input) => {
1410
1408
  const { organizationId, timestampMs, ...rest } = input;
1411
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1409
+ const session = await getStorageValue(StorageKeys.Session);
1412
1410
  return this.command("/public/v1/submit/init_user_email_recovery", {
1413
1411
  parameters: rest,
1414
1412
  organizationId: organizationId ??
1415
- currentUser?.organization?.organizationId ??
1413
+ session?.organizationId ??
1416
1414
  this.config.organizationId,
1417
1415
  timestampMs: timestampMs ?? String(Date.now()),
1418
1416
  type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
@@ -1433,11 +1431,11 @@ class TurnkeySDKClientBase {
1433
1431
  };
1434
1432
  this.oauth = async (input) => {
1435
1433
  const { organizationId, timestampMs, ...rest } = input;
1436
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1434
+ const session = await getStorageValue(StorageKeys.Session);
1437
1435
  return this.command("/public/v1/submit/oauth", {
1438
1436
  parameters: rest,
1439
1437
  organizationId: organizationId ??
1440
- currentUser?.organization?.organizationId ??
1438
+ session?.organizationId ??
1441
1439
  this.config.organizationId,
1442
1440
  timestampMs: timestampMs ?? String(Date.now()),
1443
1441
  type: "ACTIVITY_TYPE_OAUTH",
@@ -1458,11 +1456,11 @@ class TurnkeySDKClientBase {
1458
1456
  };
1459
1457
  this.otpAuth = async (input) => {
1460
1458
  const { organizationId, timestampMs, ...rest } = input;
1461
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1459
+ const session = await getStorageValue(StorageKeys.Session);
1462
1460
  return this.command("/public/v1/submit/otp_auth", {
1463
1461
  parameters: rest,
1464
1462
  organizationId: organizationId ??
1465
- currentUser?.organization?.organizationId ??
1463
+ session?.organizationId ??
1466
1464
  this.config.organizationId,
1467
1465
  timestampMs: timestampMs ?? String(Date.now()),
1468
1466
  type: "ACTIVITY_TYPE_OTP_AUTH",
@@ -1483,11 +1481,11 @@ class TurnkeySDKClientBase {
1483
1481
  };
1484
1482
  this.recoverUser = async (input) => {
1485
1483
  const { organizationId, timestampMs, ...rest } = input;
1486
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1484
+ const session = await getStorageValue(StorageKeys.Session);
1487
1485
  return this.command("/public/v1/submit/recover_user", {
1488
1486
  parameters: rest,
1489
1487
  organizationId: organizationId ??
1490
- currentUser?.organization?.organizationId ??
1488
+ session?.organizationId ??
1491
1489
  this.config.organizationId,
1492
1490
  timestampMs: timestampMs ?? String(Date.now()),
1493
1491
  type: "ACTIVITY_TYPE_RECOVER_USER",
@@ -1508,12 +1506,10 @@ class TurnkeySDKClientBase {
1508
1506
  };
1509
1507
  this.rejectActivity = async (input) => {
1510
1508
  const { organizationId, timestampMs, ...rest } = input;
1511
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1509
+ const session = await getStorageValue(StorageKeys.Session);
1512
1510
  return this.activityDecision("/public/v1/submit/reject_activity", {
1513
1511
  parameters: rest,
1514
- organizationId: organizationId ??
1515
- currentUser?.organization?.organizationId ??
1516
- this.config.organizationId,
1512
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1517
1513
  timestampMs: timestampMs ?? String(Date.now()),
1518
1514
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
1519
1515
  });
@@ -1533,11 +1529,11 @@ class TurnkeySDKClientBase {
1533
1529
  };
1534
1530
  this.removeOrganizationFeature = async (input) => {
1535
1531
  const { organizationId, timestampMs, ...rest } = input;
1536
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1532
+ const session = await getStorageValue(StorageKeys.Session);
1537
1533
  return this.command("/public/v1/submit/remove_organization_feature", {
1538
1534
  parameters: rest,
1539
1535
  organizationId: organizationId ??
1540
- currentUser?.organization?.organizationId ??
1536
+ session?.organizationId ??
1541
1537
  this.config.organizationId,
1542
1538
  timestampMs: timestampMs ?? String(Date.now()),
1543
1539
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
@@ -1558,11 +1554,11 @@ class TurnkeySDKClientBase {
1558
1554
  };
1559
1555
  this.setOrganizationFeature = async (input) => {
1560
1556
  const { organizationId, timestampMs, ...rest } = input;
1561
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1557
+ const session = await getStorageValue(StorageKeys.Session);
1562
1558
  return this.command("/public/v1/submit/set_organization_feature", {
1563
1559
  parameters: rest,
1564
1560
  organizationId: organizationId ??
1565
- currentUser?.organization?.organizationId ??
1561
+ session?.organizationId ??
1566
1562
  this.config.organizationId,
1567
1563
  timestampMs: timestampMs ?? String(Date.now()),
1568
1564
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
@@ -1583,11 +1579,11 @@ class TurnkeySDKClientBase {
1583
1579
  };
1584
1580
  this.signRawPayload = async (input) => {
1585
1581
  const { organizationId, timestampMs, ...rest } = input;
1586
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1582
+ const session = await getStorageValue(StorageKeys.Session);
1587
1583
  return this.command("/public/v1/submit/sign_raw_payload", {
1588
1584
  parameters: rest,
1589
1585
  organizationId: organizationId ??
1590
- currentUser?.organization?.organizationId ??
1586
+ session?.organizationId ??
1591
1587
  this.config.organizationId,
1592
1588
  timestampMs: timestampMs ?? String(Date.now()),
1593
1589
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
@@ -1608,11 +1604,11 @@ class TurnkeySDKClientBase {
1608
1604
  };
1609
1605
  this.signRawPayloads = async (input) => {
1610
1606
  const { organizationId, timestampMs, ...rest } = input;
1611
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1607
+ const session = await getStorageValue(StorageKeys.Session);
1612
1608
  return this.command("/public/v1/submit/sign_raw_payloads", {
1613
1609
  parameters: rest,
1614
1610
  organizationId: organizationId ??
1615
- currentUser?.organization?.organizationId ??
1611
+ session?.organizationId ??
1616
1612
  this.config.organizationId,
1617
1613
  timestampMs: timestampMs ?? String(Date.now()),
1618
1614
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
@@ -1633,11 +1629,11 @@ class TurnkeySDKClientBase {
1633
1629
  };
1634
1630
  this.signTransaction = async (input) => {
1635
1631
  const { organizationId, timestampMs, ...rest } = input;
1636
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1632
+ const session = await getStorageValue(StorageKeys.Session);
1637
1633
  return this.command("/public/v1/submit/sign_transaction", {
1638
1634
  parameters: rest,
1639
1635
  organizationId: organizationId ??
1640
- currentUser?.organization?.organizationId ??
1636
+ session?.organizationId ??
1641
1637
  this.config.organizationId,
1642
1638
  timestampMs: timestampMs ?? String(Date.now()),
1643
1639
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
@@ -1658,11 +1654,11 @@ class TurnkeySDKClientBase {
1658
1654
  };
1659
1655
  this.updatePolicy = async (input) => {
1660
1656
  const { organizationId, timestampMs, ...rest } = input;
1661
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1657
+ const session = await getStorageValue(StorageKeys.Session);
1662
1658
  return this.command("/public/v1/submit/update_policy", {
1663
1659
  parameters: rest,
1664
1660
  organizationId: organizationId ??
1665
- currentUser?.organization?.organizationId ??
1661
+ session?.organizationId ??
1666
1662
  this.config.organizationId,
1667
1663
  timestampMs: timestampMs ?? String(Date.now()),
1668
1664
  type: "ACTIVITY_TYPE_UPDATE_POLICY",
@@ -1683,11 +1679,11 @@ class TurnkeySDKClientBase {
1683
1679
  };
1684
1680
  this.updatePrivateKeyTag = async (input) => {
1685
1681
  const { organizationId, timestampMs, ...rest } = input;
1686
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1682
+ const session = await getStorageValue(StorageKeys.Session);
1687
1683
  return this.command("/public/v1/submit/update_private_key_tag", {
1688
1684
  parameters: rest,
1689
1685
  organizationId: organizationId ??
1690
- currentUser?.organization?.organizationId ??
1686
+ session?.organizationId ??
1691
1687
  this.config.organizationId,
1692
1688
  timestampMs: timestampMs ?? String(Date.now()),
1693
1689
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
@@ -1708,11 +1704,11 @@ class TurnkeySDKClientBase {
1708
1704
  };
1709
1705
  this.updateRootQuorum = async (input) => {
1710
1706
  const { organizationId, timestampMs, ...rest } = input;
1711
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1707
+ const session = await getStorageValue(StorageKeys.Session);
1712
1708
  return this.command("/public/v1/submit/update_root_quorum", {
1713
1709
  parameters: rest,
1714
1710
  organizationId: organizationId ??
1715
- currentUser?.organization?.organizationId ??
1711
+ session?.organizationId ??
1716
1712
  this.config.organizationId,
1717
1713
  timestampMs: timestampMs ?? String(Date.now()),
1718
1714
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
@@ -1733,11 +1729,11 @@ class TurnkeySDKClientBase {
1733
1729
  };
1734
1730
  this.updateUser = async (input) => {
1735
1731
  const { organizationId, timestampMs, ...rest } = input;
1736
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1732
+ const session = await getStorageValue(StorageKeys.Session);
1737
1733
  return this.command("/public/v1/submit/update_user", {
1738
1734
  parameters: rest,
1739
1735
  organizationId: organizationId ??
1740
- currentUser?.organization?.organizationId ??
1736
+ session?.organizationId ??
1741
1737
  this.config.organizationId,
1742
1738
  timestampMs: timestampMs ?? String(Date.now()),
1743
1739
  type: "ACTIVITY_TYPE_UPDATE_USER",
@@ -1758,11 +1754,11 @@ class TurnkeySDKClientBase {
1758
1754
  };
1759
1755
  this.updateUserTag = async (input) => {
1760
1756
  const { organizationId, timestampMs, ...rest } = input;
1761
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1757
+ const session = await getStorageValue(StorageKeys.Session);
1762
1758
  return this.command("/public/v1/submit/update_user_tag", {
1763
1759
  parameters: rest,
1764
1760
  organizationId: organizationId ??
1765
- currentUser?.organization?.organizationId ??
1761
+ session?.organizationId ??
1766
1762
  this.config.organizationId,
1767
1763
  timestampMs: timestampMs ?? String(Date.now()),
1768
1764
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
@@ -1783,11 +1779,11 @@ class TurnkeySDKClientBase {
1783
1779
  };
1784
1780
  this.updateWallet = async (input) => {
1785
1781
  const { organizationId, timestampMs, ...rest } = input;
1786
- const currentUser = await getStorageValue(StorageKeys.UserSession);
1782
+ const session = await getStorageValue(StorageKeys.Session);
1787
1783
  return this.command("/public/v1/submit/update_wallet", {
1788
1784
  parameters: rest,
1789
1785
  organizationId: organizationId ??
1790
- currentUser?.organization?.organizationId ??
1786
+ session?.organizationId ??
1791
1787
  this.config.organizationId,
1792
1788
  timestampMs: timestampMs ?? String(Date.now()),
1793
1789
  type: "ACTIVITY_TYPE_UPDATE_WALLET",