@turnkey/core 1.0.0-beta.5 → 1.0.0-beta.6

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 (46) hide show
  1. package/dist/__clients__/core.d.ts +71 -28
  2. package/dist/__clients__/core.d.ts.map +1 -1
  3. package/dist/__clients__/core.js +189 -88
  4. package/dist/__clients__/core.js.map +1 -1
  5. package/dist/__clients__/core.mjs +191 -90
  6. package/dist/__clients__/core.mjs.map +1 -1
  7. package/dist/__generated__/sdk-client-base.d.ts +13 -0
  8. package/dist/__generated__/sdk-client-base.d.ts.map +1 -1
  9. package/dist/__generated__/sdk-client-base.js +198 -5
  10. package/dist/__generated__/sdk-client-base.js.map +1 -1
  11. package/dist/__generated__/sdk-client-base.mjs +198 -5
  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.js +1 -1
  15. package/dist/__generated__/version.mjs +1 -1
  16. package/dist/__inputs__/public_api.types.d.ts +263 -1
  17. package/dist/__inputs__/public_api.types.d.ts.map +1 -1
  18. package/dist/__polyfills__/jest.setup.webcrypto.d.ts +2 -0
  19. package/dist/__polyfills__/jest.setup.webcrypto.d.ts.map +1 -0
  20. package/dist/__stampers__/api/base.d.ts +11 -5
  21. package/dist/__stampers__/api/base.d.ts.map +1 -1
  22. package/dist/__stampers__/api/base.js +32 -10
  23. package/dist/__stampers__/api/base.js.map +1 -1
  24. package/dist/__stampers__/api/base.mjs +32 -10
  25. package/dist/__stampers__/api/base.mjs.map +1 -1
  26. package/dist/__stampers__/api/web/stamper.d.ts.map +1 -1
  27. package/dist/__stampers__/api/web/stamper.js +2 -4
  28. package/dist/__stampers__/api/web/stamper.js.map +1 -1
  29. package/dist/__stampers__/api/web/stamper.mjs +2 -4
  30. package/dist/__stampers__/api/web/stamper.mjs.map +1 -1
  31. package/dist/__types__/base.d.ts +3 -1
  32. package/dist/__types__/base.d.ts.map +1 -1
  33. package/dist/__types__/base.js.map +1 -1
  34. package/dist/__types__/base.mjs.map +1 -1
  35. package/dist/__wallet__/stamper.d.ts.map +1 -1
  36. package/dist/__wallet__/stamper.js +7 -6
  37. package/dist/__wallet__/stamper.js.map +1 -1
  38. package/dist/__wallet__/stamper.mjs +8 -7
  39. package/dist/__wallet__/stamper.mjs.map +1 -1
  40. package/dist/utils.d.ts +27 -2
  41. package/dist/utils.d.ts.map +1 -1
  42. package/dist/utils.js +133 -2
  43. package/dist/utils.js.map +1 -1
  44. package/dist/utils.mjs +131 -6
  45. package/dist/utils.mjs.map +1 -1
  46. package/package.json +9 -8
@@ -180,6 +180,35 @@ class TurnkeySDKClientBase {
180
180
  url: fullUrl,
181
181
  };
182
182
  };
