@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
@@ -4,14 +4,19 @@ var http = require('@turnkey/http');
4
4
  var base = require('../__types__/base.js');
5
5
  var version = require('./version.js');
6
6
  var storage = require('../storage.js');
7
+ var utils = require('../utils.js');
7
8
 
8
9
  /* @generated by codegen. DO NOT EDIT BY HAND */
9
10
  class TurnkeySDKClientBase {
10
11
  constructor(config) {
11
12
  this.getActivity = async (input) => {
13
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
14
+ session = utils.parseSession(session);
12
15
  return this.request("/public/v1/query/get_activity", {
13
16
  ...input,
14
- organizationId: input.organizationId ?? this.config.organizationId,
17
+ organizationId: input.organizationId ??
18
+ session?.organizationId ??
19
+ this.config.organizationId,
15
20
  });
16
21
  };
17
22
  this.stampGetActivity = async (input) => {
@@ -28,9 +33,13 @@ class TurnkeySDKClientBase {
28
33
  };
29
34
  };
30
35
  this.getApiKey = async (input) => {
36
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
37
+ session = utils.parseSession(session);
31
38
  return this.request("/public/v1/query/get_api_key", {
32
39
  ...input,
33
- organizationId: input.organizationId ?? this.config.organizationId,
40
+ organizationId: input.organizationId ??
41
+ session?.organizationId ??
42
+ this.config.organizationId,
34
43
  });
35
44
  };
36
45
  this.stampGetApiKey = async (input) => {
@@ -47,9 +56,13 @@ class TurnkeySDKClientBase {
47
56
  };
48
57
  };
49
58
  this.getApiKeys = async (input = {}) => {
59
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
60
+ session = utils.parseSession(session);
50
61
  return this.request("/public/v1/query/get_api_keys", {
51
62
  ...input,
52
- organizationId: input.organizationId ?? this.config.organizationId,
63
+ organizationId: input.organizationId ??
64
+ session?.organizationId ??
65
+ this.config.organizationId,
53
66
  });
54
67
  };
55
68
  this.stampGetApiKeys = async (input) => {
@@ -66,9 +79,13 @@ class TurnkeySDKClientBase {
66
79
  };
67
80
  };
68
81
  this.getAttestationDocument = async (input) => {
82
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
83
+ session = utils.parseSession(session);
69
84
  return this.request("/public/v1/query/get_attestation", {
70
85
  ...input,
71
- organizationId: input.organizationId ?? this.config.organizationId,
86
+ organizationId: input.organizationId ??
87
+ session?.organizationId ??
88
+ this.config.organizationId,
72
89
  });
73
90
  };
74
91
  this.stampGetAttestationDocument = async (input) => {
@@ -85,9 +102,13 @@ class TurnkeySDKClientBase {
85
102
  };
86
103
  };
87
104
  this.getAuthenticator = async (input) => {
105
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
106
+ session = utils.parseSession(session);
88
107
  return this.request("/public/v1/query/get_authenticator", {
89
108
  ...input,
90
- organizationId: input.organizationId ?? this.config.organizationId,
109
+ organizationId: input.organizationId ??
110
+ session?.organizationId ??
111
+ this.config.organizationId,
91
112
  });
92
113
  };
93
114
  this.stampGetAuthenticator = async (input) => {
@@ -104,9 +125,13 @@ class TurnkeySDKClientBase {
104
125
  };
105
126
  };
106
127
  this.getAuthenticators = async (input) => {
128
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
129
+ session = utils.parseSession(session);
107
130
  return this.request("/public/v1/query/get_authenticators", {
108
131
  ...input,
109
- organizationId: input.organizationId ?? this.config.organizationId,
132
+ organizationId: input.organizationId ??
133
+ session?.organizationId ??
134
+ this.config.organizationId,
110
135
  });
111
136
  };
112
137
  this.stampGetAuthenticators = async (input) => {
@@ -123,9 +148,13 @@ class TurnkeySDKClientBase {
123
148
  };
124
149
  };
125
150
  this.getOauthProviders = async (input) => {
151
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
152
+ session = utils.parseSession(session);
126
153
  return this.request("/public/v1/query/get_oauth_providers", {
127
154
  ...input,
128
- organizationId: input.organizationId ?? this.config.organizationId,
155
+ organizationId: input.organizationId ??
156
+ session?.organizationId ??
157
+ this.config.organizationId,
129
158
  });
130
159
  };
131
160
  this.stampGetOauthProviders = async (input) => {
@@ -142,9 +171,13 @@ class TurnkeySDKClientBase {
142
171
  };
143
172
  };
144
173
  this.getOrganization = async (input = {}) => {
174
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
175
+ session = utils.parseSession(session);
145
176
  return this.request("/public/v1/query/get_organization", {
146
177
  ...input,
147
- organizationId: input.organizationId ?? this.config.organizationId,
178
+ organizationId: input.organizationId ??
179
+ session?.organizationId ??
180
+ this.config.organizationId,
148
181
  });
149
182
  };
150
183
  this.stampGetOrganization = async (input) => {
@@ -161,9 +194,13 @@ class TurnkeySDKClientBase {
161
194
  };
162
195
  };
163
196
  this.getOrganizationConfigs = async (input) => {
197
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
198
+ session = utils.parseSession(session);
164
199
  return this.request("/public/v1/query/get_organization_configs", {
165
200
  ...input,
166
- organizationId: input.organizationId ?? this.config.organizationId,
201
+ organizationId: input.organizationId ??
202
+ session?.organizationId ??
203
+ this.config.organizationId,
167
204
  });
168
205
  };
169
206
  this.stampGetOrganizationConfigs = async (input) => {
@@ -180,9 +217,13 @@ class TurnkeySDKClientBase {
180
217
  };
181
218
  };
182
219
  this.getPolicy = async (input) => {
220
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
221
+ session = utils.parseSession(session);
183
222
  return this.request("/public/v1/query/get_policy", {
184
223
  ...input,
185
- organizationId: input.organizationId ?? this.config.organizationId,
224
+ organizationId: input.organizationId ??
225
+ session?.organizationId ??
226
+ this.config.organizationId,
186
227
  });
187
228
  };
188
229
  this.stampGetPolicy = async (input) => {
@@ -199,9 +240,13 @@ class TurnkeySDKClientBase {
199
240
  };
200
241
  };
201
242
  this.getPrivateKey = async (input) => {
243
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
244
+ session = utils.parseSession(session);
202
245
  return this.request("/public/v1/query/get_private_key", {
203
246
  ...input,
204
- organizationId: input.organizationId ?? this.config.organizationId,
247
+ organizationId: input.organizationId ??
248
+ session?.organizationId ??
249
+ this.config.organizationId,
205
250
  });
206
251
  };
207
252
  this.stampGetPrivateKey = async (input) => {
@@ -218,9 +263,13 @@ class TurnkeySDKClientBase {
218
263
  };
219
264
  };
220
265
  this.getUser = async (input) => {
266
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
267
+ session = utils.parseSession(session);
221
268
  return this.request("/public/v1/query/get_user", {
222
269
  ...input,
223
- organizationId: input.organizationId ?? this.config.organizationId,
270
+ organizationId: input.organizationId ??
271
+ session?.organizationId ??
272
+ this.config.organizationId,
224
273
  });
225
274
  };
226
275
  this.stampGetUser = async (input) => {
@@ -237,9 +286,13 @@ class TurnkeySDKClientBase {
237
286
  };
238
287
  };
239
288
  this.getWallet = async (input) => {
289
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
290
+ session = utils.parseSession(session);
240
291
  return this.request("/public/v1/query/get_wallet", {
241
292
  ...input,
242
- organizationId: input.organizationId ?? this.config.organizationId,
293
+ organizationId: input.organizationId ??
294
+ session?.organizationId ??
295
+ this.config.organizationId,
243
296
  });
244
297
  };
245
298
  this.stampGetWallet = async (input) => {
@@ -256,9 +309,13 @@ class TurnkeySDKClientBase {
256
309
  };
257
310
  };
258
311
  this.getWalletAccount = async (input) => {
312
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
313
+ session = utils.parseSession(session);
259
314
  return this.request("/public/v1/query/get_wallet_account", {
260
315
  ...input,
261
- organizationId: input.organizationId ?? this.config.organizationId,
316
+ organizationId: input.organizationId ??
317
+ session?.organizationId ??
318
+ this.config.organizationId,
262
319
  });
263
320
  };
264
321
  this.stampGetWalletAccount = async (input) => {
@@ -275,9 +332,13 @@ class TurnkeySDKClientBase {
275
332
  };
276
333
  };
277
334
  this.getActivities = async (input = {}) => {
335
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
336
+ session = utils.parseSession(session);
278
337
  return this.request("/public/v1/query/list_activities", {
279
338
  ...input,
280
- organizationId: input.organizationId ?? this.config.organizationId,
339
+ organizationId: input.organizationId ??
340
+ session?.organizationId ??
341
+ this.config.organizationId,
281
342
  });
282
343
  };
283
344
  this.stampGetActivities = async (input) => {
@@ -294,9 +355,13 @@ class TurnkeySDKClientBase {
294
355
  };
295
356
  };
296
357
  this.getPolicies = async (input = {}) => {
358
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
359
+ session = utils.parseSession(session);
297
360
  return this.request("/public/v1/query/list_policies", {
298
361
  ...input,
299
- organizationId: input.organizationId ?? this.config.organizationId,
362
+ organizationId: input.organizationId ??
363
+ session?.organizationId ??
364
+ this.config.organizationId,
300
365
  });
301
366
  };
302
367
  this.stampGetPolicies = async (input) => {
@@ -313,9 +378,13 @@ class TurnkeySDKClientBase {
313
378
  };
314
379
  };
315
380
  this.listPrivateKeyTags = async (input) => {
381
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
382
+ session = utils.parseSession(session);
316
383
  return this.request("/public/v1/query/list_private_key_tags", {
317
384
  ...input,
318
- organizationId: input.organizationId ?? this.config.organizationId,
385
+ organizationId: input.organizationId ??
386
+ session?.organizationId ??
387
+ this.config.organizationId,
319
388
  });
320
389
  };
321
390
  this.stampListPrivateKeyTags = async (input) => {
@@ -332,9 +401,13 @@ class TurnkeySDKClientBase {
332
401
  };
333
402
  };
334
403
  this.getPrivateKeys = async (input = {}) => {
404
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
405
+ session = utils.parseSession(session);
335
406
  return this.request("/public/v1/query/list_private_keys", {
336
407
  ...input,
337
- organizationId: input.organizationId ?? this.config.organizationId,
408
+ organizationId: input.organizationId ??
409
+ session?.organizationId ??
410
+ this.config.organizationId,
338
411
  });
339
412
  };
340
413
  this.stampGetPrivateKeys = async (input) => {
@@ -351,9 +424,13 @@ class TurnkeySDKClientBase {
351
424
  };
352
425
  };
353
426
  this.getSubOrgIds = async (input = {}) => {
427
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
428
+ session = utils.parseSession(session);
354
429
  return this.request("/public/v1/query/list_suborgs", {
355
430
  ...input,
356
- organizationId: input.organizationId ?? this.config.organizationId,
431
+ organizationId: input.organizationId ??
432
+ session?.organizationId ??
433
+ this.config.organizationId,
357
434
  });
358
435
  };
359
436
  this.stampGetSubOrgIds = async (input) => {
@@ -370,9 +447,13 @@ class TurnkeySDKClientBase {
370
447
  };
371
448
  };
372
449
  this.listUserTags = async (input = {}) => {
450
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
451
+ session = utils.parseSession(session);
373
452
  return this.request("/public/v1/query/list_user_tags", {
374
453
  ...input,
375
- organizationId: input.organizationId ?? this.config.organizationId,
454
+ organizationId: input.organizationId ??
455
+ session?.organizationId ??
456
+ this.config.organizationId,
376
457
  });
377
458
  };
378
459
  this.stampListUserTags = async (input) => {
@@ -389,9 +470,13 @@ class TurnkeySDKClientBase {
389
470
  };
390
471
  };
391
472
  this.getUsers = async (input = {}) => {
473
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
474
+ session = utils.parseSession(session);
392
475
  return this.request("/public/v1/query/list_users", {
393
476
  ...input,
394
- organizationId: input.organizationId ?? this.config.organizationId,
477
+ organizationId: input.organizationId ??
478
+ session?.organizationId ??
479
+ this.config.organizationId,
395
480
  });
396
481
  };
397
482
  this.stampGetUsers = async (input) => {
@@ -408,9 +493,13 @@ class TurnkeySDKClientBase {
408
493
  };
409
494
  };
410
495
  this.getVerifiedSubOrgIds = async (input) => {
496
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
497
+ session = utils.parseSession(session);
411
498
  return this.request("/public/v1/query/list_verified_suborgs", {
412
499
  ...input,
413
- organizationId: input.organizationId ?? this.config.organizationId,
500
+ organizationId: input.organizationId ??
501
+ session?.organizationId ??
502
+ this.config.organizationId,
414
503
  });
415
504
  };
416
505
  this.stampGetVerifiedSubOrgIds = async (input) => {
@@ -427,9 +516,13 @@ class TurnkeySDKClientBase {
427
516
  };
428
517
  };
429
518
  this.getWalletAccounts = async (input) => {
519
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
520
+ session = utils.parseSession(session);
430
521
  return this.request("/public/v1/query/list_wallet_accounts", {
431
522
  ...input,
432
- organizationId: input.organizationId ?? this.config.organizationId,
523
+ organizationId: input.organizationId ??
524
+ session?.organizationId ??
525
+ this.config.organizationId,
433
526
  });
434
527
  };
435
528
  this.stampGetWalletAccounts = async (input) => {
@@ -446,9 +539,13 @@ class TurnkeySDKClientBase {
446
539
  };
447
540
  };
448
541
  this.getWallets = async (input = {}) => {
542
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
543
+ session = utils.parseSession(session);
449
544
  return this.request("/public/v1/query/list_wallets", {
450
545
  ...input,
451
- organizationId: input.organizationId ?? this.config.organizationId,
546
+ organizationId: input.organizationId ??
547
+ session?.organizationId ??
548
+ this.config.organizationId,
452
549
  });
453
550
  };
454
551
  this.stampGetWallets = async (input) => {
@@ -465,9 +562,13 @@ class TurnkeySDKClientBase {
465
562
  };
466
563
  };
467
564
  this.getWhoami = async (input = {}) => {
565
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
566
+ session = utils.parseSession(session);
468
567
  return this.request("/public/v1/query/whoami", {
469
568
  ...input,
470
- organizationId: input.organizationId ?? this.config.organizationId,
569
+ organizationId: input.organizationId ??
570
+ session?.organizationId ??
571
+ this.config.organizationId,
471
572
  });
472
573
  };
473
574
  this.stampGetWhoami = async (input) => {
@@ -485,7 +586,8 @@ class TurnkeySDKClientBase {
485
586
  };
486
587
  this.approveActivity = async (input) => {
487
588
  const { organizationId, timestampMs, ...rest } = input;
488
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
589
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
590
+ session = utils.parseSession(session);
489
591
  return this.activityDecision("/public/v1/submit/approve_activity", {
490
592
  parameters: rest,
491
593
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
@@ -508,7 +610,8 @@ class TurnkeySDKClientBase {
508
610
  };
509
611
  this.createApiKeys = async (input) => {
510
612
  const { organizationId, timestampMs, ...rest } = input;
511
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
613
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
614
+ session = utils.parseSession(session);
512
615
  return this.command("/public/v1/submit/create_api_keys", {
513
616
  parameters: rest,
514
617
  organizationId: organizationId ??
@@ -533,7 +636,8 @@ class TurnkeySDKClientBase {
533
636
  };
534
637
  this.createApiOnlyUsers = async (input) => {
535
638
  const { organizationId, timestampMs, ...rest } = input;
536
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
639
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
640
+ session = utils.parseSession(session);
537
641
  return this.command("/public/v1/submit/create_api_only_users", {
538
642
  parameters: rest,
539
643
  organizationId: organizationId ??
@@ -558,7 +662,8 @@ class TurnkeySDKClientBase {
558
662
  };
559
663
  this.createAuthenticators = async (input) => {
560
664
  const { organizationId, timestampMs, ...rest } = input;
561
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
665
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
666
+ session = utils.parseSession(session);
562
667
  return this.command("/public/v1/submit/create_authenticators", {
563
668
  parameters: rest,
564
669
  organizationId: organizationId ??
@@ -583,7 +688,8 @@ class TurnkeySDKClientBase {
583
688
  };
584
689
  this.createInvitations = async (input) => {
585
690
  const { organizationId, timestampMs, ...rest } = input;
586
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
691
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
692
+ session = utils.parseSession(session);
587
693
  return this.command("/public/v1/submit/create_invitations", {
588
694
  parameters: rest,
589
695
  organizationId: organizationId ??
@@ -608,7 +714,8 @@ class TurnkeySDKClientBase {
608
714
  };
609
715
  this.createOauthProviders = async (input) => {
610
716
  const { organizationId, timestampMs, ...rest } = input;
611
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
717
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
718
+ session = utils.parseSession(session);
612
719
  return this.command("/public/v1/submit/create_oauth_providers", {
613
720
  parameters: rest,
614
721
  organizationId: organizationId ??
@@ -633,7 +740,8 @@ class TurnkeySDKClientBase {
633
740
  };
634
741
  this.createPolicies = async (input) => {
635
742
  const { organizationId, timestampMs, ...rest } = input;
636
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
743
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
744
+ session = utils.parseSession(session);
637
745
  return this.command("/public/v1/submit/create_policies", {
638
746
  parameters: rest,
639
747
  organizationId: organizationId ??
@@ -658,7 +766,8 @@ class TurnkeySDKClientBase {
658
766
  };
659
767
  this.createPolicy = async (input) => {
660
768
  const { organizationId, timestampMs, ...rest } = input;
661
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
769
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
770
+ session = utils.parseSession(session);
662
771
  return this.command("/public/v1/submit/create_policy", {
663
772
  parameters: rest,
664
773
  organizationId: organizationId ??
@@ -683,7 +792,8 @@ class TurnkeySDKClientBase {
683
792
  };
684
793
  this.createPrivateKeyTag = async (input) => {
685
794
  const { organizationId, timestampMs, ...rest } = input;
686
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
795
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
796
+ session = utils.parseSession(session);
687
797
  return this.command("/public/v1/submit/create_private_key_tag", {
688
798
  parameters: rest,
689
799
  organizationId: organizationId ??
@@ -708,7 +818,8 @@ class TurnkeySDKClientBase {
708
818
  };
709
819
  this.createPrivateKeys = async (input) => {
710
820
  const { organizationId, timestampMs, ...rest } = input;
711
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
821
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
822
+ session = utils.parseSession(session);
712
823
  return this.command("/public/v1/submit/create_private_keys", {
713
824
  parameters: rest,
714
825
  organizationId: organizationId ??
@@ -733,7 +844,8 @@ class TurnkeySDKClientBase {
733
844
  };
734
845
  this.createReadOnlySession = async (input) => {
735
846
  const { organizationId, timestampMs, ...rest } = input;
736
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
847
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
848
+ session = utils.parseSession(session);
737
849
  return this.command("/public/v1/submit/create_read_only_session", {
738
850
  parameters: rest,
739
851
  organizationId: organizationId ??
@@ -758,7 +870,8 @@ class TurnkeySDKClientBase {
758
870
  };
759
871
  this.createReadWriteSession = async (input) => {
760
872
  const { organizationId, timestampMs, ...rest } = input;
761
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
873
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
874
+ session = utils.parseSession(session);
762
875
  return this.command("/public/v1/submit/create_read_write_session", {
763
876
  parameters: rest,
764
877
  organizationId: organizationId ??
@@ -783,7 +896,8 @@ class TurnkeySDKClientBase {
783
896
  };
784
897
  this.createSubOrganization = async (input) => {
785
898
  const { organizationId, timestampMs, ...rest } = input;
786
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
899
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
900
+ session = utils.parseSession(session);
787
901
  return this.command("/public/v1/submit/create_sub_organization", {
788
902
  parameters: rest,
789
903
  organizationId: organizationId ??
@@ -808,7 +922,8 @@ class TurnkeySDKClientBase {
808
922
  };
809
923
  this.createUserTag = async (input) => {
810
924
  const { organizationId, timestampMs, ...rest } = input;
811
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
925
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
926
+ session = utils.parseSession(session);
812
927
  return this.command("/public/v1/submit/create_user_tag", {
813
928
  parameters: rest,
814
929
  organizationId: organizationId ??
@@ -833,7 +948,8 @@ class TurnkeySDKClientBase {
833
948
  };
834
949
  this.createUsers = async (input) => {
835
950
  const { organizationId, timestampMs, ...rest } = input;
836
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
951
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
952
+ session = utils.parseSession(session);
837
953
  return this.command("/public/v1/submit/create_users", {
838
954
  parameters: rest,
839
955
  organizationId: organizationId ??
@@ -858,7 +974,8 @@ class TurnkeySDKClientBase {
858
974
  };
859
975
  this.createWallet = async (input) => {
860
976
  const { organizationId, timestampMs, ...rest } = input;
861
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
977
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
978
+ session = utils.parseSession(session);
862
979
  return this.command("/public/v1/submit/create_wallet", {
863
980
  parameters: rest,
864
981
  organizationId: organizationId ??
@@ -883,7 +1000,8 @@ class TurnkeySDKClientBase {
883
1000
  };
884
1001
  this.createWalletAccounts = async (input) => {
885
1002
  const { organizationId, timestampMs, ...rest } = input;
886
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1003
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1004
+ session = utils.parseSession(session);
887
1005
  return this.command("/public/v1/submit/create_wallet_accounts", {
888
1006
  parameters: rest,
889
1007
  organizationId: organizationId ??
@@ -908,7 +1026,8 @@ class TurnkeySDKClientBase {
908
1026
  };
909
1027
  this.deleteApiKeys = async (input) => {
910
1028
  const { organizationId, timestampMs, ...rest } = input;
911
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1029
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1030
+ session = utils.parseSession(session);
912
1031
  return this.command("/public/v1/submit/delete_api_keys", {
913
1032
  parameters: rest,
914
1033
  organizationId: organizationId ??
@@ -933,7 +1052,8 @@ class TurnkeySDKClientBase {
933
1052
  };
934
1053
  this.deleteAuthenticators = async (input) => {
935
1054
  const { organizationId, timestampMs, ...rest } = input;
936
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1055
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1056
+ session = utils.parseSession(session);
937
1057
  return this.command("/public/v1/submit/delete_authenticators", {
938
1058
  parameters: rest,
939
1059
  organizationId: organizationId ??
@@ -958,7 +1078,8 @@ class TurnkeySDKClientBase {
958
1078
  };
959
1079
  this.deleteInvitation = async (input) => {
960
1080
  const { organizationId, timestampMs, ...rest } = input;
961
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1081
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1082
+ session = utils.parseSession(session);
962
1083
  return this.command("/public/v1/submit/delete_invitation", {
963
1084
  parameters: rest,
964
1085
  organizationId: organizationId ??
@@ -983,7 +1104,8 @@ class TurnkeySDKClientBase {
983
1104
  };
984
1105
  this.deleteOauthProviders = async (input) => {
985
1106
  const { organizationId, timestampMs, ...rest } = input;
986
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1107
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1108
+ session = utils.parseSession(session);
987
1109
  return this.command("/public/v1/submit/delete_oauth_providers", {
988
1110
  parameters: rest,
989
1111
  organizationId: organizationId ??
@@ -1008,7 +1130,8 @@ class TurnkeySDKClientBase {
1008
1130
  };
1009
1131
  this.deletePolicy = async (input) => {
1010
1132
  const { organizationId, timestampMs, ...rest } = input;
1011
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1133
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1134
+ session = utils.parseSession(session);
1012
1135
  return this.command("/public/v1/submit/delete_policy", {
1013
1136
  parameters: rest,
1014
1137
  organizationId: organizationId ??
@@ -1033,7 +1156,8 @@ class TurnkeySDKClientBase {
1033
1156
  };
1034
1157
  this.deletePrivateKeyTags = async (input) => {
1035
1158
  const { organizationId, timestampMs, ...rest } = input;
1036
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1159
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1160
+ session = utils.parseSession(session);
1037
1161
  return this.command("/public/v1/submit/delete_private_key_tags", {
1038
1162
  parameters: rest,
1039
1163
  organizationId: organizationId ??
@@ -1058,7 +1182,8 @@ class TurnkeySDKClientBase {
1058
1182
  };
1059
1183
  this.deletePrivateKeys = async (input) => {
1060
1184
  const { organizationId, timestampMs, ...rest } = input;
1061
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1185
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1186
+ session = utils.parseSession(session);
1062
1187
  return this.command("/public/v1/submit/delete_private_keys", {
1063
1188
  parameters: rest,
1064
1189
  organizationId: organizationId ??
@@ -1083,7 +1208,8 @@ class TurnkeySDKClientBase {
1083
1208
  };
1084
1209
  this.deleteSubOrganization = async (input) => {
1085
1210
  const { organizationId, timestampMs, ...rest } = input;
1086
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1211
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1212
+ session = utils.parseSession(session);
1087
1213
  return this.command("/public/v1/submit/delete_sub_organization", {
1088
1214
  parameters: rest,
1089
1215
  organizationId: organizationId ??
@@ -1108,7 +1234,8 @@ class TurnkeySDKClientBase {
1108
1234
  };
1109
1235
  this.deleteUserTags = async (input) => {
1110
1236
  const { organizationId, timestampMs, ...rest } = input;
1111
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1237
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1238
+ session = utils.parseSession(session);
1112
1239
  return this.command("/public/v1/submit/delete_user_tags", {
1113
1240
  parameters: rest,
1114
1241
  organizationId: organizationId ??
@@ -1133,7 +1260,8 @@ class TurnkeySDKClientBase {
1133
1260
  };
1134
1261
  this.deleteUsers = async (input) => {
1135
1262
  const { organizationId, timestampMs, ...rest } = input;
1136
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1263
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1264
+ session = utils.parseSession(session);
1137
1265
  return this.command("/public/v1/submit/delete_users", {
1138
1266
  parameters: rest,
1139
1267
  organizationId: organizationId ??
@@ -1158,7 +1286,8 @@ class TurnkeySDKClientBase {
1158
1286
  };
1159
1287
  this.deleteWallets = async (input) => {
1160
1288
  const { organizationId, timestampMs, ...rest } = input;
1161
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1289
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1290
+ session = utils.parseSession(session);
1162
1291
  return this.command("/public/v1/submit/delete_wallets", {
1163
1292
  parameters: rest,
1164
1293
  organizationId: organizationId ??
@@ -1183,7 +1312,8 @@ class TurnkeySDKClientBase {
1183
1312
  };
1184
1313
  this.emailAuth = async (input) => {
1185
1314
  const { organizationId, timestampMs, ...rest } = input;
1186
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1315
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1316
+ session = utils.parseSession(session);
1187
1317
  return this.command("/public/v1/submit/email_auth", {
1188
1318
  parameters: rest,
1189
1319
  organizationId: organizationId ??
@@ -1208,7 +1338,8 @@ class TurnkeySDKClientBase {
1208
1338
  };
1209
1339
  this.exportPrivateKey = async (input) => {
1210
1340
  const { organizationId, timestampMs, ...rest } = input;
1211
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1341
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1342
+ session = utils.parseSession(session);
1212
1343
  return this.command("/public/v1/submit/export_private_key", {
1213
1344
  parameters: rest,
1214
1345
  organizationId: organizationId ??
@@ -1233,7 +1364,8 @@ class TurnkeySDKClientBase {
1233
1364
  };
1234
1365
  this.exportWallet = async (input) => {
1235
1366
  const { organizationId, timestampMs, ...rest } = input;
1236
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1367
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1368
+ session = utils.parseSession(session);
1237
1369
  return this.command("/public/v1/submit/export_wallet", {
1238
1370
  parameters: rest,
1239
1371
  organizationId: organizationId ??
@@ -1258,7 +1390,8 @@ class TurnkeySDKClientBase {
1258
1390
  };
1259
1391
  this.exportWalletAccount = async (input) => {
1260
1392
  const { organizationId, timestampMs, ...rest } = input;
1261
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1393
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1394
+ session = utils.parseSession(session);
1262
1395
  return this.command("/public/v1/submit/export_wallet_account", {
1263
1396
  parameters: rest,
1264
1397
  organizationId: organizationId ??
@@ -1283,7 +1416,8 @@ class TurnkeySDKClientBase {
1283
1416
  };
1284
1417
  this.importPrivateKey = async (input) => {
1285
1418
  const { organizationId, timestampMs, ...rest } = input;
1286
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1419
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1420
+ session = utils.parseSession(session);
1287
1421
  return this.command("/public/v1/submit/import_private_key", {
1288
1422
  parameters: rest,
1289
1423
  organizationId: organizationId ??
@@ -1308,7 +1442,8 @@ class TurnkeySDKClientBase {
1308
1442
  };
1309
1443
  this.importWallet = async (input) => {
1310
1444
  const { organizationId, timestampMs, ...rest } = input;
1311
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1445
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1446
+ session = utils.parseSession(session);
1312
1447
  return this.command("/public/v1/submit/import_wallet", {
1313
1448
  parameters: rest,
1314
1449
  organizationId: organizationId ??
@@ -1333,7 +1468,8 @@ class TurnkeySDKClientBase {
1333
1468
  };
1334
1469
  this.initImportPrivateKey = async (input) => {
1335
1470
  const { organizationId, timestampMs, ...rest } = input;
1336
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1471
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1472
+ session = utils.parseSession(session);
1337
1473
  return this.command("/public/v1/submit/init_import_private_key", {
1338
1474
  parameters: rest,
1339
1475
  organizationId: organizationId ??
@@ -1358,7 +1494,8 @@ class TurnkeySDKClientBase {
1358
1494
  };
1359
1495
  this.initImportWallet = async (input) => {
1360
1496
  const { organizationId, timestampMs, ...rest } = input;
1361
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1497
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1498
+ session = utils.parseSession(session);
1362
1499
  return this.command("/public/v1/submit/init_import_wallet", {
1363
1500
  parameters: rest,
1364
1501
  organizationId: organizationId ??
@@ -1381,9 +1518,36 @@ class TurnkeySDKClientBase {
1381
1518
  url: fullUrl,
1382
1519
  };
1383
1520
  };
1521
+ this.initOtp = async (input) => {
1522
+ const { organizationId, timestampMs, ...rest } = input;
1523
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1524
+ session = utils.parseSession(session);
1525
+ return this.command("/public/v1/submit/init_otp", {
1526
+ parameters: rest,
1527
+ organizationId: organizationId ??
1528
+ session?.organizationId ??
1529
+ this.config.organizationId,
1530
+ timestampMs: timestampMs ?? String(Date.now()),
1531
+ type: "ACTIVITY_TYPE_INIT_OTP",
1532
+ }, "initOtpResult");
1533
+ };
1534
+ this.stampInitOtp = async (input) => {
1535
+ if (!this.stamper) {
1536
+ return undefined;
1537
+ }
1538
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
1539
+ const body = JSON.stringify(input);
1540
+ const stamp = await this.stamper.stamp(body);
1541
+ return {
1542
+ body: body,
1543
+ stamp: stamp,
1544
+ url: fullUrl,
1545
+ };
1546
+ };
1384
1547
  this.initOtpAuth = async (input) => {
1385
1548
  const { organizationId, timestampMs, ...rest } = input;
1386
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1549
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1550
+ session = utils.parseSession(session);
1387
1551
  return this.command("/public/v1/submit/init_otp_auth", {
1388
1552
  parameters: rest,
1389
1553
  organizationId: organizationId ??
@@ -1408,7 +1572,8 @@ class TurnkeySDKClientBase {
1408
1572
  };
1409
1573
  this.initUserEmailRecovery = async (input) => {
1410
1574
  const { organizationId, timestampMs, ...rest } = input;
1411
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1575
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1576
+ session = utils.parseSession(session);
1412
1577
  return this.command("/public/v1/submit/init_user_email_recovery", {
1413
1578
  parameters: rest,
1414
1579
  organizationId: organizationId ??
@@ -1433,7 +1598,8 @@ class TurnkeySDKClientBase {
1433
1598
  };
1434
1599
  this.oauth = async (input) => {
1435
1600
  const { organizationId, timestampMs, ...rest } = input;
1436
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1601
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1602
+ session = utils.parseSession(session);
1437
1603
  return this.command("/public/v1/submit/oauth", {
1438
1604
  parameters: rest,
1439
1605
  organizationId: organizationId ??
@@ -1456,9 +1622,36 @@ class TurnkeySDKClientBase {
1456
1622
  url: fullUrl,
1457
1623
  };
1458
1624
  };
1625
+ this.oauthLogin = async (input) => {
1626
+ const { organizationId, timestampMs, ...rest } = input;
1627
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1628
+ session = utils.parseSession(session);
1629
+ return this.command("/public/v1/submit/oauth_login", {
1630
+ parameters: rest,
1631
+ organizationId: organizationId ??
1632
+ session?.organizationId ??
1633
+ this.config.organizationId,
1634
+ timestampMs: timestampMs ?? String(Date.now()),
1635
+ type: "ACTIVITY_TYPE_OAUTH_LOGIN",
1636
+ }, "oauthLoginResult");
1637
+ };
1638
+ this.stampOauthLogin = async (input) => {
1639
+ if (!this.stamper) {
1640
+ return undefined;
1641
+ }
1642
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
1643
+ const body = JSON.stringify(input);
1644
+ const stamp = await this.stamper.stamp(body);
1645
+ return {
1646
+ body: body,
1647
+ stamp: stamp,
1648
+ url: fullUrl,
1649
+ };
1650
+ };
1459
1651
  this.otpAuth = async (input) => {
1460
1652
  const { organizationId, timestampMs, ...rest } = input;
1461
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1653
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1654
+ session = utils.parseSession(session);
1462
1655
  return this.command("/public/v1/submit/otp_auth", {
1463
1656
  parameters: rest,
1464
1657
  organizationId: organizationId ??
@@ -1481,9 +1674,36 @@ class TurnkeySDKClientBase {
1481
1674
  url: fullUrl,
1482
1675
  };
1483
1676
  };
1677
+ this.otpLogin = async (input) => {
1678
+ const { organizationId, timestampMs, ...rest } = input;
1679
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1680
+ session = utils.parseSession(session);
1681
+ return this.command("/public/v1/submit/otp_login", {
1682
+ parameters: rest,
1683
+ organizationId: organizationId ??
1684
+ session?.organizationId ??
1685
+ this.config.organizationId,
1686
+ timestampMs: timestampMs ?? String(Date.now()),
1687
+ type: "ACTIVITY_TYPE_OTP_LOGIN",
1688
+ }, "otpLoginResult");
1689
+ };
1690
+ this.stampOtpLogin = async (input) => {
1691
+ if (!this.stamper) {
1692
+ return undefined;
1693
+ }
1694
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
1695
+ const body = JSON.stringify(input);
1696
+ const stamp = await this.stamper.stamp(body);
1697
+ return {
1698
+ body: body,
1699
+ stamp: stamp,
1700
+ url: fullUrl,
1701
+ };
1702
+ };
1484
1703
  this.recoverUser = async (input) => {
1485
1704
  const { organizationId, timestampMs, ...rest } = input;
1486
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1705
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1706
+ session = utils.parseSession(session);
1487
1707
  return this.command("/public/v1/submit/recover_user", {
1488
1708
  parameters: rest,
1489
1709
  organizationId: organizationId ??
@@ -1508,7 +1728,8 @@ class TurnkeySDKClientBase {
1508
1728
  };
1509
1729
  this.rejectActivity = async (input) => {
1510
1730
  const { organizationId, timestampMs, ...rest } = input;
1511
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1731
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1732
+ session = utils.parseSession(session);
1512
1733
  return this.activityDecision("/public/v1/submit/reject_activity", {
1513
1734
  parameters: rest,
1514
1735
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
@@ -1531,7 +1752,8 @@ class TurnkeySDKClientBase {
1531
1752
  };
1532
1753
  this.removeOrganizationFeature = async (input) => {
1533
1754
  const { organizationId, timestampMs, ...rest } = input;
1534
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1755
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1756
+ session = utils.parseSession(session);
1535
1757
  return this.command("/public/v1/submit/remove_organization_feature", {
1536
1758
  parameters: rest,
1537
1759
  organizationId: organizationId ??
@@ -1556,7 +1778,8 @@ class TurnkeySDKClientBase {
1556
1778
  };
1557
1779
  this.setOrganizationFeature = async (input) => {
1558
1780
  const { organizationId, timestampMs, ...rest } = input;
1559
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1781
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1782
+ session = utils.parseSession(session);
1560
1783
  return this.command("/public/v1/submit/set_organization_feature", {
1561
1784
  parameters: rest,
1562
1785
  organizationId: organizationId ??
@@ -1581,7 +1804,8 @@ class TurnkeySDKClientBase {
1581
1804
  };
1582
1805
  this.signRawPayload = async (input) => {
1583
1806
  const { organizationId, timestampMs, ...rest } = input;
1584
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1807
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1808
+ session = utils.parseSession(session);
1585
1809
  return this.command("/public/v1/submit/sign_raw_payload", {
1586
1810
  parameters: rest,
1587
1811
  organizationId: organizationId ??
@@ -1606,7 +1830,8 @@ class TurnkeySDKClientBase {
1606
1830
  };
1607
1831
  this.signRawPayloads = async (input) => {
1608
1832
  const { organizationId, timestampMs, ...rest } = input;
1609
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1833
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1834
+ session = utils.parseSession(session);
1610
1835
  return this.command("/public/v1/submit/sign_raw_payloads", {
1611
1836
  parameters: rest,
1612
1837
  organizationId: organizationId ??
@@ -1631,7 +1856,8 @@ class TurnkeySDKClientBase {
1631
1856
  };
1632
1857
  this.signTransaction = async (input) => {
1633
1858
  const { organizationId, timestampMs, ...rest } = input;
1634
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1859
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1860
+ session = utils.parseSession(session);
1635
1861
  return this.command("/public/v1/submit/sign_transaction", {
1636
1862
  parameters: rest,
1637
1863
  organizationId: organizationId ??
@@ -1654,9 +1880,36 @@ class TurnkeySDKClientBase {
1654
1880
  url: fullUrl,
1655
1881
  };
1656
1882
  };
1883
+ this.stampLogin = async (input) => {
1884
+ const { organizationId, timestampMs, ...rest } = input;
1885
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1886
+ session = utils.parseSession(session);
1887
+ return this.command("/public/v1/submit/stamp_login", {
1888
+ parameters: rest,
1889
+ organizationId: organizationId ??
1890
+ session?.organizationId ??
1891
+ this.config.organizationId,
1892
+ timestampMs: timestampMs ?? String(Date.now()),
1893
+ type: "ACTIVITY_TYPE_STAMP_LOGIN",
1894
+ }, "stampLoginResult");
1895
+ };
1896
+ this.stampStampLogin = async (input) => {
1897
+ if (!this.stamper) {
1898
+ return undefined;
1899
+ }
1900
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
1901
+ const body = JSON.stringify(input);
1902
+ const stamp = await this.stamper.stamp(body);
1903
+ return {
1904
+ body: body,
1905
+ stamp: stamp,
1906
+ url: fullUrl,
1907
+ };
1908
+ };
1657
1909
  this.updatePolicy = async (input) => {
1658
1910
  const { organizationId, timestampMs, ...rest } = input;
1659
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1911
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1912
+ session = utils.parseSession(session);
1660
1913
  return this.command("/public/v1/submit/update_policy", {
1661
1914
  parameters: rest,
1662
1915
  organizationId: organizationId ??
@@ -1681,7 +1934,8 @@ class TurnkeySDKClientBase {
1681
1934
  };
1682
1935
  this.updatePrivateKeyTag = async (input) => {
1683
1936
  const { organizationId, timestampMs, ...rest } = input;
1684
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1937
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1938
+ session = utils.parseSession(session);
1685
1939
  return this.command("/public/v1/submit/update_private_key_tag", {
1686
1940
  parameters: rest,
1687
1941
  organizationId: organizationId ??
@@ -1706,7 +1960,8 @@ class TurnkeySDKClientBase {
1706
1960
  };
1707
1961
  this.updateRootQuorum = async (input) => {
1708
1962
  const { organizationId, timestampMs, ...rest } = input;
1709
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1963
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1964
+ session = utils.parseSession(session);
1710
1965
  return this.command("/public/v1/submit/update_root_quorum", {
1711
1966
  parameters: rest,
1712
1967
  organizationId: organizationId ??
@@ -1731,7 +1986,8 @@ class TurnkeySDKClientBase {
1731
1986
  };
1732
1987
  this.updateUser = async (input) => {
1733
1988
  const { organizationId, timestampMs, ...rest } = input;
1734
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
1989
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
1990
+ session = utils.parseSession(session);
1735
1991
  return this.command("/public/v1/submit/update_user", {
1736
1992
  parameters: rest,
1737
1993
  organizationId: organizationId ??
@@ -1756,7 +2012,8 @@ class TurnkeySDKClientBase {
1756
2012
  };
1757
2013
  this.updateUserTag = async (input) => {
1758
2014
  const { organizationId, timestampMs, ...rest } = input;
1759
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
2015
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
2016
+ session = utils.parseSession(session);
1760
2017
  return this.command("/public/v1/submit/update_user_tag", {
1761
2018
  parameters: rest,
1762
2019
  organizationId: organizationId ??
@@ -1781,7 +2038,8 @@ class TurnkeySDKClientBase {
1781
2038
  };
1782
2039
  this.updateWallet = async (input) => {
1783
2040
  const { organizationId, timestampMs, ...rest } = input;
1784
- const session = await storage.getStorageValue(storage.StorageKeys.Session);
2041
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
2042
+ session = utils.parseSession(session);
1785
2043
  return this.command("/public/v1/submit/update_wallet", {
1786
2044
  parameters: rest,
1787
2045
  organizationId: organizationId ??
@@ -1804,10 +2062,40 @@ class TurnkeySDKClientBase {
1804
2062
  url: fullUrl,
1805
2063
  };
1806
2064
  };
2065
+ this.verifyOtp = async (input) => {
2066
+ const { organizationId, timestampMs, ...rest } = input;
2067
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
2068
+ session = utils.parseSession(session);
2069
+ return this.command("/public/v1/submit/verify_otp", {
2070
+ parameters: rest,
2071
+ organizationId: organizationId ??
2072
+ session?.organizationId ??
2073
+ this.config.organizationId,
2074
+ timestampMs: timestampMs ?? String(Date.now()),
2075
+ type: "ACTIVITY_TYPE_VERIFY_OTP",
2076
+ }, "verifyOtpResult");
2077
+ };
2078
+ this.stampVerifyOtp = async (input) => {
2079
+ if (!this.stamper) {
2080
+ return undefined;
2081
+ }
2082
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
2083
+ const body = JSON.stringify(input);
2084
+ const stamp = await this.stamper.stamp(body);
2085
+ return {
2086
+ body: body,
2087
+ stamp: stamp,
2088
+ url: fullUrl,
2089
+ };
2090
+ };
1807
2091
  this.testRateLimits = async (input) => {
2092
+ let session = await storage.getStorageValue(storage.StorageKeys.Session);
2093
+ session = utils.parseSession(session);
1808
2094
  return this.request("/tkhq/api/v1/test_rate_limits", {
1809
2095
  ...input,
1810
- organizationId: input.organizationId ?? this.config.organizationId,
2096
+ organizationId: input.organizationId ??
2097
+ session?.organizationId ??
2098
+ this.config.organizationId,
1811
2099
  });
1812
2100
  };
1813
2101
  this.stampTestRateLimits = async (input) => {