@turnkey/core 1.14.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/__clients__/core.d.ts +86 -33
  2. package/dist/__clients__/core.d.ts.map +1 -1
  3. package/dist/__clients__/core.js +354 -195
  4. package/dist/__clients__/core.js.map +1 -1
  5. package/dist/__clients__/core.mjs +355 -196
  6. package/dist/__clients__/core.mjs.map +1 -1
  7. package/dist/__generated__/sdk-client-base.d.ts +8 -3
  8. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  9. package/dist/__generated__/sdk-client-base.js +117 -55
  10. package/dist/__generated__/sdk-client-base.js.map +1 -1
  11. package/dist/__generated__/sdk-client-base.mjs +112 -50
  12. package/dist/__generated__/sdk-client-base.mjs.map +1 -1
  13. package/dist/__generated__/version.d.ts +1 -1
  14. package/dist/__generated__/version.d.ts.map +1 -1
  15. package/dist/__generated__/version.js +1 -1
  16. package/dist/__generated__/version.mjs +1 -1
  17. package/dist/__stampers__/api/base.d.ts +2 -1
  18. package/dist/__stampers__/api/base.d.ts.map +1 -1
  19. package/dist/__stampers__/api/mobile/stamper.d.ts +2 -1
  20. package/dist/__stampers__/api/mobile/stamper.d.ts.map +1 -1
  21. package/dist/__stampers__/api/mobile/stamper.js.map +1 -1
  22. package/dist/__stampers__/api/mobile/stamper.mjs.map +1 -1
  23. package/dist/__stampers__/api/web/stamper.d.ts +2 -1
  24. package/dist/__stampers__/api/web/stamper.d.ts.map +1 -1
  25. package/dist/__stampers__/api/web/stamper.js.map +1 -1
  26. package/dist/__stampers__/api/web/stamper.mjs.map +1 -1
  27. package/dist/__stampers__/passkey/base.d.ts +3 -1
  28. package/dist/__stampers__/passkey/base.d.ts.map +1 -1
  29. package/dist/__stampers__/passkey/base.js +19 -0
  30. package/dist/__stampers__/passkey/base.js.map +1 -1
  31. package/dist/__stampers__/passkey/base.mjs +20 -1
  32. package/dist/__stampers__/passkey/base.mjs.map +1 -1
  33. package/dist/__types__/auth.d.ts +2 -41
  34. package/dist/__types__/auth.d.ts.map +1 -1
  35. package/dist/__types__/auth.js.map +1 -1
  36. package/dist/__types__/auth.mjs.map +1 -1
  37. package/dist/__types__/config.d.ts +3 -2
  38. package/dist/__types__/config.d.ts.map +1 -1
  39. package/dist/__types__/enums.d.ts +1 -0
  40. package/dist/__types__/enums.d.ts.map +1 -1
  41. package/dist/__types__/enums.js +1 -0
  42. package/dist/__types__/enums.js.map +1 -1
  43. package/dist/__types__/enums.mjs +1 -0
  44. package/dist/__types__/enums.mjs.map +1 -1
  45. package/dist/__types__/http.d.ts +1 -14
  46. package/dist/__types__/http.d.ts.map +1 -1
  47. package/dist/__types__/index.d.ts +0 -1
  48. package/dist/__types__/index.d.ts.map +1 -1
  49. package/dist/__types__/method-types/shared.d.ts +28 -13
  50. package/dist/__types__/method-types/shared.d.ts.map +1 -1
  51. package/dist/__wallet__/stamper.d.ts +2 -1
  52. package/dist/__wallet__/stamper.d.ts.map +1 -1
  53. package/dist/__wallet__/stamper.js.map +1 -1
  54. package/dist/__wallet__/stamper.mjs.map +1 -1
  55. package/dist/index.d.ts +1 -2
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +8 -6
  58. package/dist/index.js.map +1 -1
  59. package/dist/index.mjs +2 -4
  60. package/dist/index.mjs.map +1 -1
  61. package/dist/turnkey-helpers.d.ts +4 -0
  62. package/dist/turnkey-helpers.d.ts.map +1 -1
  63. package/dist/turnkey-helpers.js +28 -0
  64. package/dist/turnkey-helpers.js.map +1 -1
  65. package/dist/turnkey-helpers.mjs +25 -1
  66. package/dist/turnkey-helpers.mjs.map +1 -1
  67. package/dist/utils.d.ts +41 -18
  68. package/dist/utils.d.ts.map +1 -1
  69. package/dist/utils.js +126 -57
  70. package/dist/utils.js.map +1 -1
  71. package/dist/utils.mjs +100 -38
  72. package/dist/utils.mjs.map +1 -1
  73. package/package.json +7 -7
  74. package/dist/__types__/error.d.ts +0 -13
  75. package/dist/__types__/error.d.ts.map +0 -1
  76. package/dist/__types__/error.js +0 -18
  77. package/dist/__types__/error.js.map +0 -1
  78. package/dist/__types__/error.mjs +0 -16
  79. package/dist/__types__/error.mjs.map +0 -1
  80. package/dist/__types__/http.js +0 -11
  81. package/dist/__types__/http.js.map +0 -1
  82. package/dist/__types__/http.mjs +0 -9
  83. package/dist/__types__/http.mjs.map +0 -1