183
+ this.getOauth2Credential = async (input, stampWith) => {
184
+ const session = await this.storageManager?.getActiveSession();
185
+ return this.request("/public/v1/query/get_oauth2_credential", {
186
+ ...input,
187
+ organizationId: input.organizationId ??
188
+ session?.organizationId ??
189
+ this.config.organizationId,
190
+ }, stampWith);
191
+ };
192
+ this.stampGetOauth2Credential = async (input, stampWith) => {
193
+ const activeStamper = this.getStamper(stampWith);
194
+ if (!activeStamper) {
195
+ return undefined;
196
+ }
197
+ const { organizationId, ...parameters } = input;
198
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth2_credential";
199
+ const bodyWithType = {
200
+ parameters,
201
+ organizationId,
202
+ type: "ACTIVITY_TYPE_GET_OAUTH2CREDENTIAL",
203
+ };
204
+ const stringifiedBody = JSON.stringify(bodyWithType);
205
+ const stamp = await activeStamper.stamp(stringifiedBody);
206
+ return {
207
+ body: stringifiedBody,
208
+ stamp: stamp,
209
+ url: fullUrl,
210
+ };
211
+ };
183
212
  this.getOauthProviders = async (input, stampWith) => {
184
213
  const session = await this.storageManager?.getActiveSession();
185
214
  return this.request("/public/v1/query/get_oauth_providers", {
@@ -499,6 +528,35 @@ class TurnkeySDKClientBase {
499
528
  url: fullUrl,
500
529
  };
501
530
  };
531
+ this.listOauth2Credentials = async (input, stampWith) => {
532
+ const session = await this.storageManager?.getActiveSession();
533
+ return this.request("/public/v1/query/list_oauth2_credentials", {
534
+ ...input,
535
+ organizationId: input.organizationId ??
536
+ session?.organizationId ??
537
+ this.config.organizationId,
538
+ }, stampWith);
539
+ };
540
+ this.stampListOauth2Credentials = async (input, stampWith) => {
541
+ const activeStamper = this.getStamper(stampWith);
542
+ if (!activeStamper) {
543
+ return undefined;
544
+ }
545
+ const { organizationId, ...parameters } = input;
546
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_oauth2_credentials";
547
+ const bodyWithType = {
548
+ parameters,
549
+ organizationId,
550
+ type: "ACTIVITY_TYPE_LIST_OAUTH2CREDENTIALS",
551
+ };
552
+ const stringifiedBody = JSON.stringify(bodyWithType);
553
+ const stamp = await activeStamper.stamp(stringifiedBody);
554
+ return {
555
+ body: stringifiedBody,
556
+ stamp: stamp,
557
+ url: fullUrl,
558
+ };
559
+ };
502
560
  this.getPolicies = async (input = {}, stampWith) => {
503
561
  const session = await this.storageManager?.getActiveSession();
504
562
  return this.request("/public/v1/query/list_policies", {
@@ -984,6 +1042,39 @@ class TurnkeySDKClientBase {
984
1042
  url: fullUrl,
985
1043
  };
986
1044
  };
1045
+ this.createOauth2Credential = async (input, stampWith) => {
1046
+ const { organizationId, timestampMs, ...rest } = input;
1047
+ const session = await this.storageManager?.getActiveSession();
1048
+ return this.activity("/public/v1/submit/create_oauth2_credential", {
1049
+ parameters: rest,
1050
+ organizationId: organizationId ??
1051
+ session?.organizationId ??
1052
+ this.config.organizationId,
1053
+ timestampMs: timestampMs ?? String(Date.now()),
1054
+ type: "ACTIVITY_TYPE_CREATE_OAUTH2CREDENTIAL",
1055
+ }, "createOauth2CredentialResult", stampWith);
1056
+ };
1057
+ this.stampCreateOauth2Credential = async (input, stampWith) => {
1058
+ const activeStamper = this.getStamper(stampWith);
1059
+ if (!activeStamper) {
1060
+ return undefined;
1061
+ }
1062
+ const { organizationId, timestampMs, ...parameters } = input;
1063
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth2_credential";
1064
+ const bodyWithType = {
1065
+ parameters,
1066
+ organizationId,
1067
+ timestampMs: timestampMs ?? String(Date.now()),
1068
+ type: "ACTIVITY_TYPE_CREATE_OAUTH2CREDENTIAL",
1069
+ };
1070
+ const stringifiedBody = JSON.stringify(bodyWithType);
1071
+ const stamp = await activeStamper.stamp(stringifiedBody);
1072
+ return {
1073
+ body: stringifiedBody,
1074
+ stamp: stamp,
1075
+ url: fullUrl,
1076
+ };
1077
+ };
987
1078
  this.createOauthProviders = async (input, stampWith) => {
988
1079
  const { organizationId, timestampMs, ...rest } = input;
989
1080
  const session = await this.storageManager?.getActiveSession();
@@ -1126,7 +1217,7 @@ class TurnkeySDKClientBase {
1126
1217
  this.config.organizationId,
1127
1218
  timestampMs: timestampMs ?? String(Date.now()),
1128
1219
  type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
1129
- }, "createPrivateKeysResultV2", stampWith);
1220
+ }, "createPrivateKeysResult", stampWith);
1130
1221
  };
1131
1222
  this.stampCreatePrivateKeys = async (input, stampWith) => {
1132
1223
  const activeStamper = this.getStamper(stampWith);
@@ -1192,7 +1283,7 @@ class TurnkeySDKClientBase {
1192
1283
  this.config.organizationId,
1193
1284
  timestampMs: timestampMs ?? String(Date.now()),
1194
1285
  type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
1195
- }, "createReadWriteSessionResultV2", stampWith);
1286
+ }, "createReadWriteSessionResult", stampWith);
1196
1287
  };
