@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
@@ -485,12 +485,10 @@ class TurnkeySDKClientBase {
485
485
  };
486
486
  this.approveActivity = async (input) => {
487
487
  const { organizationId, timestampMs, ...rest } = input;
488
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
488
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
489
489
  return this.activityDecision("/public/v1/submit/approve_activity", {
490
490
  parameters: rest,
491
- organizationId: organizationId ??
492
- currentUser?.organization?.organizationId ??
493
- this.config.organizationId,
491
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
494
492
  timestampMs: timestampMs ?? String(Date.now()),
495
493
  type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
496
494
  });
@@ -510,11 +508,11 @@ class TurnkeySDKClientBase {
510
508
  };
511
509
  this.createApiKeys = async (input) => {
512
510
  const { organizationId, timestampMs, ...rest } = input;
513
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
511
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
514
512
  return this.command("/public/v1/submit/create_api_keys", {
515
513
  parameters: rest,
516
514
  organizationId: organizationId ??
517
- currentUser?.organization?.organizationId ??
515
+ session?.organizationId ??
518
516
  this.config.organizationId,
519
517
  timestampMs: timestampMs ?? String(Date.now()),
520
518
  type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
@@ -535,11 +533,11 @@ class TurnkeySDKClientBase {
535
533
  };
536
534
  this.createApiOnlyUsers = async (input) => {
537
535
  const { organizationId, timestampMs, ...rest } = input;
538
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
536
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
539
537
  return this.command("/public/v1/submit/create_api_only_users", {
540
538
  parameters: rest,
541
539
  organizationId: organizationId ??
542
- currentUser?.organization?.organizationId ??
540
+ session?.organizationId ??
543
541
  this.config.organizationId,
544
542
  timestampMs: timestampMs ?? String(Date.now()),
545
543
  type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
@@ -560,11 +558,11 @@ class TurnkeySDKClientBase {
560
558
  };
561
559
  this.createAuthenticators = async (input) => {
562
560
  const { organizationId, timestampMs, ...rest } = input;
563
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
561
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
564
562
  return this.command("/public/v1/submit/create_authenticators", {
565
563
  parameters: rest,
566
564
  organizationId: organizationId ??
567
- currentUser?.organization?.organizationId ??
565
+ session?.organizationId ??
568
566
  this.config.organizationId,
569
567
  timestampMs: timestampMs ?? String(Date.now()),
570
568
  type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
@@ -585,11 +583,11 @@ class TurnkeySDKClientBase {
585
583
  };
586
584
  this.createInvitations = async (input) => {
587
585
  const { organizationId, timestampMs, ...rest } = input;
588
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
586
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
589
587
  return this.command("/public/v1/submit/create_invitations", {
590
588
  parameters: rest,
591
589
  organizationId: organizationId ??
592
- currentUser?.organization?.organizationId ??
590
+ session?.organizationId ??
593
591
  this.config.organizationId,
594
592
  timestampMs: timestampMs ?? String(Date.now()),
595
593
  type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
@@ -610,11 +608,11 @@ class TurnkeySDKClientBase {
610
608
  };
611
609
  this.createOauthProviders = async (input) => {
612
610
  const { organizationId, timestampMs, ...rest } = input;
613
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
611
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
614
612
  return this.command("/public/v1/submit/create_oauth_providers", {
615
613
  parameters: rest,
616
614
  organizationId: organizationId ??
617
- currentUser?.organization?.organizationId ??
615
+ session?.organizationId ??
618
616
  this.config.organizationId,
619
617
  timestampMs: timestampMs ?? String(Date.now()),
620
618
  type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
@@ -635,11 +633,11 @@ class TurnkeySDKClientBase {
635
633
  };
636
634
  this.createPolicies = async (input) => {
637
635
  const { organizationId, timestampMs, ...rest } = input;
638
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
636
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
639
637
  return this.command("/public/v1/submit/create_policies", {
640
638
  parameters: rest,
641
639
  organizationId: organizationId ??
642
- currentUser?.organization?.organizationId ??
640
+ session?.organizationId ??
643
641
  this.config.organizationId,
644
642
  timestampMs: timestampMs ?? String(Date.now()),
645
643
  type: "ACTIVITY_TYPE_CREATE_POLICIES",
@@ -660,11 +658,11 @@ class TurnkeySDKClientBase {
660
658
  };
661
659
  this.createPolicy = async (input) => {
662
660
  const { organizationId, timestampMs, ...rest } = input;
663
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
661
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
664
662
  return this.command("/public/v1/submit/create_policy", {
665
663
  parameters: rest,
666
664
  organizationId: organizationId ??
667
- currentUser?.organization?.organizationId ??
665
+ session?.organizationId ??
668
666
  this.config.organizationId,
669
667
  timestampMs: timestampMs ?? String(Date.now()),
670
668
  type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
@@ -685,11 +683,11 @@ class TurnkeySDKClientBase {
685
683
  };
686
684
  this.createPrivateKeyTag = async (input) => {
687
685
  const { organizationId, timestampMs, ...rest } = input;
688
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
686
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
689
687
  return this.command("/public/v1/submit/create_private_key_tag", {
690
688
  parameters: rest,
691
689
  organizationId: organizationId ??
692
- currentUser?.organization?.organizationId ??
690
+ session?.organizationId ??
693
691
  this.config.organizationId,
694
692
  timestampMs: timestampMs ?? String(Date.now()),
695
693
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
@@ -710,11 +708,11 @@ class TurnkeySDKClientBase {
710
708
  };
711
709
  this.createPrivateKeys = async (input) => {
712
710
  const { organizationId, timestampMs, ...rest } = input;
713
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
711
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
714
712
  return this.command("/public/v1/submit/create_private_keys", {
715
713
  parameters: rest,
716
714
  organizationId: organizationId ??
717
- currentUser?.organization?.organizationId ??
715
+ session?.organizationId ??
718
716
  this.config.organizationId,
719
717
  timestampMs: timestampMs ?? String(Date.now()),
720
718
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
@@ -735,11 +733,11 @@ class TurnkeySDKClientBase {
735
733
  };
736
734
  this.createReadOnlySession = async (input) => {
737
735
  const { organizationId, timestampMs, ...rest } = input;
738
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
736
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
739
737
  return this.command("/public/v1/submit/create_read_only_session", {
740
738
  parameters: rest,
741
739
  organizationId: organizationId ??
742
- currentUser?.organization?.organizationId ??
740
+ session?.organizationId ??
743
741
  this.config.organizationId,
744
742
  timestampMs: timestampMs ?? String(Date.now()),
745
743
  type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
@@ -760,11 +758,11 @@ class TurnkeySDKClientBase {
760
758
  };
761
759
  this.createReadWriteSession = async (input) => {
762
760
  const { organizationId, timestampMs, ...rest } = input;
763
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
761
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
764
762
  return this.command("/public/v1/submit/create_read_write_session", {
765
763
  parameters: rest,
766
764
  organizationId: organizationId ??
767
- currentUser?.organization?.organizationId ??
765
+ session?.organizationId ??
768
766
  this.config.organizationId,
769
767
  timestampMs: timestampMs ?? String(Date.now()),
770
768
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
@@ -785,11 +783,11 @@ class TurnkeySDKClientBase {
785
783
  };
786
784
  this.createSubOrganization = async (input) => {
787
785
  const { organizationId, timestampMs, ...rest } = input;
788
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
786
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
789
787
  return this.command("/public/v1/submit/create_sub_organization", {
790
788
  parameters: rest,
791
789
  organizationId: organizationId ??
792
- currentUser?.organization?.organizationId ??
790
+ session?.organizationId ??
793
791
  this.config.organizationId,
794
792
  timestampMs: timestampMs ?? String(Date.now()),
795
793
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
@@ -810,11 +808,11 @@ class TurnkeySDKClientBase {
810
808
  };
811
809
  this.createUserTag = async (input) => {
812
810
  const { organizationId, timestampMs, ...rest } = input;
813
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
811
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
814
812
  return this.command("/public/v1/submit/create_user_tag", {
815
813
  parameters: rest,
816
814
  organizationId: organizationId ??
817
- currentUser?.organization?.organizationId ??
815
+ session?.organizationId ??
818
816
  this.config.organizationId,
819
817
  timestampMs: timestampMs ?? String(Date.now()),
820
818
  type: "ACTIVITY_TYPE_CREATE_USER_TAG",
@@ -835,11 +833,11 @@ class TurnkeySDKClientBase {
835
833
  };
836
834
  this.createUsers = async (input) => {
837
835
  const { organizationId, timestampMs, ...rest } = input;
838
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
836
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
839
837
  return this.command("/public/v1/submit/create_users", {
840
838
  parameters: rest,
841
839
  organizationId: organizationId ??
842
- currentUser?.organization?.organizationId ??
840
+ session?.organizationId ??
843
841
  this.config.organizationId,
844
842
  timestampMs: timestampMs ?? String(Date.now()),
845
843
  type: "ACTIVITY_TYPE_CREATE_USERS_V2",
@@ -860,11 +858,11 @@ class TurnkeySDKClientBase {
860
858
  };
861
859
  this.createWallet = async (input) => {
862
860
  const { organizationId, timestampMs, ...rest } = input;
863
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
861
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
864
862
  return this.command("/public/v1/submit/create_wallet", {
865
863
  parameters: rest,
866
864
  organizationId: organizationId ??
867
- currentUser?.organization?.organizationId ??
865
+ session?.organizationId ??
868
866
  this.config.organizationId,
869
867
  timestampMs: timestampMs ?? String(Date.now()),
870
868
  type: "ACTIVITY_TYPE_CREATE_WALLET",
@@ -885,11 +883,11 @@ class TurnkeySDKClientBase {
885
883
  };
886
884
  this.createWalletAccounts = async (input) => {
887
885
  const { organizationId, timestampMs, ...rest } = input;
888
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
886
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
889
887
  return this.command("/public/v1/submit/create_wallet_accounts", {
890
888
  parameters: rest,
891
889
  organizationId: organizationId ??
892
- currentUser?.organization?.organizationId ??
890
+ session?.organizationId ??
893
891
  this.config.organizationId,
894
892
  timestampMs: timestampMs ?? String(Date.now()),
895
893
  type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
@@ -910,11 +908,11 @@ class TurnkeySDKClientBase {
910
908
  };
911
909
  this.deleteApiKeys = async (input) => {
912
910
  const { organizationId, timestampMs, ...rest } = input;
913
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
911
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
914
912
  return this.command("/public/v1/submit/delete_api_keys", {
915
913
  parameters: rest,
916
914
  organizationId: organizationId ??
917
- currentUser?.organization?.organizationId ??
915
+ session?.organizationId ??
918
916
  this.config.organizationId,
919
917
  timestampMs: timestampMs ?? String(Date.now()),
920
918
  type: "ACTIVITY_TYPE_DELETE_API_KEYS",
@@ -935,11 +933,11 @@ class TurnkeySDKClientBase {
935
933
  };
936
934
  this.deleteAuthenticators = async (input) => {
937
935
  const { organizationId, timestampMs, ...rest } = input;
938
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
936
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
939
937
  return this.command("/public/v1/submit/delete_authenticators", {
940
938
  parameters: rest,
941
939
  organizationId: organizationId ??
942
- currentUser?.organization?.organizationId ??
940
+ session?.organizationId ??
943
941
  this.config.organizationId,
944
942
  timestampMs: timestampMs ?? String(Date.now()),
945
943
  type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
@@ -960,11 +958,11 @@ class TurnkeySDKClientBase {
960
958
  };
961
959
  this.deleteInvitation = async (input) => {
962
960
  const { organizationId, timestampMs, ...rest } = input;
963
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
961
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
964
962
  return this.command("/public/v1/submit/delete_invitation", {
965
963
  parameters: rest,
966
964
  organizationId: organizationId ??
967
- currentUser?.organization?.organizationId ??
965
+ session?.organizationId ??
968
966
  this.config.organizationId,
969
967
  timestampMs: timestampMs ?? String(Date.now()),
970
968
  type: "ACTIVITY_TYPE_DELETE_INVITATION",
@@ -985,11 +983,11 @@ class TurnkeySDKClientBase {
985
983
  };
986
984
  this.deleteOauthProviders = async (input) => {
987
985
  const { organizationId, timestampMs, ...rest } = input;
988
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
986
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
989
987
  return this.command("/public/v1/submit/delete_oauth_providers", {
990
988
  parameters: rest,
991
989
  organizationId: organizationId ??
992
- currentUser?.organization?.organizationId ??
990
+ session?.organizationId ??
993
991
  this.config.organizationId,
994
992
  timestampMs: timestampMs ?? String(Date.now()),
995
993
  type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
@@ -1010,11 +1008,11 @@ class TurnkeySDKClientBase {
1010
1008
  };
1011
1009
  this.deletePolicy = async (input) => {
1012
1010
  const { organizationId, timestampMs, ...rest } = input;
1013
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1011
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1014
1012
  return this.command("/public/v1/submit/delete_policy", {
1015
1013
  parameters: rest,
1016
1014
  organizationId: organizationId ??
1017
- currentUser?.organization?.organizationId ??
1015
+ session?.organizationId ??
1018
1016
  this.config.organizationId,
1019
1017
  timestampMs: timestampMs ?? String(Date.now()),
1020
1018
  type: "ACTIVITY_TYPE_DELETE_POLICY",
@@ -1035,11 +1033,11 @@ class TurnkeySDKClientBase {
1035
1033
  };
1036
1034
  this.deletePrivateKeyTags = async (input) => {
1037
1035
  const { organizationId, timestampMs, ...rest } = input;
1038
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1036
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1039
1037
  return this.command("/public/v1/submit/delete_private_key_tags", {
1040
1038
  parameters: rest,
1041
1039
  organizationId: organizationId ??
1042
- currentUser?.organization?.organizationId ??
1040
+ session?.organizationId ??
1043
1041
  this.config.organizationId,
1044
1042
  timestampMs: timestampMs ?? String(Date.now()),
1045
1043
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
@@ -1060,11 +1058,11 @@ class TurnkeySDKClientBase {
1060
1058
  };
1061
1059
  this.deletePrivateKeys = async (input) => {
1062
1060
  const { organizationId, timestampMs, ...rest } = input;
1063
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1061
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1064
1062
  return this.command("/public/v1/submit/delete_private_keys", {
1065
1063
  parameters: rest,
1066
1064
  organizationId: organizationId ??
1067
- currentUser?.organization?.organizationId ??
1065
+ session?.organizationId ??
1068
1066
  this.config.organizationId,
1069
1067
  timestampMs: timestampMs ?? String(Date.now()),
1070
1068
  type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
@@ -1085,11 +1083,11 @@ class TurnkeySDKClientBase {
1085
1083
  };
1086
1084
  this.deleteSubOrganization = async (input) => {
1087
1085
  const { organizationId, timestampMs, ...rest } = input;
1088
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1086
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1089
1087
  return this.command("/public/v1/submit/delete_sub_organization", {
1090
1088
  parameters: rest,
1091
1089
  organizationId: organizationId ??
1092
- currentUser?.organization?.organizationId ??
1090
+ session?.organizationId ??
1093
1091
  this.config.organizationId,
1094
1092
  timestampMs: timestampMs ?? String(Date.now()),
1095
1093
  type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
@@ -1110,11 +1108,11 @@ class TurnkeySDKClientBase {
1110
1108
  };
1111
1109
  this.deleteUserTags = async (input) => {
1112
1110
  const { organizationId, timestampMs, ...rest } = input;
1113
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1111
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1114
1112
  return this.command("/public/v1/submit/delete_user_tags", {
1115
1113
  parameters: rest,
1116
1114
  organizationId: organizationId ??
1117
- currentUser?.organization?.organizationId ??
1115
+ session?.organizationId ??
1118
1116
  this.config.organizationId,
1119
1117
  timestampMs: timestampMs ?? String(Date.now()),
1120
1118
  type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
@@ -1135,11 +1133,11 @@ class TurnkeySDKClientBase {
1135
1133
  };
1136
1134
  this.deleteUsers = async (input) => {
1137
1135
  const { organizationId, timestampMs, ...rest } = input;
1138
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1136
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1139
1137
  return this.command("/public/v1/submit/delete_users", {
1140
1138
  parameters: rest,
1141
1139
  organizationId: organizationId ??
1142
- currentUser?.organization?.organizationId ??
1140
+ session?.organizationId ??
1143
1141
  this.config.organizationId,
1144
1142
  timestampMs: timestampMs ?? String(Date.now()),
1145
1143
  type: "ACTIVITY_TYPE_DELETE_USERS",
@@ -1160,11 +1158,11 @@ class TurnkeySDKClientBase {
1160
1158
  };
1161
1159
  this.deleteWallets = async (input) => {
1162
1160
  const { organizationId, timestampMs, ...rest } = input;
1163
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1161
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1164
1162
  return this.command("/public/v1/submit/delete_wallets", {
1165
1163
  parameters: rest,
1166
1164
  organizationId: organizationId ??
1167
- currentUser?.organization?.organizationId ??
1165
+ session?.organizationId ??
1168
1166
  this.config.organizationId,
1169
1167
  timestampMs: timestampMs ?? String(Date.now()),
1170
1168
  type: "ACTIVITY_TYPE_DELETE_WALLETS",
@@ -1185,11 +1183,11 @@ class TurnkeySDKClientBase {
1185
1183
  };
1186
1184
  this.emailAuth = async (input) => {
1187
1185
  const { organizationId, timestampMs, ...rest } = input;
1188
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1186
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1189
1187
  return this.command("/public/v1/submit/email_auth", {
1190
1188
  parameters: rest,
1191
1189
  organizationId: organizationId ??
1192
- currentUser?.organization?.organizationId ??
1190
+ session?.organizationId ??
1193
1191
  this.config.organizationId,
1194
1192
  timestampMs: timestampMs ?? String(Date.now()),
1195
1193
  type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
@@ -1210,11 +1208,11 @@ class TurnkeySDKClientBase {
1210
1208
  };
1211
1209
  this.exportPrivateKey = async (input) => {
1212
1210
  const { organizationId, timestampMs, ...rest } = input;
1213
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1211
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1214
1212
  return this.command("/public/v1/submit/export_private_key", {
1215
1213
  parameters: rest,
1216
1214
  organizationId: organizationId ??
1217
- currentUser?.organization?.organizationId ??
1215
+ session?.organizationId ??
1218
1216
  this.config.organizationId,
1219
1217
  timestampMs: timestampMs ?? String(Date.now()),
1220
1218
  type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
@@ -1235,11 +1233,11 @@ class TurnkeySDKClientBase {
1235
1233
  };
1236
1234
  this.exportWallet = async (input) => {
1237
1235
  const { organizationId, timestampMs, ...rest } = input;
1238
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1236
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1239
1237
  return this.command("/public/v1/submit/export_wallet", {
1240
1238
  parameters: rest,
1241
1239
  organizationId: organizationId ??
1242
- currentUser?.organization?.organizationId ??
1240
+ session?.organizationId ??
1243
1241
  this.config.organizationId,
1244
1242
  timestampMs: timestampMs ?? String(Date.now()),
1245
1243
  type: "ACTIVITY_TYPE_EXPORT_WALLET",
@@ -1260,11 +1258,11 @@ class TurnkeySDKClientBase {
1260
1258
  };
1261
1259
  this.exportWalletAccount = async (input) => {
1262
1260
  const { organizationId, timestampMs, ...rest } = input;
1263
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1261
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1264
1262
  return this.command("/public/v1/submit/export_wallet_account", {
1265
1263
  parameters: rest,
1266
1264
  organizationId: organizationId ??
1267
- currentUser?.organization?.organizationId ??
1265
+ session?.organizationId ??
1268
1266
  this.config.organizationId,
1269
1267
  timestampMs: timestampMs ?? String(Date.now()),
1270
1268
  type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
@@ -1285,11 +1283,11 @@ class TurnkeySDKClientBase {
1285
1283
  };
1286
1284
  this.importPrivateKey = async (input) => {
1287
1285
  const { organizationId, timestampMs, ...rest } = input;
1288
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1286
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1289
1287
  return this.command("/public/v1/submit/import_private_key", {
1290
1288
  parameters: rest,
1291
1289
  organizationId: organizationId ??
1292
- currentUser?.organization?.organizationId ??
1290
+ session?.organizationId ??
1293
1291
  this.config.organizationId,
1294
1292
  timestampMs: timestampMs ?? String(Date.now()),
1295
1293
  type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
@@ -1310,11 +1308,11 @@ class TurnkeySDKClientBase {
1310
1308
  };
1311
1309
  this.importWallet = async (input) => {
1312
1310
  const { organizationId, timestampMs, ...rest } = input;
1313
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1311
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1314
1312
  return this.command("/public/v1/submit/import_wallet", {
1315
1313
  parameters: rest,
1316
1314
  organizationId: organizationId ??
1317
- currentUser?.organization?.organizationId ??
1315
+ session?.organizationId ??
1318
1316
  this.config.organizationId,
1319
1317
  timestampMs: timestampMs ?? String(Date.now()),
1320
1318
  type: "ACTIVITY_TYPE_IMPORT_WALLET",
@@ -1335,11 +1333,11 @@ class TurnkeySDKClientBase {
1335
1333
  };
1336
1334
  this.initImportPrivateKey = async (input) => {
1337
1335
  const { organizationId, timestampMs, ...rest } = input;
1338
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1336
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1339
1337
  return this.command("/public/v1/submit/init_import_private_key", {
1340
1338
  parameters: rest,
1341
1339
  organizationId: organizationId ??
1342
- currentUser?.organization?.organizationId ??
1340
+ session?.organizationId ??
1343
1341
  this.config.organizationId,
1344
1342
  timestampMs: timestampMs ?? String(Date.now()),
1345
1343
  type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
@@ -1360,11 +1358,11 @@ class TurnkeySDKClientBase {
1360
1358
  };
1361
1359
  this.initImportWallet = async (input) => {
1362
1360
  const { organizationId, timestampMs, ...rest } = input;
1363
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1361
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1364
1362
  return this.command("/public/v1/submit/init_import_wallet", {
1365
1363
  parameters: rest,
1366
1364
  organizationId: organizationId ??
1367
- currentUser?.organization?.organizationId ??
1365
+ session?.organizationId ??
1368
1366
  this.config.organizationId,
1369
1367
  timestampMs: timestampMs ?? String(Date.now()),
1370
1368
  type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
@@ -1385,11 +1383,11 @@ class TurnkeySDKClientBase {
1385
1383
  };
1386
1384
  this.initOtpAuth = async (input) => {
1387
1385
  const { organizationId, timestampMs, ...rest } = input;
1388
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1386
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1389
1387
  return this.command("/public/v1/submit/init_otp_auth", {
1390
1388
  parameters: rest,
1391
1389
  organizationId: organizationId ??
1392
- currentUser?.organization?.organizationId ??
1390
+ session?.organizationId ??
1393
1391
  this.config.organizationId,
1394
1392
  timestampMs: timestampMs ?? String(Date.now()),
1395
1393
  type: "ACTIVITY_TYPE_INIT_OTP_AUTH",
@@ -1410,11 +1408,11 @@ class TurnkeySDKClientBase {
1410
1408
  };
1411
1409
  this.initUserEmailRecovery = async (input) => {
1412
1410
  const { organizationId, timestampMs, ...rest } = input;
1413
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1411
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1414
1412
  return this.command("/public/v1/submit/init_user_email_recovery", {
1415
1413
  parameters: rest,
1416
1414
  organizationId: organizationId ??
1417
- currentUser?.organization?.organizationId ??
1415
+ session?.organizationId ??
1418
1416
  this.config.organizationId,
1419
1417
  timestampMs: timestampMs ?? String(Date.now()),
1420
1418
  type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
@@ -1435,11 +1433,11 @@ class TurnkeySDKClientBase {
1435
1433
  };
1436
1434
  this.oauth = async (input) => {
1437
1435
  const { organizationId, timestampMs, ...rest } = input;
1438
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1436
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1439
1437
  return this.command("/public/v1/submit/oauth", {
1440
1438
  parameters: rest,
1441
1439
  organizationId: organizationId ??
1442
- currentUser?.organization?.organizationId ??
1440
+ session?.organizationId ??
1443
1441
  this.config.organizationId,
1444
1442
  timestampMs: timestampMs ?? String(Date.now()),
1445
1443
  type: "ACTIVITY_TYPE_OAUTH",
@@ -1460,11 +1458,11 @@ class TurnkeySDKClientBase {
1460
1458
  };
1461
1459
  this.otpAuth = async (input) => {
1462
1460
  const { organizationId, timestampMs, ...rest } = input;
1463
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1461
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1464
1462
  return this.command("/public/v1/submit/otp_auth", {
1465
1463
  parameters: rest,
1466
1464
  organizationId: organizationId ??
1467
- currentUser?.organization?.organizationId ??
1465
+ session?.organizationId ??
1468
1466
  this.config.organizationId,
1469
1467
  timestampMs: timestampMs ?? String(Date.now()),
1470
1468
  type: "ACTIVITY_TYPE_OTP_AUTH",
@@ -1485,11 +1483,11 @@ class TurnkeySDKClientBase {
1485
1483
  };
1486
1484
  this.recoverUser = async (input) => {
1487
1485
  const { organizationId, timestampMs, ...rest } = input;
1488
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1486
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1489
1487
  return this.command("/public/v1/submit/recover_user", {
1490
1488
  parameters: rest,
1491
1489
  organizationId: organizationId ??
1492
- currentUser?.organization?.organizationId ??
1490
+ session?.organizationId ??
1493
1491
  this.config.organizationId,
1494
1492
  timestampMs: timestampMs ?? String(Date.now()),
1495
1493
  type: "ACTIVITY_TYPE_RECOVER_USER",
@@ -1510,12 +1508,10 @@ class TurnkeySDKClientBase {
1510
1508
  };
1511
1509
  this.rejectActivity = async (input) => {
1512
1510
  const { organizationId, timestampMs, ...rest } = input;
1513
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1511
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1514
1512
  return this.activityDecision("/public/v1/submit/reject_activity", {
1515
1513
  parameters: rest,
1516
- organizationId: organizationId ??
1517
- currentUser?.organization?.organizationId ??
1518
- this.config.organizationId,
1514
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1519
1515
  timestampMs: timestampMs ?? String(Date.now()),
1520
1516
  type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
1521
1517
  });
@@ -1535,11 +1531,11 @@ class TurnkeySDKClientBase {
1535
1531
  };
1536
1532
  this.removeOrganizationFeature = async (input) => {
1537
1533
  const { organizationId, timestampMs, ...rest } = input;
1538
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1534
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1539
1535
  return this.command("/public/v1/submit/remove_organization_feature", {
1540
1536
  parameters: rest,
1541
1537
  organizationId: organizationId ??
1542
- currentUser?.organization?.organizationId ??
1538
+ session?.organizationId ??
1543
1539
  this.config.organizationId,
1544
1540
  timestampMs: timestampMs ?? String(Date.now()),
1545
1541
  type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
@@ -1560,11 +1556,11 @@ class TurnkeySDKClientBase {
1560
1556
  };
1561
1557
  this.setOrganizationFeature = async (input) => {
1562
1558
  const { organizationId, timestampMs, ...rest } = input;
1563
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1559
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1564
1560
  return this.command("/public/v1/submit/set_organization_feature", {
1565
1561
  parameters: rest,
1566
1562
  organizationId: organizationId ??
1567
- currentUser?.organization?.organizationId ??
1563
+ session?.organizationId ??
1568
1564
  this.config.organizationId,
1569
1565
  timestampMs: timestampMs ?? String(Date.now()),
1570
1566
  type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
@@ -1585,11 +1581,11 @@ class TurnkeySDKClientBase {
1585
1581
  };
1586
1582
  this.signRawPayload = async (input) => {
1587
1583
  const { organizationId, timestampMs, ...rest } = input;
1588
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1584
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1589
1585
  return this.command("/public/v1/submit/sign_raw_payload", {
1590
1586
  parameters: rest,
1591
1587
  organizationId: organizationId ??
1592
- currentUser?.organization?.organizationId ??
1588
+ session?.organizationId ??
1593
1589
  this.config.organizationId,
1594
1590
  timestampMs: timestampMs ?? String(Date.now()),
1595
1591
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
@@ -1610,11 +1606,11 @@ class TurnkeySDKClientBase {
1610
1606
  };
1611
1607
  this.signRawPayloads = async (input) => {
1612
1608
  const { organizationId, timestampMs, ...rest } = input;
1613
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1609
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1614
1610
  return this.command("/public/v1/submit/sign_raw_payloads", {
1615
1611
  parameters: rest,
1616
1612
  organizationId: organizationId ??
1617
- currentUser?.organization?.organizationId ??
1613
+ session?.organizationId ??
1618
1614
  this.config.organizationId,
1619
1615
  timestampMs: timestampMs ?? String(Date.now()),
1620
1616
  type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
@@ -1635,11 +1631,11 @@ class TurnkeySDKClientBase {
1635
1631
  };
1636
1632
  this.signTransaction = async (input) => {
1637
1633
  const { organizationId, timestampMs, ...rest } = input;
1638
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1634
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1639
1635
  return this.command("/public/v1/submit/sign_transaction", {
1640
1636
  parameters: rest,
1641
1637
  organizationId: organizationId ??
1642
- currentUser?.organization?.organizationId ??
1638
+ session?.organizationId ??
1643
1639
  this.config.organizationId,
1644
1640
  timestampMs: timestampMs ?? String(Date.now()),
1645
1641
  type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
@@ -1660,11 +1656,11 @@ class TurnkeySDKClientBase {
1660
1656
  };
1661
1657
  this.updatePolicy = async (input) => {
1662
1658
  const { organizationId, timestampMs, ...rest } = input;
1663
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1659
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1664
1660
  return this.command("/public/v1/submit/update_policy", {
1665
1661
  parameters: rest,
1666
1662
  organizationId: organizationId ??
1667
- currentUser?.organization?.organizationId ??
1663
+ session?.organizationId ??
1668
1664
  this.config.organizationId,
1669
1665
  timestampMs: timestampMs ?? String(Date.now()),
1670
1666
  type: "ACTIVITY_TYPE_UPDATE_POLICY",
@@ -1685,11 +1681,11 @@ class TurnkeySDKClientBase {
1685
1681
  };
1686
1682
  this.updatePrivateKeyTag = async (input) => {
1687
1683
  const { organizationId, timestampMs, ...rest } = input;
1688
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1684
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1689
1685
  return this.command("/public/v1/submit/update_private_key_tag", {
1690
1686
  parameters: rest,
1691
1687
  organizationId: organizationId ??
1692
- currentUser?.organization?.organizationId ??
1688
+ session?.organizationId ??
1693
1689
  this.config.organizationId,
1694
1690
  timestampMs: timestampMs ?? String(Date.now()),
1695
1691
  type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
@@ -1710,11 +1706,11 @@ class TurnkeySDKClientBase {
1710
1706
  };
1711
1707
  this.updateRootQuorum = async (input) => {
1712
1708
  const { organizationId, timestampMs, ...rest } = input;
1713
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1709
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1714
1710
  return this.command("/public/v1/submit/update_root_quorum", {
1715
1711
  parameters: rest,
1716
1712
  organizationId: organizationId ??
1717
- currentUser?.organization?.organizationId ??
1713
+ session?.organizationId ??
1718
1714
  this.config.organizationId,
1719
1715
  timestampMs: timestampMs ?? String(Date.now()),
1720
1716
  type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
@@ -1735,11 +1731,11 @@ class TurnkeySDKClientBase {
1735
1731
  };
1736
1732
  this.updateUser = async (input) => {
1737
1733
  const { organizationId, timestampMs, ...rest } = input;
1738
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1734
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1739
1735
  return this.command("/public/v1/submit/update_user", {
1740
1736
  parameters: rest,
1741
1737
  organizationId: organizationId ??
1742
- currentUser?.organization?.organizationId ??
1738
+ session?.organizationId ??
1743
1739
  this.config.organizationId,
1744
1740
  timestampMs: timestampMs ?? String(Date.now()),
1745
1741
  type: "ACTIVITY_TYPE_UPDATE_USER",
@@ -1760,11 +1756,11 @@ class TurnkeySDKClientBase {
1760
1756
  };
1761
1757
  this.updateUserTag = async (input) => {
1762
1758
  const { organizationId, timestampMs, ...rest } = input;
1763
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1759
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1764
1760
  return this.command("/public/v1/submit/update_user_tag", {
1765
1761
  parameters: rest,
1766
1762
  organizationId: organizationId ??
1767
- currentUser?.organization?.organizationId ??
1763
+ session?.organizationId ??
1768
1764
  this.config.organizationId,
1769
1765
  timestampMs: timestampMs ?? String(Date.now()),
1770
1766
  type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
@@ -1785,11 +1781,11 @@ class TurnkeySDKClientBase {
1785
1781
  };
1786
1782
  this.updateWallet = async (input) => {
1787
1783
  const { organizationId, timestampMs, ...rest } = input;
1788
- const currentUser = await storage.getStorageValue(storage.StorageKeys.UserSession);
1784
+ const session = await storage.getStorageValue(storage.StorageKeys.Session);
1789
1785
  return this.command("/public/v1/submit/update_wallet", {
1790
1786
  parameters: rest,
1791
1787
  organizationId: organizationId ??
1792
- currentUser?.organization?.organizationId ??
1788
+ session?.organizationId ??
1793
1789
  this.config.organizationId,
1794
1790
  timestampMs: timestampMs ?? String(Date.now()),
1795
1791
  type: "ACTIVITY_TYPE_UPDATE_WALLET",