@@ -1,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var enums = require('../__types__/enums.js');
4
- var error = require('../__types__/error.js');
5
- var http = require('../__types__/http.js');
6
3
  var version = require('./version.js');
7
4
  var sdkTypes = require('@turnkey/sdk-types');
5
+ var enums = require('../__types__/enums.js');
8
6
 
9
7
  /* @generated by codegen. DO NOT EDIT BY HAND */
10
8
  class TurnkeySDKClientBase {
@@ -249,6 +247,36 @@ class TurnkeySDKClientBase {
249
247
  url: fullUrl,
250
248
  };
251
249
  };
250
+ this.getIpAllowlist = async (input, stampWith) => {
251
+ const session = await this.storageManager?.getActiveSession();
252
+ return this.request("/public/v1/query/get_ip_allowlist", {
253
+ ...input,
254
+ organizationId: input.organizationId ??
255
+ session?.organizationId ??
256
+ this.config.organizationId,
257
+ }, stampWith);
258
+ };
259
+ this.stampGetIpAllowlist = async (input, stampWith) => {
260
+ const activeStamper = this.getStamper(stampWith);
261
+ if (!activeStamper) {
262
+ return undefined;
263
+ }
264
+ const session = await this.storageManager?.getActiveSession();
265
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_ip_allowlist";
266
+ const body = {
267
+ ...input,
268
+ organizationId: input.organizationId ??
269
+ session?.organizationId ??
270
+ this.config.organizationId,
271
+ };
272
+ const stringifiedBody = JSON.stringify(body);
273
+ const stamp = await activeStamper.stamp(stringifiedBody);
274
+ return {
275
+ body: stringifiedBody,
276
+ stamp: stamp,
277
+ url: fullUrl,
278
+ };
279
+ };
252
280
  this.getLatestBootProof = async (input, stampWith) => {
253
281
  const session = await this.storageManager?.getActiveSession();
254
282
  return this.request("/public/v1/query/get_latest_boot_proof", {
@@ -1278,40 +1306,6 @@ class TurnkeySDKClientBase {
1278
1306
  url: fullUrl,
1279
1307
  };
1280
1308
  };
1281
- this.createApiOnlyUsers = async (input, stampWith) => {
1282
- const { organizationId, timestampMs, ...rest } = input;
1283
- const session = await this.storageManager?.getActiveSession();
1284
- return this.activity("/public/v1/submit/create_api_only_users", {
1285
- parameters: rest,
1286
- organizationId: organizationId ??
1287
- session?.organizationId ??
1288
- this.config.organizationId,
1289
- timestampMs: timestampMs ?? String(Date.now()),
1290
- type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
1291
- }, "createApiOnlyUsersResult", stampWith);
1292
- };
1293
- this.stampCreateApiOnlyUsers = async (input, stampWith) => {
1294
- const activeStamper = this.getStamper(stampWith);
1295
- if (!activeStamper) {
1296
- return undefined;
1297
- }
1298
- const { organizationId, timestampMs, ...parameters } = input;
1299
- const session = await this.storageManager?.getActiveSession();
1300
- const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_only_users";
1301
- const bodyWithType = {
1302
- parameters,
1303
- organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1304
- timestampMs: timestampMs ?? String(Date.now()),
1305
- type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
1306
- };
1307
- const stringifiedBody = JSON.stringify(bodyWithType);
1308
- const stamp = await activeStamper.stamp(stringifiedBody);
1309
- return {
1310
- body: stringifiedBody,
1311
- stamp: stamp,
1312
- url: fullUrl,
1313
- };
1314
- };
1315
1309
  this.createAuthenticators = async (input, stampWith) => {
1316
1310
  const { organizationId, timestampMs, ...rest } = input;
1317
1311
  const session = await this.storageManager?.getActiveSession();
@@ -1458,8 +1452,8 @@ class TurnkeySDKClientBase {
1458
1452
  session?.organizationId ??
1459
1453
  this.config.organizationId,
1460
1454
  timestampMs: timestampMs ?? String(Date.now()),
1461
- type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
1462
- }, "createOauthProvidersResult", stampWith);
1455
+ type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS_V2",
1456
+ }, "createOauthProvidersResultV2", stampWith);
1463
1457
  };
