@turnkey/sdk-browser 4.2.0 → 5.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 (53) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +46 -0
  3. package/dist/__clients__/browser-clients.d.ts +32 -43
  4. package/dist/__clients__/browser-clients.d.ts.map +1 -1
  5. package/dist/__clients__/browser-clients.js +65 -182
  6. package/dist/__clients__/browser-clients.js.map +1 -1
  7. package/dist/__clients__/browser-clients.mjs +67 -185
  8. package/dist/__clients__/browser-clients.mjs.map +1 -1
  9. package/dist/__generated__/sdk-client-base.d.ts +10 -0
  10. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  11. package/dist/__generated__/sdk-client-base.js +367 -79
  12. package/dist/__generated__/sdk-client-base.js.map +1 -1
  13. package/dist/__generated__/sdk-client-base.mjs +367 -79
  14. package/dist/__generated__/sdk-client-base.mjs.map +1 -1
  15. package/dist/__generated__/sdk_api_types.d.ts +25 -0
  16. package/dist/__generated__/sdk_api_types.d.ts.map +1 -1
  17. package/dist/__generated__/version.d.ts +1 -1
  18. package/dist/__generated__/version.js +1 -1
  19. package/dist/__generated__/version.mjs +1 -1
  20. package/dist/__inputs__/public_api.types.d.ts +265 -9
  21. package/dist/__inputs__/public_api.types.d.ts.map +1 -1
  22. package/dist/__polyfills__/window.js.map +1 -1
  23. package/dist/__polyfills__/window.mjs.map +1 -1
  24. package/dist/__types__/base.d.ts +7 -66
  25. package/dist/__types__/base.d.ts.map +1 -1
  26. package/dist/__types__/base.js +1 -0
  27. package/dist/__types__/base.js.map +1 -1
  28. package/dist/__types__/base.mjs +1 -0
  29. package/dist/__types__/base.mjs.map +1 -1
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +1 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +1 -1
  35. package/dist/sdk-client.d.ts +8 -26
  36. package/dist/sdk-client.d.ts.map +1 -1
  37. package/dist/sdk-client.js +34 -92
  38. package/dist/sdk-client.js.map +1 -1
  39. package/dist/sdk-client.mjs +37 -95
  40. package/dist/sdk-client.mjs.map +1 -1
  41. package/dist/storage.d.ts +3 -20
  42. package/dist/storage.d.ts.map +1 -1
  43. package/dist/storage.js +0 -49
  44. package/dist/storage.js.map +1 -1
  45. package/dist/storage.mjs +1 -49
  46. package/dist/storage.mjs.map +1 -1
  47. package/dist/utils.d.ts +2 -0
  48. package/dist/utils.d.ts.map +1 -1
  49. package/dist/utils.js +27 -51
  50. package/dist/utils.js.map +1 -1
  51. package/dist/utils.mjs +27 -51
  52. package/dist/utils.mjs.map +1 -1
  53. package/package.json +10 -8
@@ -2,14 +2,19 @@ import { TERMINAL_ACTIVITY_STATUSES } from '@turnkey/http';
2
2
  import { TurnkeyRequestError } from '../__types__/base.mjs';
3
3
  import { VERSION } from './version.mjs';
4
4
  import { getStorageValue, StorageKeys } from '../storage.mjs';
5
+ import { parseSession } from '../utils.mjs';
5
6
 
6
7
  /* @generated by codegen. DO NOT EDIT BY HAND */