1197
1288
  this.stampCreateReadWriteSession = async (input, stampWith) => {
1198
1289
  const activeStamper = this.getStamper(stampWith);
@@ -1259,7 +1350,7 @@ class TurnkeySDKClientBase {
1259
1350
  this.config.organizationId,
1260
1351
  timestampMs: timestampMs ?? String(Date.now()),
1261
1352
  type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
1262
- }, "createSubOrganizationResultV7", stampWith);
1353
+ }, "createSubOrganizationResult", stampWith);
1263
1354
  };
1264
1355
  this.stampCreateSubOrganization = async (input, stampWith) => {
1265
1356
  const activeStamper = this.getStamper(stampWith);
@@ -1513,6 +1604,39 @@ class TurnkeySDKClientBase {
1513
1604
  url: fullUrl,
1514
1605
  };
1515
1606
  };
1607
+ this.deleteOauth2Credential = async (input, stampWith) => {
1608
+ const { organizationId, timestampMs, ...rest } = input;
1609
+ const session = await this.storageManager?.getActiveSession();
1610
+ return this.activity("/public/v1/submit/delete_oauth2_credential", {
1611
+ parameters: rest,
1612
+ organizationId: organizationId ??
1613
+ session?.organizationId ??
1614
+ this.config.organizationId,
1615
+ timestampMs: timestampMs ?? String(Date.now()),
1616
+ type: "ACTIVITY_TYPE_DELETE_OAUTH2CREDENTIAL",
1617
+ }, "deleteOauth2CredentialResult", stampWith);
1618
+ };
1619
+ this.stampDeleteOauth2Credential = async (input, stampWith) => {
1620
+ const activeStamper = this.getStamper(stampWith);
1621
+ if (!activeStamper) {
1622
+ return undefined;
1623
+ }
1624
+ const { organizationId, timestampMs, ...parameters } = input;
1625
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth2_credential";
1626
+ const bodyWithType = {
1627
+ parameters,
1628
+ organizationId,
1629
+ timestampMs: timestampMs ?? String(Date.now()),
1630
+ type: "ACTIVITY_TYPE_DELETE_OAUTH2CREDENTIAL",
1631
+ };
1632
+ const stringifiedBody = JSON.stringify(bodyWithType);
1633
+ const stamp = await activeStamper.stamp(stringifiedBody);
1634
+ return {
1635
+ body: stringifiedBody,
1636
+ stamp: stamp,
1637
+ url: fullUrl,
1638
+ };
1639
+ };
1516
1640
  this.deleteOauthProviders = async (input, stampWith) => {
1517
1641
  const { organizationId, timestampMs, ...rest } = input;
1518
1642
  const session = await this.storageManager?.getActiveSession();
@@ -2151,7 +2275,7 @@ class TurnkeySDKClientBase {
2151
2275
  this.config.organizationId,
2152
2276
  timestampMs: timestampMs ?? String(Date.now()),
2153
2277
  type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
2154
- }, "initOtpAuthResultV2", stampWith);
2278
+ }, "initOtpAuthResult", stampWith);
2155
2279
  };
2156
2280
  this.stampInitOtpAuth = async (input, stampWith) => {
2157
2281
  const activeStamper = this.getStamper(stampWith);
@@ -2240,6 +2364,39 @@ class TurnkeySDKClientBase {
2240
2364
  url: fullUrl,
2241
2365
  };
2242
2366
  };