1464
1458
  this.stampCreateOauthProviders = async (input, stampWith) => {
1465
1459
  const activeStamper = this.getStamper(stampWith);
@@ -1473,7 +1467,7 @@ class TurnkeySDKClientBase {
1473
1467
  parameters,
1474
1468
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1475
1469
  timestampMs: timestampMs ?? String(Date.now()),
1476
- type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
1470
+ type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS_V2",
1477
1471
  };
1478
1472
  const stringifiedBody = JSON.stringify(bodyWithType);
1479
1473
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -1663,7 +1657,7 @@ class TurnkeySDKClientBase {
1663
1657
  this.config.organizationId,
1664
1658
  timestampMs: timestampMs ?? String(Date.now()),
1665
1659
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
1666
- }, "createReadWriteSessionResult", stampWith);
1660
+ }, "createReadWriteSessionResultV2", stampWith);
1667
1661
  };
1668
1662
  this.stampCreateReadWriteSession = async (input, stampWith) => {
1669
1663
  const activeStamper = this.getStamper(stampWith);
@@ -1731,8 +1725,8 @@ class TurnkeySDKClientBase {
1731
1725
  session?.organizationId ??
1732
1726
  this.config.organizationId,
1733
1727
  timestampMs: timestampMs ?? String(Date.now()),
1734
- type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1735
- }, "createSubOrganizationResultV7", stampWith);
1728
+ type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V8",
1729
+ }, "createSubOrganizationResultV8", stampWith);
1736
1730
  };
1737
1731
  this.stampCreateSubOrganization = async (input, stampWith) => {
1738
1732
  const activeStamper = this.getStamper(stampWith);
@@ -1746,7 +1740,7 @@ class TurnkeySDKClientBase {
1746
1740
  parameters,
1747
1741
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1748
1742
  timestampMs: timestampMs ?? String(Date.now()),
1749
- type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1743
+ type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V8",
1750
1744
  };
1751
1745
  const stringifiedBody = JSON.stringify(bodyWithType);
1752
1746
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -1799,7 +1793,7 @@ class TurnkeySDKClientBase {
1799
1793
  session?.organizationId ??
1800
1794
  this.config.organizationId,
1801
1795
  timestampMs: timestampMs ?? String(Date.now()),
1802
- type: "ACTIVITY_TYPE_CREATE_USERS_V3",
1796
+ type: "ACTIVITY_TYPE_CREATE_USERS_V4",
1803
1797
  }, "createUsersResult", stampWith);
1804
1798
  };
1805
1799
  this.stampCreateUsers = async (input, stampWith) => {
@@ -1814,7 +1808,7 @@ class TurnkeySDKClientBase {
1814
1808
  parameters,
1815
1809
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
1816
1810
  timestampMs: timestampMs ?? String(Date.now()),
1817
- type: "ACTIVITY_TYPE_CREATE_USERS_V3",
1811
+ type: "ACTIVITY_TYPE_CREATE_USERS_V4",
1818
1812
  };
1819
1813
  const stringifiedBody = JSON.stringify(bodyWithType);
1820
1814
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -2855,8 +2849,8 @@ class TurnkeySDKClientBase {
2855
2849
  session?.organizationId ??
2856
2850
  this.config.organizationId,
2857
2851
  timestampMs: timestampMs ?? String(Date.now()),
2858
- type: "ACTIVITY_TYPE_INIT_OTP_V2",
2859
- }, "initOtpResult", stampWith);
2852
+ type: "ACTIVITY_TYPE_INIT_OTP_V3",
2853
+ }, "initOtpResultV2", stampWith);
2860
2854
  };