7
8
  class TurnkeySDKClientBase {
8
9
  constructor(config) {
9
10
  this.getActivity = async (input) => {
11
+ let session = await getStorageValue(StorageKeys.Session);
12
+ session = parseSession(session);
10
13
  return this.request("/public/v1/query/get_activity", {
11
14
  ...input,
12
- organizationId: input.organizationId ?? this.config.organizationId,
15
+ organizationId: input.organizationId ??
16
+ session?.organizationId ??
17
+ this.config.organizationId,
13
18
  });
14
19
  };
15
20
  this.stampGetActivity = async (input) => {
@@ -26,9 +31,13 @@ class TurnkeySDKClientBase {
26
31
  };
27
32
  };
28
33
  this.getApiKey = async (input) => {
34
+ let session = await getStorageValue(StorageKeys.Session);
35
+ session = parseSession(session);
29
36
  return this.request("/public/v1/query/get_api_key", {
30
37
  ...input,
31
- organizationId: input.organizationId ?? this.config.organizationId,
38
+ organizationId: input.organizationId ??
39
+ session?.organizationId ??
40
+ this.config.organizationId,
32
41
  });
33
42
  };
34
43
  this.stampGetApiKey = async (input) => {
@@ -45,9 +54,13 @@ class TurnkeySDKClientBase {
45
54
  };
46
55
  };
47
56
  this.getApiKeys = async (input = {}) => {
57
+ let session = await getStorageValue(StorageKeys.Session);
58
+ session = parseSession(session);
48
59
  return this.request("/public/v1/query/get_api_keys", {
49
60
  ...input,
50
- organizationId: input.organizationId ?? this.config.organizationId,
61
+ organizationId: input.organizationId ??
62
+ session?.organizationId ??
63
+ this.config.organizationId,
51
64
  });
52
65
  };
53
66
  this.stampGetApiKeys = async (input) => {
@@ -64,9 +77,13 @@ class TurnkeySDKClientBase {
64
77
  };
65
78
  };
66
79
  this.getAttestationDocument = async (input) => {
80
+ let session = await getStorageValue(StorageKeys.Session);
81
+ session = parseSession(session);
67
82
  return this.request("/public/v1/query/get_attestation", {
68
83
  ...input,
69
- organizationId: input.organizationId ?? this.config.organizationId,
84
+ organizationId: input.organizationId ??
85
+ session?.organizationId ??
86
+ this.config.organizationId,
70
87
  });
71
88
  };
72
89
  this.stampGetAttestationDocument = async (input) => {
@@ -83,9 +100,13 @@ class TurnkeySDKClientBase {
83
100
  };
84
101
  };
85
102
  this.getAuthenticator = async (input) => {
103
+ let session = await getStorageValue(StorageKeys.Session);
104
+ session = parseSession(session);
86
105
  return this.request("/public/v1/query/get_authenticator", {
87
106
  ...input,
88
- organizationId: input.organizationId ?? this.config.organizationId,
107
+ organizationId: input.organizationId ??
108
+ session?.organizationId ??
109
+ this.config.organizationId,
89
110
  });
90
111
  };
91
112
  this.stampGetAuthenticator = async (input) => {
@@ -102,9 +123,13 @@ class TurnkeySDKClientBase {
102
123
  };
103
124
  };
104
125
  this.getAuthenticators = async (input) => {
126
+ let session = await getStorageValue(StorageKeys.Session);
127
+ session = parseSession(session);
105
128
  return this.request("/public/v1/query/get_authenticators", {
106
129
  ...input,
107
- organizationId: input.organizationId ?? this.config.organizationId,
130
+ organizationId: input.organizationId ??
131
+ session?.organizationId ??
132
+ this.config.organizationId,
108
133
  });
109
134
  };
110
135
  this.stampGetAuthenticators = async (input) => {
@@ -121,9 +146,13 @@ class TurnkeySDKClientBase {
121
146
  };
122
147
  };
123
148
  this.getOauthProviders = async (input) => {
149
+ let session = await getStorageValue(StorageKeys.Session);
150
+ session = parseSession(session);
124
151
  return this.request("/public/v1/query/get_oauth_providers", {
125
152
  ...input,
126
- organizationId: input.organizationId ?? this.config.organizationId,
153
+ organizationId: input.organizationId ??
154
+ session?.organizationId ??
155
+ this.config.organizationId,
127
156
  });
128
157
  };
129
158
  this.stampGetOauthProviders = async (input) => {
@@ -140,9 +169,13 @@ class TurnkeySDKClientBase {
140
169
  };
141
170
  };
142
171
  this.getOrganization = async (input = {}) => {
172
+ let session = await getStorageValue(StorageKeys.Session);
173
+ session = parseSession(session);
143
174
  return this.request("/public/v1/query/get_organization", {
144
175
  ...input,
145
- organizationId: input.organizationId ?? this.config.organizationId,
176
+ organizationId: input.organizationId ??
177
+ session?.organizationId ??
178
+ this.config.organizationId,
146
179
  });
147
180
  };
148
181
  this.stampGetOrganization = async (input) => {
@@ -159,9 +192,13 @@ class TurnkeySDKClientBase {
159
192
  };
160
193
  };
161
194
  this.getOrganizationConfigs = async (input) => {
195
+ let session = await getStorageValue(StorageKeys.Session);
196
+ session = parseSession(session);
162
197
  return this.request("/public/v1/query/get_organization_configs", {
163
198
  ...input,
164
- organizationId: input.organizationId ?? this.config.organizationId,
199
+ organizationId: input.organizationId ??
200
+ session?.organizationId ??
201
+ this.config.organizationId,
165
202
  });
166
203
  };
167
204
  this.stampGetOrganizationConfigs = async (input) => {
@@ -178,9 +215,13 @@ class TurnkeySDKClientBase {
178
215
  };
179
216
  };
180
217
  this.getPolicy = async (input) => {
218
+ let session = await getStorageValue(StorageKeys.Session);
219
+ session = parseSession(session);
181
220
  return this.request("/public/v1/query/get_policy", {
182
221
  ...input,
183
- organizationId: input.organizationId ?? this.config.organizationId,
222
+ organizationId: input.organizationId ??
223
+ session?.organizationId ??
224
+ this.config.organizationId,
184
225
  });
185
226
  };
186
227
  this.stampGetPolicy = async (input) => {
@@ -197,9 +238,13 @@ class TurnkeySDKClientBase {
197
238
  };
198
239
  };
199
240
  this.getPrivateKey = async (input) => {
241
+ let session = await getStorageValue(StorageKeys.Session);
242
+ session = parseSession(session);
200
243
  return this.request("/public/v1/query/get_private_key", {
201
244
  ...input,
202
- organizationId: input.organizationId ?? this.config.organizationId,
245
+ organizationId: input.organizationId ??
246
+ session?.organizationId ??
247
+ this.config.organizationId,
203
248
  });
204
249
  };
205
250
  this.stampGetPrivateKey = async (input) => {
@@ -216,9 +261,13 @@ class TurnkeySDKClientBase {
216
261
  };
217
262
  };
218
263
  this.getUser = async (input) => {
264
+ let session = await getStorageValue(StorageKeys.Session);
265
+ session = parseSession(session);
219
266
  return this.request("/public/v1/query/get_user", {
220
267
  ...input,
221
- organizationId: input.organizationId ?? this.config.organizationId,
268
+ organizationId: input.organizationId ??
269
+ session?.organizationId ??
270
+ this.config.organizationId,
222
271
  });
223
272
  };
224
273
  this.stampGetUser = async (input) => {
@@ -235,9 +284,13 @@ class TurnkeySDKClientBase {
235
284
  };
236
285
  };
237
286
  this.getWallet = async (input) => {
287
+ let session = await getStorageValue(StorageKeys.Session);
288
+ session = parseSession(session);
238
289
  return this.request("/public/v1/query/get_wallet", {
239
290
  ...input,
240
- organizationId: input.organizationId ?? this.config.organizationId,
291
+ organizationId: input.organizationId ??
292
+ session?.organizationId ??
293
+ this.config.organizationId,
241
294
  });
242
295
  };
243
296
  this.stampGetWallet = async (input) => {
@@ -254,9 +307,13 @@ class TurnkeySDKClientBase {
254
307
  };
255
308
  };
256
309
  this.getWalletAccount = async (input) => {
310
+ let session = await getStorageValue(StorageKeys.Session);
311
+ session = parseSession(session);
257
312
  return this.request("/public/v1/query/get_wallet_account", {
258
313
  ...input,
259
- organizationId: input.organizationId ?? this.config.organizationId,
314
+ organizationId: input.organizationId ??
315
+ session?.organizationId ??
316
+ this.config.organizationId,
260
317
  });
261
318
  };
262
319
  this.stampGetWalletAccount = async (input) => {
@@ -273,9 +330,13 @@ class TurnkeySDKClientBase {
273
330
  };
274
331
  };
275
332
  this.getActivities = async (input = {}) => {
333
+ let session = await getStorageValue(StorageKeys.Session);
334
+ session = parseSession(session);
276
335
  return this.request("/public/v1/query/list_activities", {
277
336
  ...input,
278
- organizationId: input.organizationId ?? this.config.organizationId,
337
+ organizationId: input.organizationId ??
338
+ session?.organizationId ??
339
+ this.config.organizationId,
279
340
  });
280
341
  };
281
342
  this.stampGetActivities = async (input) => {
@@ -292,9 +353,13 @@ class TurnkeySDKClientBase {
292
353
  };
293
354
  };
294
355
  this.getPolicies = async (input = {}) => {
356
+ let session = await getStorageValue(StorageKeys.Session);
357
+ session = parseSession(session);
295
358
  return this.request("/public/v1/query/list_policies", {
296
359
  ...input,
297
- organizationId: input.organizationId ?? this.config.organizationId,
360
+ organizationId: input.organizationId ??
361
+ session?.organizationId ??
362
+ this.config.organizationId,
298
363
  });
299
364
  };
300
365
  this.stampGetPolicies = async (input) => {
@@ -311,9 +376,13 @@ class TurnkeySDKClientBase {
311
376
  };
312
377
  };
313
378
  this.listPrivateKeyTags = async (input) => {
379
+ let session = await getStorageValue(StorageKeys.Session);
380
+ session = parseSession(session);
314
381
  return this.request("/public/v1/query/list_private_key_tags", {
315
382
  ...input,
316
- organizationId: input.organizationId ?? this.config.organizationId,
383
+ organizationId: input.organizationId ??
384
+ session?.organizationId ??
385
+ this.config.organizationId,
317
386
  });
318
387
  };
319
388
  this.stampListPrivateKeyTags = async (input) => {
@@ -330,9 +399,13 @@ class TurnkeySDKClientBase {
330
399
  };
331
400
  };
332
401
  this.getPrivateKeys = async (input = {}) => {
402
+ let session = await getStorageValue(StorageKeys.Session);
403
+ session = parseSession(session);
333
404
  return this.request("/public/v1/query/list_private_keys", {
334
405
  ...input,
335
- organizationId: input.organizationId ?? this.config.organizationId,
406
+ organizationId: input.organizationId ??
407
+ session?.organizationId ??
408
+ this.config.organizationId,
336
409
  });
337
410
  };
338
411
  this.stampGetPrivateKeys = async (input) => {
@@ -349,9 +422,13 @@ class TurnkeySDKClientBase {
349
422
  };
350
423
  };
351
424
  this.getSubOrgIds = async (input = {}) => {
425
+ let session = await getStorageValue(StorageKeys.Session);
426
+ session = parseSession(session);
352
427
  return this.request("/public/v1/query/list_suborgs", {
353
428
  ...input,
354
- organizationId: input.organizationId ?? this.config.organizationId,
429
+ organizationId: input.organizationId ??
430
+ session?.organizationId ??
431
+ this.config.organizationId,
355
432
  });
356
433
  };
357
434
  this.stampGetSubOrgIds = async (input) => {
@@ -368,9 +445,13 @@ class TurnkeySDKClientBase {
368
445
  };
369
446
  };
370
447
  this.listUserTags = async (input = {}) => {
448
+ let session = await getStorageValue(StorageKeys.Session);
449
+ session = parseSession(session);
371
450
  return this.request("/public/v1/query/list_user_tags", {
372
451
  ...input,
373
- organizationId: input.organizationId ?? this.config.organizationId,
452
+ organizationId: input.organizationId ??
453
+ session?.organizationId ??
454
+ this.config.organizationId,
374
455
  });
375
456
  };
376
457
  this.stampListUserTags = async (input) => {
@@ -387,9 +468,13 @@ class TurnkeySDKClientBase {
387
468
  };
388
469
  };
389
470
  this.getUsers = async (input = {}) => {
471
+ let session = await getStorageValue(StorageKeys.Session);
472
+ session = parseSession(session);
390
473
  return this.request("/public/v1/query/list_users", {
391
474
  ...input,
392
- organizationId: input.organizationId ?? this.config.organizationId,
475
+ organizationId: input.organizationId ??
476
+ session?.organizationId ??
477
+ this.config.organizationId,
393
478
  });
394
479
  };
395
480
  this.stampGetUsers = async (input) => {
@@ -406,9 +491,13 @@ class TurnkeySDKClientBase {
406
491
  };
407
492
  };
408
493
  this.getVerifiedSubOrgIds = async (input) => {
494
+ let session = await getStorageValue(StorageKeys.Session);
495
+ session = parseSession(session);
409
496
  return this.request("/public/v1/query/list_verified_suborgs", {
410
497
  ...input,
411
- organizationId: input.organizationId ?? this.config.organizationId,
498
+ organizationId: input.organizationId ??
499
+ session?.organizationId ??
500
+ this.config.organizationId,
412
501
  });
413
502
  };
414
503
  this.stampGetVerifiedSubOrgIds = async (input) => {
@@ -425,9 +514,13 @@ class TurnkeySDKClientBase {
425
514
  };
426
515
  };
427
516
  this.getWalletAccounts = async (input) => {
517
+ let session = await getStorageValue(StorageKeys.Session);
518
+ session = parseSession(session);
428
519
  return this.request("/public/v1/query/list_wallet_accounts", {
429
520
  ...input,
430
- organizationId: input.organizationId ?? this.config.organizationId,
521
+ organizationId: input.organizationId ??
522
+ session?.organizationId ??
523
+ this.config.organizationId,
431
524
  });
432
525
  };
433
526
  this.stampGetWalletAccounts = async (input) => {
@@ -444,9 +537,13 @@ class TurnkeySDKClientBase {
444
537
  };
445
538
  };
446
539
  this.getWallets = async (input = {}) => {
540
+ let session = await getStorageValue(StorageKeys.Session);
541
+ session = parseSession(session);
447
542
  return this.request("/public/v1/query/list_wallets", {
448
543
  ...input,
449
- organizationId: input.organizationId ?? this.config.organizationId,
544
+ organizationId: input.organizationId ??
545
+ session?.organizationId ??
546
+ this.config.organizationId,
450
547
  });
451
548
  };
452
549
  this.stampGetWallets = async (input) => {
@@ -463,9 +560,13 @@ class TurnkeySDKClientBase {
463
560
  };
464
561
  };
465
562
  this.getWhoami = async (input = {}) => {
563
+ let session = await getStorageValue(StorageKeys.Session);
564
+ session = parseSession(session);
466
565
  return this.request("/public/v1/query/whoami", {
467
566
  ...input,
468
- organizationId: input.organizationId ?? this.config.organizationId,
567
+ organizationId: input.organizationId ??
568
+ session?.organizationId ??
569
+ this.config.organizationId,
469
570
  });
470
571
  };
471
572
  this.stampGetWhoami = async (input) => {
@@ -483,7 +584,8 @@ class TurnkeySDKClientBase {
483
584
  };
484
585
  this.approveActivity = async (input) => {
485
586
  const { organizationId, timestampMs, ...rest } = input;
486
- const session = await getStorageValue(StorageKeys.Session);
587
+ let session = await getStorageValue(StorageKeys.Session);
588
+ session = parseSession(session);
487
589
  return this.activityDecision("/public/v1/submit/approve_activity", {
488
590
  parameters: rest,
489
591
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
@@ -506,7 +608,8 @@ class TurnkeySDKClientBase {
506
608
  };
507
609
  this.createApiKeys = async (input) => {
508
610
  const { organizationId, timestampMs, ...rest } = input;
509
- const session = await getStorageValue(StorageKeys.Session);
611
+ let session = await getStorageValue(StorageKeys.Session);
612
+ session = parseSession(session);
510
613
  return this.command("/public/v1/submit/create_api_keys", {
511
614
  parameters: rest,
512
615
  organizationId: organizationId ??
@@ -531,7 +634,8 @@ class TurnkeySDKClientBase {
531
634
  };
532
635
  this.createApiOnlyUsers = async (input) => {
533
636
  const { organizationId, timestampMs, ...rest } = input;
534
- const session = await getStorageValue(StorageKeys.Session);
637
+ let session = await getStorageValue(StorageKeys.Session);
638
+ session = parseSession(session);
535
639
  return this.command("/public/v1/submit/create_api_only_users", {
536
640
  parameters: rest,
537
641
  organizationId: organizationId ??
@@ -556,7 +660,8 @@ class TurnkeySDKClientBase {
556
660
  };
557
661
  this.createAuthenticators = async (input) => {
558
662
  const { organizationId, timestampMs, ...rest } = input;
559
- const session = await getStorageValue(StorageKeys.Session);
663
+ let session = await getStorageValue(StorageKeys.Session);
664
+ session = parseSession(session);
560
665
  return this.command("/public/v1/submit/create_authenticators", {
561
666
  parameters: rest,
562
667
  organizationId: organizationId ??
@@ -581,7 +686,8 @@ class TurnkeySDKClientBase {
581
686
  };
582
687
  this.createInvitations = async (input) => {
583
688
  const { organizationId, timestampMs, ...rest } = input;
584
- const session = await getStorageValue(StorageKeys.Session);
689
+ let session = await getStorageValue(StorageKeys.Session);
690
+ session = parseSession(session);
585
691
  return this.command("/public/v1/submit/create_invitations", {
586
692
  parameters: rest,
587
693
  organizationId: organizationId ??
@@ -606,7 +712,8 @@ class TurnkeySDKClientBase {
606
712
  };
607
713
  this.createOauthProviders = async (input) => {
608
714
  const { organizationId, timestampMs, ...rest } = input;
609
- const session = await getStorageValue(StorageKeys.Session);
715
+ let session = await getStorageValue(StorageKeys.Session);
716
+ session = parseSession(session);
610
717
  return this.command("/public/v1/submit/create_oauth_providers", {
611
718
  parameters: rest,
612
719
  organizationId: organizationId ??
@@ -631,7 +738,8 @@ class TurnkeySDKClientBase {
631
738
  };
632
739
  this.createPolicies = async (input) => {
633
740
  const { organizationId, timestampMs, ...rest } = input;
634
- const session = await getStorageValue(StorageKeys.Session);
741
+ let session = await getStorageValue(StorageKeys.Session);
742
+ session = parseSession(session);
635
743
  return this.command("/public/v1/submit/create_policies", {
636
744
  parameters: rest,
637
745
  organizationId: organizationId ??
@@ -656,7 +764,8 @@ class TurnkeySDKClientBase {
656
764
  };
657
765
  this.createPolicy = async (input) => {
658
766
  const { organizationId, timestampMs, ...rest } = input;
659
- const session = await getStorageValue(StorageKeys.Session);
767
+ let session = await getStorageValue(StorageKeys.Session);
768
+ session = parseSession(session);
660
769
  return this.command("/public/v1/submit/create_policy", {
661
770
  parameters: rest,
662
771
  organizationId: organizationId ??
@@ -681,7 +790,8 @@ class TurnkeySDKClientBase {
681
790
  };
682
791
  this.createPrivateKeyTag = async (input) => {
683
792
  const { organizationId, timestampMs, ...rest } = input;
684
- const session = await getStorageValue(StorageKeys.Session);
793
+ let session = await getStorageValue(StorageKeys.Session);
794
+ session = parseSession(session);
685
795
  return this.command("/public/v1/submit/create_private_key_tag", {
686
796
  parameters: rest,
687
797
  organizationId: organizationId ??
@@ -706,7 +816,8 @@ class TurnkeySDKClientBase {
706
816
  };
707
817
  this.createPrivateKeys = async (input) => {
708
818
  const { organizationId, timestampMs, ...rest } = input;
709
- const session = await getStorageValue(StorageKeys.Session);
819
+ let session = await getStorageValue(StorageKeys.Session);
820
+ session = parseSession(session);
710
821
  return this.command("/public/v1/submit/create_private_keys", {
711
822
  parameters: rest,
712
823
  organizationId: organizationId ??
@@ -731,7 +842,8 @@ class TurnkeySDKClientBase {
731
842
  };
732
843
  this.createReadOnlySession = async (input) => {
733
844
  const { organizationId, timestampMs, ...rest } = input;
734
- const session = await getStorageValue(StorageKeys.Session);
845
+ let session = await getStorageValue(StorageKeys.Session);
846
+ session = parseSession(session);
735
847
  return this.command("/public/v1/submit/create_read_only_session", {
736
848
  parameters: rest,
737
849
  organizationId: organizationId ??
@@ -756,7 +868,8 @@ class TurnkeySDKClientBase {
756
868
  };
757
869
  this.createReadWriteSession = async (input) => {
758
870
  const { organizationId, timestampMs, ...rest } = input;
759
- const session = await getStorageValue(StorageKeys.Session);
871
+ let session = await getStorageValue(StorageKeys.Session);
872
+ session = parseSession(session);
760
873
  return this.command("/public/v1/submit/create_read_write_session", {
761
874
  parameters: rest,
762
875
  organizationId: organizationId ??
@@ -781,7 +894,8 @@ class TurnkeySDKClientBase {
781
894
  };
782
895
  this.createSubOrganization = async (input) => {
783
896
  const { organizationId, timestampMs, ...rest } = input;
784
- const session = await getStorageValue(StorageKeys.Session);
897
+ let session = await getStorageValue(StorageKeys.Session);
898
+ session = parseSession(session);
785
899
  return this.command("/public/v1/submit/create_sub_organization", {
786
900
  parameters: rest,
787
901
  organizationId: organizationId ??
@@ -806,7 +920,8 @@ class TurnkeySDKClientBase {
806
920
  };
807
921
  this.createUserTag = async (input) => {
808
922
  const { organizationId, timestampMs, ...rest } = input;
809
- const session = await getStorageValue(StorageKeys.Session);
923
+ let session = await getStorageValue(StorageKeys.Session);
924
+ session = parseSession(session);
810
925
  return this.command("/public/v1/submit/create_user_tag", {
811
926
  parameters: rest,
812
927
  organizationId: organizationId ??
@@ -831,7 +946,8 @@ class TurnkeySDKClientBase {
831
946
  };
832
947
  this.createUsers = async (input) => {
833
948
  const { organizationId, timestampMs, ...rest } = input;
834
- const session = await getStorageValue(StorageKeys.Session);
949
+ let session = await getStorageValue(StorageKeys.Session);
950
+ session = parseSession(session);
835
951
  return this.command("/public/v1/submit/create_users", {
836
952
  parameters: rest,
837
953
  organizationId: organizationId ??
@@ -856,7 +972,8 @@ class TurnkeySDKClientBase {
856
972
  };
857
973
  this.createWallet = async (input) => {
858
974
  const { organizationId, timestampMs, ...rest } = input;
859
- const session = await getStorageValue(StorageKeys.Session);
975
+ let session = await getStorageValue(StorageKeys.Session);
976
+ session = parseSession(session);
860
977
  return this.command("/public/v1/submit/create_wallet", {
861
978
  parameters: rest,
862
979
  organizationId: organizationId ??
@@ -881,7 +998,8 @@ class TurnkeySDKClientBase {
881
998
  };
882
999
  this.createWalletAccounts = async (input) => {
883
1000
  const { organizationId, timestampMs, ...rest } = input;
884
- const session = await getStorageValue(StorageKeys.Session);
1001
+ let session = await getStorageValue(StorageKeys.Session);
1002
+ session = parseSession(session);
885
1003
  return this.command("/public/v1/submit/create_wallet_accounts", {
886
1004
  parameters: rest,
887
1005
  organizationId: organizationId ??
@@ -906,7 +1024,8 @@ class TurnkeySDKClientBase {
906
1024
  };
907
1025
  this.deleteApiKeys = async (input) => {
908
1026
  const { organizationId, timestampMs, ...rest } = input;
909
- const session = await getStorageValue(StorageKeys.Session);
1027
+ let session = await getStorageValue(StorageKeys.Session);
1028
+ session = parseSession(session);
910
1029
  return this.command("/public/v1/submit/delete_api_keys", {
911
1030
  parameters: rest,
912
1031
  organizationId: organizationId ??
@@ -931,7 +1050,8 @@ class TurnkeySDKClientBase {
931
1050
  };
932
1051
  this.deleteAuthenticators = async (input) => {
933
1052
  const { organizationId, timestampMs, ...rest } = input;
934
- const session = await getStorageValue(StorageKeys.Session);
1053
+ let session = await getStorageValue(StorageKeys.Session);
1054
+ session = parseSession(session);
935
1055
  return this.command("/public/v1/submit/delete_authenticators", {
936
1056
  parameters: rest,
937
1057
  organizationId: organizationId ??
@@ -956,7 +1076,8 @@ class TurnkeySDKClientBase {
956
1076
  };
957
1077
  this.deleteInvitation = async (input) => {
958
1078
  const { organizationId, timestampMs, ...rest } = input;
959
- const session = await getStorageValue(StorageKeys.Session);
1079
+ let session = await getStorageValue(StorageKeys.Session);
1080
+ session = parseSession(session);
960
1081
  return this.command("/public/v1/submit/delete_invitation", {
961
1082
  parameters: rest,
962
1083
  organizationId: organizationId ??
@@ -981,7 +1102,8 @@ class TurnkeySDKClientBase {
981
1102
  };
982
1103
  this.deleteOauthProviders = async (input) => {
983
1104
  const { organizationId, timestampMs, ...rest } = input;
984
- const session = await getStorageValue(StorageKeys.Session);
1105
+ let session = await getStorageValue(StorageKeys.Session);
1106
+ session = parseSession(session);
985
1107
  return this.command("/public/v1/submit/delete_oauth_providers", {
986
1108
  parameters: rest,
987
1109
  organizationId: organizationId ??
@@ -1006,7 +1128,8 @@ class TurnkeySDKClientBase {
1006
1128
  };
1007
1129
  this.deletePolicy = async (input) => {
1008
1130
  const { organizationId, timestampMs, ...rest } = input;
1009
- const session = await getStorageValue(StorageKeys.Session);
1131
+ let session = await getStorageValue(StorageKeys.Session);
1132
+ session = parseSession(session);
1010
1133
  return this.command("/public/v1/submit/delete_policy", {
1011
1134
  parameters: rest,
1012
1135
  organizationId: organizationId ??
@@ -1031,7 +1154,8 @@ class TurnkeySDKClientBase {
1031
1154
  };
1032
1155
  this.deletePrivateKeyTags = async (input) => {
1033
1156
  const { organizationId, timestampMs, ...rest } = input;
1034
- const session = await getStorageValue(StorageKeys.Session);
1157
+ let session = await getStorageValue(StorageKeys.Session);
1158
+ session = parseSession(session);
1035
1159
  return this.command("/public/v1/submit/delete_private_key_tags", {
1036
1160
  parameters: rest,
1037
1161
  organizationId: organizationId ??
@@ -1056,7 +1180,8 @@ class TurnkeySDKClientBase {
1056
1180
  };
1057
1181
  this.deletePrivateKeys = async (input) => {
1058
1182
  const { organizationId, timestampMs, ...rest } = input;
1059
- const session = await getStorageValue(StorageKeys.Session);
1183
+ let session = await getStorageValue(StorageKeys.Session);
1184
+ session = parseSession(session);
1060
1185
  return this.command("/public/v1/submit/delete_private_keys", {
1061
1186
  parameters: rest,
1062
1187
  organizationId: organizationId ??
@@ -1081,7 +1206,8 @@ class TurnkeySDKClientBase {
1081
1206
  };
1082
1207
  this.deleteSubOrganization = async (input) => {
1083
1208
  const { organizationId, timestampMs, ...rest } = input;
1084
- const session = await getStorageValue(StorageKeys.Session);
1209
+ let session = await getStorageValue(StorageKeys.Session);
1210
+ session = parseSession(session);
1085
1211
  return this.command("/public/v1/submit/delete_sub_organization", {
1086
1212
  parameters: rest,
1087
1213
  organizationId: organizationId ??
@@ -1106,7 +1232,8 @@ class TurnkeySDKClientBase {
1106
1232
  };
1107
1233
  this.deleteUserTags = async (input) => {
1108
1234
  const { organizationId, timestampMs, ...rest } = input;
1109
- const session = await getStorageValue(StorageKeys.Session);
1235
+ let session = await getStorageValue(StorageKeys.Session);
1236
+ session = parseSession(session);
1110
1237
  return this.command("/public/v1/submit/delete_user_tags", {
1111
1238
  parameters: rest,
1112
1239
  organizationId: organizationId ??
@@ -1131,7 +1258,8 @@ class TurnkeySDKClientBase {
1131
1258
  };
1132
1259
  this.deleteUsers = async (input) => {
1133
1260
  const { organizationId, timestampMs, ...rest } = input;
1134
- const session = await getStorageValue(StorageKeys.Session);
1261
+ let session = await getStorageValue(StorageKeys.Session);
1262
+ session = parseSession(session);
1135
1263
  return this.command("/public/v1/submit/delete_users", {
1136
1264
  parameters: rest,
1137
1265
  organizationId: organizationId ??
@@ -1156,7 +1284,8 @@ class TurnkeySDKClientBase {
1156
1284
  };
1157
1285
  this.deleteWallets = async (input) => {
1158
1286
  const { organizationId, timestampMs, ...rest } = input;
1159
- const session = await getStorageValue(StorageKeys.Session);
1287
+ let session = await getStorageValue(StorageKeys.Session);
1288
+ session = parseSession(session);
1160
1289
  return this.command("/public/v1/submit/delete_wallets", {
1161
1290
  parameters: rest,
1162
1291
  organizationId: organizationId ??
@@ -1181,7 +1310,8 @@ class TurnkeySDKClientBase {
1181
1310
  };
1182
1311
  this.emailAuth = async (input) => {
1183
1312
  const { organizationId, timestampMs, ...rest } = input;
1184
- const session = await getStorageValue(StorageKeys.Session);
1313
+ let session = await getStorageValue(StorageKeys.Session);
1314
+ session = parseSession(session);
1185
1315
  return this.command("/public/v1/submit/email_auth", {
1186
1316
  parameters: rest,
1187
1317
  organizationId: organizationId ??
@@ -1206,7 +1336,8 @@ class TurnkeySDKClientBase {
1206
1336
  };
1207
1337
  this.exportPrivateKey = async (input) => {
1208
1338
  const { organizationId, timestampMs, ...rest } = input;
1209
- const session = await getStorageValue(StorageKeys.Session);
1339
+ let session = await getStorageValue(StorageKeys.Session);
1340
+ session = parseSession(session);
1210
1341
  return this.command("/public/v1/submit/export_private_key", {
1211
1342
  parameters: rest,
1212
1343
  organizationId: organizationId ??
@@ -1231,7 +1362,8 @@ class TurnkeySDKClientBase {
1231
1362
  };
1232
1363
  this.exportWallet = async (input) => {
1233
1364
  const { organizationId, timestampMs, ...rest } = input;
1234
- const session = await getStorageValue(StorageKeys.Session);
1365
+ let session = await getStorageValue(StorageKeys.Session);
1366
+ session = parseSession(session);
1235
1367
  return this.command("/public/v1/submit/export_wallet", {
1236
1368
  parameters: rest,
1237
1369
  organizationId: organizationId ??
@@ -1256,7 +1388,8 @@ class TurnkeySDKClientBase {
1256
1388
  };
1257
1389
  this.exportWalletAccount = async (input) => {
1258
1390
  const { organizationId, timestampMs, ...rest } = input;
1259
- const session = await getStorageValue(StorageKeys.Session);
1391
+ let session = await getStorageValue(StorageKeys.Session);
1392
+ session = parseSession(session);
1260
1393
  return this.command("/public/v1/submit/export_wallet_account", {
1261
1394
  parameters: rest,
1262
1395
  organizationId: organizationId ??
@@ -1281,7 +1414,8 @@ class TurnkeySDKClientBase {
1281
1414
  };
1282
1415
  this.importPrivateKey = async (input) => {
1283
1416
  const { organizationId, timestampMs, ...rest } = input;
1284
- const session = await getStorageValue(StorageKeys.Session);
1417
+ let session = await getStorageValue(StorageKeys.Session);
1418
+ session = parseSession(session);
1285
1419
  return this.command("/public/v1/submit/import_private_key", {
1286
1420
  parameters: rest,
1287
1421
  organizationId: organizationId ??
@@ -1306,7 +1440,8 @@ class TurnkeySDKClientBase {
1306
1440
  };
1307
1441
  this.importWallet = async (input) => {
1308
1442
  const { organizationId, timestampMs, ...rest } = input;
1309
- const session = await getStorageValue(StorageKeys.Session);
1443
+ let session = await getStorageValue(StorageKeys.Session);
1444
+ session = parseSession(session);
1310
1445
  return this.command("/public/v1/submit/import_wallet", {
1311
1446
  parameters: rest,
1312
1447
  organizationId: organizationId ??
@@ -1331,7 +1466,8 @@ class TurnkeySDKClientBase {
1331
1466
  };
1332
1467
  this.initImportPrivateKey = async (input) => {
1333
1468
  const { organizationId, timestampMs, ...rest } = input;
1334
- const session = await getStorageValue(StorageKeys.Session);
1469
+ let session = await getStorageValue(StorageKeys.Session);
1470
+ session = parseSession(session);
1335
1471
  return this.command("/public/v1/submit/init_import_private_key", {
1336
1472
  parameters: rest,
1337
1473
  organizationId: organizationId ??
@@ -1356,7 +1492,8 @@ class TurnkeySDKClientBase {
1356
1492
  };
1357
1493
  this.initImportWallet = async (input) => {
1358
1494
  const { organizationId, timestampMs, ...rest } = input;
1359
- const session = await getStorageValue(StorageKeys.Session);
1495
+ let session = await getStorageValue(StorageKeys.Session);
1496
+ session = parseSession(session);
1360
1497
  return this.command("/public/v1/submit/init_import_wallet", {
1361
1498
  parameters: rest,
1362
1499
  organizationId: organizationId ??
@@ -1379,9 +1516,36 @@ class TurnkeySDKClientBase {
1379
1516
  url: fullUrl,
1380
1517
  };
1381
1518
  };
1519
+ this.initOtp = async (input) => {
1520
+ const { organizationId, timestampMs, ...rest } = input;
1521
+ let session = await getStorageValue(StorageKeys.Session);
1522
+ session = parseSession(session);
1523
+ return this.command("/public/v1/submit/init_otp", {
1524
+ parameters: rest,
1525
+ organizationId: organizationId ??
1526
+ session?.organizationId ??
1527
+ this.config.organizationId,
1528
+ timestampMs: timestampMs ?? String(Date.now()),
1529
+ type: "ACTIVITY_TYPE_INIT_OTP",
1530
+ }, "initOtpResult");
1531
+ };
1532
+ this.stampInitOtp = async (input) => {
1533
+ if (!this.stamper) {
1534
+ return undefined;
1535
+ }
1536
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
1537
+ const body = JSON.stringify(input);
1538
+ const stamp = await this.stamper.stamp(body);
1539
+ return {
1540
+ body: body,
1541
+ stamp: stamp,
1542
+ url: fullUrl,
1543
+ };
1544
+ };
1382
1545
  this.initOtpAuth = async (input) => {
1383
1546
  const { organizationId, timestampMs, ...rest } = input;
1384
- const session = await getStorageValue(StorageKeys.Session);
1547
+ let session = await getStorageValue(StorageKeys.Session);
1548
+ session = parseSession(session);
1385
1549
  return this.command("/public/v1/submit/init_otp_auth", {
1386
1550
  parameters: rest,
1387
1551
  organizationId: organizationId ??
@@ -1406,7 +1570,8 @@ class TurnkeySDKClientBase {
1406
1570
  };
1407
1571
  this.initUserEmailRecovery = async (input) => {
1408
1572
  const { organizationId, timestampMs, ...rest } = input;
1409
- const session = await getStorageValue(StorageKeys.Session);
1573
+ let session = await getStorageValue(StorageKeys.Session);
1574
+ session = parseSession(session);
1410
1575
  return this.command("/public/v1/submit/init_user_email_recovery", {
1411
1576
  parameters: rest,
1412
1577
  organizationId: organizationId ??
@@ -1431,7 +1596,8 @@ class TurnkeySDKClientBase {
1431
1596
  };
1432
1597
  this.oauth = async (input) => {
1433
1598
  const { organizationId, timestampMs, ...rest } = input;
1434
- const session = await getStorageValue(StorageKeys.Session);
1599
+ let session = await getStorageValue(StorageKeys.Session);
1600
+ session = parseSession(session);
1435
1601
  return this.command("/public/v1/submit/oauth", {
1436
1602
  parameters: rest,
1437
1603
  organizationId: organizationId ??
@@ -1454,9 +1620,36 @@ class TurnkeySDKClientBase {
1454
1620
  url: fullUrl,
1455
1621
  };
1456
1622
  };
1623
+ this.oauthLogin = async (input) => {
1624
+ const { organizationId, timestampMs, ...rest } = input;
1625
+ let session = await getStorageValue(StorageKeys.Session);
1626
+ session = parseSession(session);
1627
+ return this.command("/public/v1/submit/oauth_login", {
1628
+ parameters: rest,
1629
+ organizationId: organizationId ??
1630
+ session?.organizationId ??
1631
+ this.config.organizationId,
1632
+ timestampMs: timestampMs ?? String(Date.now()),
1633
+ type: "ACTIVITY_TYPE_OAUTH_LOGIN",
1634
+ }, "oauthLoginResult");
1635
+ };
1636
+ this.stampOauthLogin = async (input) => {
1637
+ if (!this.stamper) {
1638
+ return undefined;
1639
+ }
1640
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
1641
+ const body = JSON.stringify(input);
1642
+ const stamp = await this.stamper.stamp(body);
1643
+ return {
1644
+ body: body,
1645
+ stamp: stamp,
1646
+ url: fullUrl,
1647
+ };
1648
+ };
1457
1649
  this.otpAuth = async (input) => {
1458
1650
  const { organizationId, timestampMs, ...rest } = input;
1459
- const session = await getStorageValue(StorageKeys.Session);
1651
+ let session = await getStorageValue(StorageKeys.Session);
1652
+ session = parseSession(session);
1460
1653
  return this.command("/public/v1/submit/otp_auth", {
1461
1654
  parameters: rest,
1462
1655
  organizationId: organizationId ??
@@ -1479,9 +1672,36 @@ class TurnkeySDKClientBase {
1479
1672
  url: fullUrl,
1480
1673
  };
1481
1674
  };
1675
+ this.otpLogin = async (input) => {
1676
+ const { organizationId, timestampMs, ...rest } = input;
1677
+ let session = await getStorageValue(StorageKeys.Session);
1678
+ session = parseSession(session);
1679
+ return this.command("/public/v1/submit/otp_login", {
1680
+ parameters: rest,
1681
+ organizationId: organizationId ??
1682
+ session?.organizationId ??
1683
+ this.config.organizationId,
1684
+ timestampMs: timestampMs ?? String(Date.now()),
1685
+ type: "ACTIVITY_TYPE_OTP_LOGIN",
1686
+ }, "otpLoginResult");
1687
+ };
1688
+ this.stampOtpLogin = async (input) => {
1689
+ if (!this.stamper) {
1690
+ return undefined;
1691
+ }
1692
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
1693
+ const body = JSON.stringify(input);
1694
+ const stamp = await this.stamper.stamp(body);
1695
+ return {
1696
+ body: body,
1697
+ stamp: stamp,
1698
+ url: fullUrl,
1699
+ };
1700
+ };
1482
1701
  this.recoverUser = async (input) => {
1483
1702
  const { organizationId, timestampMs, ...rest } = input;
1484
- const session = await getStorageValue(StorageKeys.Session);
1703
+ let session = await getStorageValue(StorageKeys.Session);
1704
+ session = parseSession(session);
1485
1705
  return this.command("/public/v1/submit/recover_user", {
1486
1706
  parameters: rest,
1487
1707
  organizationId: organizationId ??
@@ -1506,7 +1726,8 @@ class TurnkeySDKClientBase {
1506
1726
  };
1507
1727
  this.rejectActivity = async (input) => {
1508
1728
  const { organizationId, timestampMs, ...rest } = input;
1509
- const session = await getStorageValue(StorageKeys.Session);
1729
+ let session = await getStorageValue(StorageKeys.Session);
1730
+ session = parseSession(session);
1510
1731
  return this.activityDecision("/public/v1/submit/reject_activity", {
1511
1732
  parameters: rest,
1512
1733
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
@@ -1529,7 +1750,8 @@ class TurnkeySDKClientBase {
1529
1750
  };
1530
1751
  this.removeOrganizationFeature = async (input) => {
1531
1752
  const { organizationId, timestampMs, ...rest } = input;
1532
- const session = await getStorageValue(StorageKeys.Session);
1753
+ let session = await getStorageValue(StorageKeys.Session);
1754
+ session = parseSession(session);
1533
1755
  return this.command("/public/v1/submit/remove_organization_feature", {
1534
1756
  parameters: rest,
1535
1757
  organizationId: organizationId ??
@@ -1554,7 +1776,8 @@ class TurnkeySDKClientBase {
1554
1776
  };
1555
1777
  this.setOrganizationFeature = async (input) => {
1556
1778
  const { organizationId, timestampMs, ...rest } = input;
1557
- const session = await getStorageValue(StorageKeys.Session);
1779
+ let session = await getStorageValue(StorageKeys.Session);
1780
+ session = parseSession(session);
1558
1781
  return this.command("/public/v1/submit/set_organization_feature", {
1559
1782
  parameters: rest,
1560
1783
  organizationId: organizationId ??
@@ -1579,7 +1802,8 @@ class TurnkeySDKClientBase {
1579
1802
  };
1580
1803
  this.signRawPayload = async (input) => {
1581
1804
  const { organizationId, timestampMs, ...rest } = input;
1582
- const session = await getStorageValue(StorageKeys.Session);
1805
+ let session = await getStorageValue(StorageKeys.Session);
1806
+ session = parseSession(session);
1583
1807
  return this.command("/public/v1/submit/sign_raw_payload", {
1584
1808
  parameters: rest,
1585
1809
  organizationId: organizationId ??
@@ -1604,7 +1828,8 @@ class TurnkeySDKClientBase {
1604
1828
  };
1605
1829
  this.signRawPayloads = async (input) => {
1606
1830
  const { organizationId, timestampMs, ...rest } = input;
1607
- const session = await getStorageValue(StorageKeys.Session);
1831
+ let session = await getStorageValue(StorageKeys.Session);
1832
+ session = parseSession(session);
1608
1833
  return this.command("/public/v1/submit/sign_raw_payloads", {
1609
1834
  parameters: rest,
1610
1835
  organizationId: organizationId ??
@@ -1629,7 +1854,8 @@ class TurnkeySDKClientBase {
1629
1854
  };
1630
1855
  this.signTransaction = async (input) => {
1631
1856
  const { organizationId, timestampMs, ...rest } = input;
1632
- const session = await getStorageValue(StorageKeys.Session);
1857
+ let session = await getStorageValue(StorageKeys.Session);
1858
+ session = parseSession(session);
1633
1859
  return this.command("/public/v1/submit/sign_transaction", {
1634
1860
  parameters: rest,
1635
1861
  organizationId: organizationId ??
@@ -1652,9 +1878,36 @@ class TurnkeySDKClientBase {
1652
1878
  url: fullUrl,
1653
1879
  };
1654
1880
  };
1881
+ this.stampLogin = async (input) => {
1882
+ const { organizationId, timestampMs, ...rest } = input;
1883
+ let session = await getStorageValue(StorageKeys.Session);
1884
+ session = parseSession(session);
1885
+ return this.command("/public/v1/submit/stamp_login", {
1886
+ parameters: rest,
1887
+ organizationId: organizationId ??
1888
+ session?.organizationId ??
1889
+ this.config.organizationId,
1890
+ timestampMs: timestampMs ?? String(Date.now()),
1891
+ type: "ACTIVITY_TYPE_STAMP_LOGIN",
1892
+ }, "stampLoginResult");
1893
+ };
1894
+ this.stampStampLogin = async (input) => {
1895
+ if (!this.stamper) {
1896
+ return undefined;
1897
+ }
1898
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
1899
+ const body = JSON.stringify(input);
1900
+ const stamp = await this.stamper.stamp(body);
1901
+ return {
1902
+ body: body,
1903
+ stamp: stamp,
1904
+ url: fullUrl,
1905
+ };
1906
+ };
1655
1907
  this.updatePolicy = async (input) => {
1656
1908
  const { organizationId, timestampMs, ...rest } = input;
1657
- const session = await getStorageValue(StorageKeys.Session);
1909
+ let session = await getStorageValue(StorageKeys.Session);
1910
+ session = parseSession(session);
1658
1911
  return this.command("/public/v1/submit/update_policy", {
1659
1912
  parameters: rest,
1660
1913
  organizationId: organizationId ??
@@ -1679,7 +1932,8 @@ class TurnkeySDKClientBase {
1679
1932
  };
1680
1933
  this.updatePrivateKeyTag = async (input) => {
1681
1934
  const { organizationId, timestampMs, ...rest } = input;
1682
- const session = await getStorageValue(StorageKeys.Session);
1935
+ let session = await getStorageValue(StorageKeys.Session);
1936
+ session = parseSession(session);
1683
1937
  return this.command("/public/v1/submit/update_private_key_tag", {
1684
1938
  parameters: rest,
1685
1939
  organizationId: organizationId ??
@@ -1704,7 +1958,8 @@ class TurnkeySDKClientBase {
1704
1958
  };
1705
1959
  this.updateRootQuorum = async (input) => {
1706
1960
  const { organizationId, timestampMs, ...rest } = input;
1707
- const session = await getStorageValue(StorageKeys.Session);
1961
+ let session = await getStorageValue(StorageKeys.Session);
1962
+ session = parseSession(session);
1708
1963
  return this.command("/public/v1/submit/update_root_quorum", {
1709
1964
  parameters: rest,
1710
1965
  organizationId: organizationId ??
@@ -1729,7 +1984,8 @@ class TurnkeySDKClientBase {
1729
1984
  };
1730
1985
  this.updateUser = async (input) => {
1731
1986
  const { organizationId, timestampMs, ...rest } = input;
1732
- const session = await getStorageValue(StorageKeys.Session);
1987
+ let session = await getStorageValue(StorageKeys.Session);
1988
+ session = parseSession(session);
1733
1989
  return this.command("/public/v1/submit/update_user", {
1734
1990
  parameters: rest,
1735
1991
  organizationId: organizationId ??
@@ -1754,7 +2010,8 @@ class TurnkeySDKClientBase {
1754
2010
  };
1755
2011
  this.updateUserTag = async (input) => {
1756
2012
  const { organizationId, timestampMs, ...rest } = input;
1757
- const session = await getStorageValue(StorageKeys.Session);
2013
+ let session = await getStorageValue(StorageKeys.Session);
2014
+ session = parseSession(session);
1758
2015
  return this.command("/public/v1/submit/update_user_tag", {
1759
2016
  parameters: rest,
1760
2017
  organizationId: organizationId ??
@@ -1779,7 +2036,8 @@ class TurnkeySDKClientBase {
1779
2036
  };
1780
2037
  this.updateWallet = async (input) => {
1781
2038
  const { organizationId, timestampMs, ...rest } = input;
1782
- const session = await getStorageValue(StorageKeys.Session);
2039
+ let session = await getStorageValue(StorageKeys.Session);
2040
+ session = parseSession(session);
1783
2041
  return this.command("/public/v1/submit/update_wallet", {
1784
2042
  parameters: rest,
1785
2043
  organizationId: organizationId ??
@@ -1802,10 +2060,40 @@ class TurnkeySDKClientBase {
1802
2060
  url: fullUrl,
1803
2061
  };
1804
2062
  };
2063
+ this.verifyOtp = async (input) => {
2064
+ const { organizationId, timestampMs, ...rest } = input;
2065
+ let session = await getStorageValue(StorageKeys.Session);
2066
+ session = parseSession(session);
2067
+ return this.command("/public/v1/submit/verify_otp", {
2068
+ parameters: rest,
2069
+ organizationId: organizationId ??
2070
+ session?.organizationId ??
2071
+ this.config.organizationId,
2072
+ timestampMs: timestampMs ?? String(Date.now()),
2073
+ type: "ACTIVITY_TYPE_VERIFY_OTP",
2074
+ }, "verifyOtpResult");
2075
+ };
2076
+ this.stampVerifyOtp = async (input) => {
2077
+ if (!this.stamper) {
2078
+ return undefined;
2079
+ }
2080
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
2081
+ const body = JSON.stringify(input);
2082
+ const stamp = await this.stamper.stamp(body);
2083
+ return {
2084
+ body: body,
2085
+ stamp: stamp,
2086
+ url: fullUrl,
2087
+ };
2088
+ };
1805
2089
  this.testRateLimits = async (input) => {
2090
+ let session = await getStorageValue(StorageKeys.Session);
2091
+ session = parseSession(session);
1806
2092
  return this.request("/tkhq/api/v1/test_rate_limits", {
1807
2093
  ...input,
1808
- organizationId: input.organizationId ?? this.config.organizationId,
2094
+ organizationId: input.organizationId ??
2095
+ session?.organizationId ??
2096
+ this.config.organizationId,
1809
2097
  });
1810
2098
  };
1811
2099
  this.stampTestRateLimits = async (input) => {