2367
+ this.oauth2Authenticate = async (input, stampWith) => {
2368
+ const { organizationId, timestampMs, ...rest } = input;
2369
+ const session = await this.storageManager?.getActiveSession();
2370
+ return this.activity("/public/v1/submit/oauth2_authenticate", {
2371
+ parameters: rest,
2372
+ organizationId: organizationId ??
2373
+ session?.organizationId ??
2374
+ this.config.organizationId,
2375
+ timestampMs: timestampMs ?? String(Date.now()),
2376
+ type: "ACTIVITY_TYPE_OAUTH2AUTHENTICATE",
2377
+ }, "oauth2AuthenticateResult", stampWith);
2378
+ };
2379
+ this.stampOauth2Authenticate = async (input, stampWith) => {
2380
+ const activeStamper = this.getStamper(stampWith);
2381
+ if (!activeStamper) {
2382
+ return undefined;
2383
+ }
2384
+ const { organizationId, timestampMs, ...parameters } = input;
2385
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth2_authenticate";
2386
+ const bodyWithType = {
2387
+ parameters,
2388
+ organizationId,
2389
+ timestampMs: timestampMs ?? String(Date.now()),
2390
+ type: "ACTIVITY_TYPE_OAUTH2AUTHENTICATE",
2391
+ };
2392
+ const stringifiedBody = JSON.stringify(bodyWithType);
2393
+ const stamp = await activeStamper.stamp(stringifiedBody);
2394
+ return {
2395
+ body: stringifiedBody,
2396
+ stamp: stamp,
2397
+ url: fullUrl,
2398
+ };
2399
+ };
2243
2400
  this.oauthLogin = async (input, stampWith) => {
2244
2401
  const { organizationId, timestampMs, ...rest } = input;
2245
2402
  const session = await this.storageManager?.getActiveSession();
@@ -2603,6 +2760,39 @@ class TurnkeySDKClientBase {
2603
2760
  url: fullUrl,
2604
2761
  };
2605
2762
  };
2763
+ this.updateOauth2Credential = async (input, stampWith) => {
2764
+ const { organizationId, timestampMs, ...rest } = input;
2765
+ const session = await this.storageManager?.getActiveSession();
2766
+ return this.activity("/public/v1/submit/update_oauth2_credential", {
2767
+ parameters: rest,
2768
+ organizationId: organizationId ??
2769
+ session?.organizationId ??
2770
+ this.config.organizationId,
2771
+ timestampMs: timestampMs ?? String(Date.now()),
2772
+ type: "ACTIVITY_TYPE_UPDATE_OAUTH2CREDENTIAL",
2773
+ }, "updateOauth2CredentialResult", stampWith);
2774
+ };
2775
+ this.stampUpdateOauth2Credential = async (input, stampWith) => {
2776
+ const activeStamper = this.getStamper(stampWith);
2777
+ if (!activeStamper) {
2778
+ return undefined;
2779
+ }
2780
+ const { organizationId, timestampMs, ...parameters } = input;
2781
+ const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_oauth2_credential";
2782
+ const bodyWithType = {
2783
+ parameters,
2784
+ organizationId,
2785
+ timestampMs: timestampMs ?? String(Date.now()),
2786
+ type: "ACTIVITY_TYPE_UPDATE_OAUTH2CREDENTIAL",
2787
+ };
2788
+ const stringifiedBody = JSON.stringify(bodyWithType);
2789
+ const stamp = await activeStamper.stamp(stringifiedBody);
2790
+ return {
2791
+ body: stringifiedBody,
2792
+ stamp: stamp,
2793
+ url: fullUrl,
2794
+ };
2795
+ };
2606
2796
  this.updatePolicy = async (input, stampWith) => {
2607
2797
  const { organizationId, timestampMs, ...rest } = input;
2608
2798
  const session = await this.storageManager?.getActiveSession();
@@ -2613,7 +2803,7 @@ class TurnkeySDKClientBase {
2613
2803
  this.config.organizationId,
2614
2804
  timestampMs: timestampMs ?? String(Date.now()),
2615
2805
  type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
2616
- }, "updatePolicyResultV2", stampWith);
2806
+ }, "updatePolicyResult", stampWith);
2617
2807
  };
2618
2808
  this.stampUpdatePolicy = async (input, stampWith) => {
2619
2809
  const activeStamper = this.getStamper(stampWith);
@@ -2965,6 +3155,9 @@ class TurnkeySDKClientBase {
2965
3155
  this.proxyGetAccount = async (input) => {
2966
3156
  return this.authProxyRequest("/v1/account", input);
2967
3157
  };
3158
+ this.proxyOAuth2Authenticate = async (input) => {
3159
+ return this.authProxyRequest("/v1/oauth2_authenticate", input);
3160
+ };
2968
3161
  this.proxyOAuthLogin = async (input) => {
2969
3162
  return this.authProxyRequest("/v1/oauth_login", input);
2970
3163
  };