2861
2855
  this.stampInitOtp = async (input, stampWith) => {
2862
2856
  const activeStamper = this.getStamper(stampWith);
@@ -2870,7 +2864,7 @@ class TurnkeySDKClientBase {
2870
2864
  parameters,
2871
2865
  organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
2872
2866
  timestampMs: timestampMs ?? String(Date.now()),
2873
- type: "ACTIVITY_TYPE_INIT_OTP_V2",
2867
+ type: "ACTIVITY_TYPE_INIT_OTP_V3",
2874
2868
  };
2875
2869
  const stringifiedBody = JSON.stringify(bodyWithType);
2876
2870
  const stamp = await activeStamper.stamp(stringifiedBody);
@@ -3186,6 +3180,40 @@ class TurnkeySDKClientBase {
3186
3180
  url: fullUrl,
3187
3181
  };
3188
3182
  };
3183
+ this.removeIpAllowlist = async (input, stampWith) => {
3184
+ const { organizationId, timestampMs, ...rest } = input;
3185
+ const session = await this.storageManager?.getActiveSession();
3186
+ return this.activity("/public/v1/submit/remove_ip_allowlist", {
3187
+ parameters: rest,
3188
+ organizationId: organizationId ??
3189
+ session?.organizationId ??
3190
+ this.config.organizationId,
3191
+ timestampMs: timestampMs ?? String(Date.now()),
3192
+ type: "ACTIVITY_TYPE_REMOVE_IP_ALLOWLIST",
3193
+ }, "removeIpAllowlistResult", stampWith);
3194
+ };
3195
+ this.stampRemoveIpAllowlist = async (input, stampWith) => {
3196
+ const activeStamper = this.getStamper(stampWith);
3197
+ if (!activeStamper) {
3198
+ return undefined;
3199
+ }
3200
+ const { organizationId, timestampMs, ...parameters } = input;
3201
+ const session = await this.storageManager?.getActiveSession();
3202
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/remove_ip_allowlist";
3203
+ const bodyWithType = {
3204
+ parameters,
3205
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3206
+ timestampMs: timestampMs ?? String(Date.now()),
3207
+ type: "ACTIVITY_TYPE_REMOVE_IP_ALLOWLIST",
3208
+ };
3209
+ const stringifiedBody = JSON.stringify(bodyWithType);
3210
+ const stamp = await activeStamper.stamp(stringifiedBody);
3211
+ return {
3212
+ body: stringifiedBody,
3213
+ stamp: stamp,
3214
+ url: fullUrl,
3215
+ };
3216
+ };
3189
3217
  this.removeOrganizationFeature = async (input, stampWith) => {
3190
3218
  const { organizationId, timestampMs, ...rest } = input;
3191
3219
  const session = await this.storageManager?.getActiveSession();
@@ -3220,6 +3248,40 @@ class TurnkeySDKClientBase {
3220
3248
  url: fullUrl,
3221
3249
  };
3222
3250
  };
3251
+ this.setIpAllowlist = async (input, stampWith) => {
3252
+ const { organizationId, timestampMs, ...rest } = input;
3253
+ const session = await this.storageManager?.getActiveSession();
3254
+ return this.activity("/public/v1/submit/set_ip_allowlist", {
3255
+ parameters: rest,
3256
+ organizationId: organizationId ??
3257
+ session?.organizationId ??
3258
+ this.config.organizationId,
3259
+ timestampMs: timestampMs ?? String(Date.now()),
3260
+ type: "ACTIVITY_TYPE_SET_IP_ALLOWLIST",
3261
+ }, "setIpAllowlistResult", stampWith);
3262
+ };
3263
+ this.stampSetIpAllowlist = async (input, stampWith) => {
3264
+ const activeStamper = this.getStamper(stampWith);
3265
+ if (!activeStamper) {
3266
+ return undefined;
3267
+ }
3268
+ const { organizationId, timestampMs, ...parameters } = input;
3269
+ const session = await this.storageManager?.getActiveSession();
3270
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/set_ip_allowlist";
3271
+ const bodyWithType = {
3272
+ parameters,
3273
+ organizationId: organizationId ?? session?.organizationId ?? this.config.organizationId,
3274
+ timestampMs: timestampMs ?? String(Date.now()),
3275
+ type: "ACTIVITY_TYPE_SET_IP_ALLOWLIST",
3276
+ };
3277
+ const stringifiedBody = JSON.stringify(bodyWithType);
3278
+ const stamp = await activeStamper.stamp(stringifiedBody);
3279
+ return {
3280
+ body: stringifiedBody,
3281
+ stamp: stamp,
3282
+ url: fullUrl,
3283
+ };
3284
+ };
3223
3285
  this.setOrganizationFeature = async (input, stampWith) => {
3224
3286
  const { organizationId, timestampMs, ...rest } = input;
3225
3287
  const session = await this.storageManager?.getActiveSession();
@@ -4001,7 +4063,7 @@ class TurnkeySDKClientBase {
4001
4063
  await this.sleep(pollingDuration);
4002
4064
  activityData = (await this.getActivity({ activityId }, stampWith));
4003
4065
  attempts++;
4004
- } while (!http.TERMINAL_ACTIVITY_STATUSES.includes(activityData.activity.status) &&
4066
+ } while (!sdkTypes.TERMINAL_ACTIVITY_STATUSES.includes(activityData.activity.status) &&
4005
4067
  attempts < maxRetries);
4006
4068
  return activityData;
4007
4069
  }
@@ -4058,7 +4120,7 @@ class TurnkeySDKClientBase {
4058
4120
  catch (_) {
4059
4121
  throw new Error(`${response.status} ${response.statusText}`);
4060
4122
  }
4061
- throw new error.TurnkeyRequestError(res);
4123
+ throw new sdkTypes.TurnkeyRequestError(res);
4062
4124
  }
4063
4125
  const data = await response.json();
4064
4126
  return data;
@@ -4067,7 +4129,7 @@ class TurnkeySDKClientBase {
4067
4129
  // Make the initial request
4068
4130
  let activityData = await this.request(url, body, stampWith);
4069
4131
  // Poll if not in terminal status
4070
- if (!http.TERMINAL_ACTIVITY_STATUSES.includes(activityData.activity.status)) {
4132
+ if (!sdkTypes.TERMINAL_ACTIVITY_STATUSES.includes(activityData.activity.status)) {
4071
4133
  activityData = await this.pollForCompletion(activityData.activity.id, stampWith);
4072
4134
  }
4073
4135
  return this.handleActivityResponse(activityData, resultKey);
@@ -4103,7 +4165,7 @@ class TurnkeySDKClientBase {
4103
4165
  catch (_) {
4104
4166
  throw new Error(`${response.status} ${response.statusText}`);
4105
4167
  }
4106
- throw new error.TurnkeyRequestError(res);
4168
+ throw new sdkTypes.TurnkeyRequestError(res);
4107
4169
  }
4108
4170
  const data = await response.json();
4109
4171
  return data;
@@ -4142,14 +4204,14 @@ class TurnkeySDKClientBase {
4142
4204
  catch (_) {
4143
4205
  throw new Error(`${response.status} ${response.statusText}`);
4144
4206
  }
4145
- throw new error.TurnkeyRequestError(res);
4207
+ throw new sdkTypes.TurnkeyRequestError(res);
4146
4208
  }
4147
4209
  const data = await response.json();
4148
4210
  // Check if this is an activity response that needs polling
4149
4211
  if (data.activity) {
4150
4212
  let activityData = data;
4151
4213
  // Poll if not in terminal status
4152
- if (!http.TERMINAL_ACTIVITY_STATUSES.includes(activityData.activity.status)) {
4214
+ if (!sdkTypes.TERMINAL_ACTIVITY_STATUSES.includes(activityData.activity.status)) {
4153
4215
  activityData = await this.pollForCompletion(activityData.activity.id);
4154
4216
  }
4155
4217
  return this.handleActivityResponse(activityData, options?.resultKey);