@cubist-labs/cubesigner-sdk 0.3.1 → 0.3.11

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 (62) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/api.d.ts +27 -9
  3. package/dist/cjs/src/api.js +58 -22
  4. package/dist/cjs/src/client.d.ts +72 -3
  5. package/dist/cjs/src/client.js +79 -2
  6. package/dist/cjs/src/error.d.ts +26 -0
  7. package/dist/cjs/src/error.js +64 -1
  8. package/dist/cjs/src/events.d.ts +31 -9
  9. package/dist/cjs/src/events.js +56 -25
  10. package/dist/cjs/src/index.js +3 -2
  11. package/dist/cjs/src/key.d.ts +19 -2
  12. package/dist/cjs/src/key.js +22 -2
  13. package/dist/cjs/src/mfa.d.ts +6 -3
  14. package/dist/cjs/src/mfa.js +8 -5
  15. package/dist/cjs/src/response.d.ts +14 -1
  16. package/dist/cjs/src/response.js +65 -26
  17. package/dist/cjs/src/role.d.ts +6 -0
  18. package/dist/cjs/src/role.js +9 -1
  19. package/dist/cjs/src/schema.d.ts +339 -45
  20. package/dist/cjs/src/schema.js +1 -1
  21. package/dist/cjs/src/schema_types.d.ts +3 -0
  22. package/dist/cjs/src/schema_types.js +1 -1
  23. package/dist/cjs/src/session/signer_session_manager.js +3 -3
  24. package/dist/cjs/src/util.js +3 -2
  25. package/dist/esm/package.json +1 -1
  26. package/dist/esm/src/api.d.ts +27 -9
  27. package/dist/esm/src/api.js +56 -20
  28. package/dist/esm/src/client.d.ts +72 -3
  29. package/dist/esm/src/client.js +79 -2
  30. package/dist/esm/src/error.d.ts +26 -0
  31. package/dist/esm/src/error.js +64 -1
  32. package/dist/esm/src/events.d.ts +31 -9
  33. package/dist/esm/src/events.js +53 -23
  34. package/dist/esm/src/index.js +2 -2
  35. package/dist/esm/src/key.d.ts +19 -2
  36. package/dist/esm/src/key.js +22 -2
  37. package/dist/esm/src/mfa.d.ts +6 -3
  38. package/dist/esm/src/mfa.js +8 -5
  39. package/dist/esm/src/response.d.ts +14 -1
  40. package/dist/esm/src/response.js +65 -26
  41. package/dist/esm/src/role.d.ts +6 -0
  42. package/dist/esm/src/role.js +9 -1
  43. package/dist/esm/src/schema.d.ts +339 -45
  44. package/dist/esm/src/schema.js +1 -1
  45. package/dist/esm/src/schema_types.d.ts +3 -0
  46. package/dist/esm/src/schema_types.js +1 -1
  47. package/dist/esm/src/session/signer_session_manager.js +3 -3
  48. package/dist/esm/src/util.js +3 -2
  49. package/package.json +1 -1
  50. package/src/api.ts +66 -19
  51. package/src/client.ts +94 -2
  52. package/src/error.ts +73 -0
  53. package/src/events.ts +53 -24
  54. package/src/key.ts +31 -2
  55. package/src/mfa.ts +8 -4
  56. package/src/response.ts +50 -4
  57. package/src/role.ts +9 -0
  58. package/src/schema.ts +597 -45
  59. package/src/schema_types.ts +3 -0
  60. package/src/session/signer_session_manager.ts +2 -2
  61. package/src/util.ts +2 -3
  62. package/tsconfig.json +3 -3
package/src/schema.ts CHANGED
@@ -192,6 +192,15 @@ export interface paths {
192
192
  */
193
193
  patch: operations["updateKey"];
194
194
  };
195
+ "/v0/org/{org_id}/keys/{key_id}/roles": {
196
+ /**
197
+ * List Key Roles
198
+ * @description List Key Roles
199
+ *
200
+ * Get all roles the key is in
201
+ */
202
+ get: operations["listKeyRoles"];
203
+ };
195
204
  "/v0/org/{org_id}/mfa": {
196
205
  /**
197
206
  * List Pending MFA Requests
@@ -211,46 +220,67 @@ export interface paths {
211
220
  */
212
221
  get: operations["mfaGet"];
213
222
  /**
214
- * Approve MFA Request
215
- * @description Approve MFA Request
223
+ * Approve or Reject MFA Request
224
+ * @description Approve or Reject MFA Request
216
225
  *
217
- * Approve request after logging in with CubeSigner. Adds the currently-logged user as an approver
226
+ * Approve or reject request after logging in with CubeSigner.
227
+ *
228
+ * If approving, adds the currently-logged user as an approver
218
229
  * of a pending MFA request of the [Status::RequiredApprovers] kind. If the required number of
219
230
  * approvers is reached, the MFA request is approved; the confirmation receipt can be used to
220
231
  * resume the original HTTP request.
232
+ *
233
+ * If rejecting, immediately deletes the pending MFA request.
221
234
  */
222
- patch: operations["mfaApproveCs"];
235
+ patch: operations["mfaVoteCs"];
223
236
  };
224
237
  "/v0/org/{org_id}/mfa/{mfa_id}/fido": {
225
238
  /**
226
- * Initiate Approving an MFA Request with FIDO
227
- * @description Initiate Approving an MFA Request with FIDO
239
+ * Initiate a FIDO MFA Approval/Rejection
240
+ * @description Initiate a FIDO MFA Approval/Rejection
228
241
  *
229
- * Initiates the approval process of an MFA Request using FIDO.
242
+ * Initiates the approval/rejection process of an MFA Request using FIDO.
230
243
  */
231
- post: operations["mfaApproveFido"];
244
+ post: operations["mfaFidoInit"];
232
245
  /**
233
- * Finalize a FIDO MFA Approval
234
- * @description Finalize a FIDO MFA Approval
235
- *
236
- * Adds an approver to a pending MFA request.
246
+ * Finalize a FIDO MFA Approval/Rejection
247
+ * @description Finalize a FIDO MFA Approval/Rejection
237
248
  *
249
+ * If approving, adds an approver to a pending MFA request.
238
250
  * If the required number of approvers is reached, the MFA request is approved;
239
251
  * the confirmation receipt can be used to resume the original HTTP request.
252
+ *
253
+ * If rejecting, immediately deletes the pending MFA request.
240
254
  */
241
- patch: operations["mfaApproveFidoComplete"];
255
+ patch: operations["mfaVoteFidoComplete"];
242
256
  };
243
257
  "/v0/org/{org_id}/mfa/{mfa_id}/totp": {
244
258
  /**
245
- * Approve a TOTP MFA Request
246
- * @description Approve a TOTP MFA Request
259
+ * Approve/Reject a TOTP MFA Request
260
+ * @description Approve/Reject a TOTP MFA Request
247
261
  *
248
- * Adds the current user as approver to a pending MFA request by providing TOTP code.
262
+ * If approving, adds the current user as approver to a pending MFA request by
263
+ * providing TOTP code. If the required number of approvers is reached, the MFA request is
264
+ * approved; the confirmation receipt can be used to resume the original HTTP request.
249
265
  *
250
- * If the required number of approvers is reached, the MFA request is approved;
251
- * the confirmation receipt can be used to resume the original HTTP request.
266
+ * If rejecting, immediately deletes the pending MFA request.
252
267
  */
253
- patch: operations["mfaApproveTotp"];
268
+ patch: operations["mfaVoteTotp"];
269
+ };
270
+ "/v0/org/{org_id}/oauth2/twitter": {
271
+ /**
272
+ * Mint an OIDC ID token for Twitter
273
+ * @description Mint an OIDC ID token for Twitter
274
+ *
275
+ * This function acts identically to Twitter's [`oauth2/token`](https://developer.twitter.com/en/docs/authentication/api-reference/token) endpoint,
276
+ * but extends the output with an `id_token`.
277
+ *
278
+ * This `id_token` can then be used with any CubeSigner endpoint that requires an OIDC token.
279
+ *
280
+ * > [!IMPORTANT]
281
+ * > This endpoint will fail unless the org is configured to allow the issuer `https://shim.oauth2.cubist.dev/twitter` and client ID being used for Twitter.
282
+ */
283
+ post: operations["oauth2Twitter"];
254
284
  };
255
285
  "/v0/org/{org_id}/oidc": {
256
286
  /**
@@ -395,6 +425,16 @@ export interface paths {
395
425
  */
396
426
  get: operations["listRoleUsers"];
397
427
  };
428
+ "/v0/org/{org_id}/roles/{role_id}/users/{user_id}": {
429
+ /**
430
+ * Remove User
431
+ * @description Remove User
432
+ *
433
+ * Removes an existing user from an existing role.
434
+ * Only users in the role or org owners can remove users from a role.
435
+ */
436
+ delete: operations["removeUserFromRole"];
437
+ };
398
438
  "/v0/org/{org_id}/session": {
399
439
  /**
400
440
  * List sessions
@@ -750,6 +790,8 @@ export interface components {
750
790
  session?: components["schemas"]["NewSessionResponse"] | null;
751
791
  };
752
792
  };
793
+ /** @enum {string} */
794
+ AcceptedValueCode: "MfaRequired";
753
795
  AddKeysToRoleRequest: {
754
796
  /**
755
797
  * @description A list of keys to add to a role
@@ -795,6 +837,11 @@ export interface components {
795
837
  identity: components["schemas"]["OIDCIdentity"];
796
838
  /** @description Optional login MFA policy */
797
839
  mfa_policy?: unknown;
840
+ /**
841
+ * @description Optional user full name
842
+ * @example Alice Wonderland
843
+ */
844
+ name?: string | null;
798
845
  role: components["schemas"]["MemberRole"];
799
846
  };
800
847
  AddThirdPartyUserResponse: {
@@ -956,6 +1003,92 @@ export interface components {
956
1003
  };
957
1004
  /** @description Wrapper around a zeroizing 32-byte fixed-size array */
958
1005
  B32: string;
1006
+ /** @enum {string} */
1007
+ BadGatewayErrorCode: "OAuthProviderError";
1008
+ /** @enum {string} */
1009
+ BadRequestErrorCode:
1010
+ | "GenericBadRequest"
1011
+ | "InvalidBody"
1012
+ | "TokenRequestError"
1013
+ | "InvalidMfaReceipt"
1014
+ | "InvalidMfaPolicyCount"
1015
+ | "InvalidMfaPolicyNumAuthFactors"
1016
+ | "InvalidMfaPolicyNumAllowedApprovers"
1017
+ | "InvalidMfaPolicyRedundantRule"
1018
+ | "InvalidCreateKeyCount"
1019
+ | "OrgInviteExistingUser"
1020
+ | "OrgNameTaken"
1021
+ | "RoleNameTaken"
1022
+ | "AddKeyToRoleCountTooHigh"
1023
+ | "InvalidKeyId"
1024
+ | "InvalidKeyMetadataLength"
1025
+ | "InvalidKeyMetadata"
1026
+ | "InvalidKeyMaterialId"
1027
+ | "KeyNotFound"
1028
+ | "UserExportDerivedKey"
1029
+ | "UserExportPublicKeyInvalid"
1030
+ | "UserExportInProgress"
1031
+ | "RoleNotFound"
1032
+ | "InvalidMfaReceiptOrgIdMissing"
1033
+ | "InvalidMfaReceiptInvalidOrgId"
1034
+ | "MfaRequestNotFound"
1035
+ | "InvalidKeyType"
1036
+ | "InvalidKeyMaterial"
1037
+ | "InvalidHexValue"
1038
+ | "InvalidBase32Value"
1039
+ | "InvalidBase58Value"
1040
+ | "InvalidForkVersionLength"
1041
+ | "InvalidEthAddress"
1042
+ | "InvalidStellarAddress"
1043
+ | "InvalidOrgNameOrId"
1044
+ | "InvalidStakeDeposit"
1045
+ | "InvalidBlobSignRequest"
1046
+ | "InvalidSolanaSignRequest"
1047
+ | "InvalidEip712SignRequest"
1048
+ | "InvalidEvmSignRequest"
1049
+ | "InvalidEth2SignRequest"
1050
+ | "InvalidDeriveKeyRequest"
1051
+ | "InvalidStakingAmount"
1052
+ | "CustomStakingAmountNotAllowedForWrapperContract"
1053
+ | "InvalidUnstakeRequest"
1054
+ | "InvalidCreateUserRequest"
1055
+ | "UserAlreadyExists"
1056
+ | "UserNotFound"
1057
+ | "PolicyRuleKeyMismatch"
1058
+ | "EmptyScopes"
1059
+ | "InvalidScopesForRoleSession"
1060
+ | "InvalidLifetime"
1061
+ | "NoSingleKeyForUser"
1062
+ | "InvalidOrgPolicyRule"
1063
+ | "SourceIpAllowlistEmpty"
1064
+ | "InvalidOrgPolicyRepeatedRule"
1065
+ | "AvaSignHashError"
1066
+ | "AvaSignError"
1067
+ | "BtcSegwitHashError"
1068
+ | "BtcSignError"
1069
+ | "Eip712SignError"
1070
+ | "InvalidMemberRoleInUserAdd"
1071
+ | "ThirdPartyUserAlreadyExists"
1072
+ | "ThirdPartyUserNotFound"
1073
+ | "DeleteOidcUserError"
1074
+ | "SessionRoleMismatch"
1075
+ | "InvalidOidcToken"
1076
+ | "OidcIssuerUnsupported"
1077
+ | "OidcIssuerNotAllowed"
1078
+ | "OidcIssuerNoApplicableJwk"
1079
+ | "FidoKeyAlreadyRegistered"
1080
+ | "FidoKeySignCountTooLow"
1081
+ | "FidoVerificationFailed"
1082
+ | "FidoChallengeMfaMismatch"
1083
+ | "UnsupportedLegacyCognitoSession"
1084
+ | "InvalidIdentityProof"
1085
+ | "PaginationDataExpired"
1086
+ | "ExistingKeysViolateExclusiveKeyAccess"
1087
+ | "ExportDelayTooShort"
1088
+ | "ExportWindowTooLong"
1089
+ | "InvalidTotpFailureLimit"
1090
+ | "InvalidEip191SignRequest"
1091
+ | "CannotResendUserInvitation";
959
1092
  /**
960
1093
  * @example {
961
1094
  * "message_base64": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTYK"
@@ -1162,6 +1295,8 @@ export interface components {
1162
1295
  configured_mfa: components["schemas"]["ConfiguredMfa"][];
1163
1296
  /** @description Set once the user successfully logs into CubeSigner */
1164
1297
  initialized: boolean;
1298
+ /** @description Optional human name for the user */
1299
+ name?: string | null;
1165
1300
  /** @description CubeSigner's user identifier */
1166
1301
  user_id: string;
1167
1302
  };
@@ -1340,6 +1475,7 @@ export interface components {
1340
1475
  /** @description The structure of ErrorResponse must match the response template that AWS uses */
1341
1476
  ErrorResponse: {
1342
1477
  accepted?: components["schemas"]["AcceptedValue"] | null;
1478
+ error_code: components["schemas"]["SignerErrorCode"];
1343
1479
  /** @description Error message */
1344
1480
  message: string;
1345
1481
  /** @description Optional request identifier */
@@ -1417,6 +1553,26 @@ export interface components {
1417
1553
  */
1418
1554
  signature: string;
1419
1555
  };
1556
+ /** @enum {string} */
1557
+ EvmTxDepositErrorCode:
1558
+ | "EvmTxDepositReceiverMismatch"
1559
+ | "EvmTxDepositEmptyData"
1560
+ | "EvmTxDepositEmptyChainId"
1561
+ | "EvmTxDepositEmptyReceiver"
1562
+ | "EvmTxDepositUnexpectedValue"
1563
+ | "EvmTxDepositUnexpectedDataLength"
1564
+ | "EvmTxDepositNoAbi"
1565
+ | "EvmTxDepositNoDepositFunction"
1566
+ | "EvmTxDepositUnexpectedFunctionName"
1567
+ | "EvmTxDepositUnexpectedValidatorKey"
1568
+ | "EvmTxDepositInvalidValidatorKey"
1569
+ | "EvmTxDepositMissingDepositArg"
1570
+ | "EvmTxDepositWrongDepositArgType"
1571
+ | "EvmTxDepositWrongValidatorArgValue"
1572
+ | "EvmTxDepositValidatorKeyNotInRole"
1573
+ | "EvmTxDepositUnexpectedWithdrawalCredentials"
1574
+ | "EvmTxDepositUnresolvedRole"
1575
+ | "EvmTxDepositInvalidDepositEncoding";
1420
1576
  /** @description Sent from the client to the server to answer a fido challenge */
1421
1577
  FidoAssertAnswer: {
1422
1578
  /** @description The ID of the challenge that was returned from the POST endpoint */
@@ -1453,6 +1609,63 @@ export interface components {
1453
1609
  */
1454
1610
  name: string;
1455
1611
  };
1612
+ /** @enum {string} */
1613
+ ForbiddenErrorCode:
1614
+ | "FidoRequiredToRemoveTotp"
1615
+ | "MfaChallengeExpired"
1616
+ | "ChainIdNotAllowed"
1617
+ | "InvalidOrg"
1618
+ | "SessionForWrongOrg"
1619
+ | "OrgDisabled"
1620
+ | "OrgNotFound"
1621
+ | "OrgWithoutOwner"
1622
+ | "OrphanedUser"
1623
+ | "OidcUserNotFound"
1624
+ | "UserNotInOrg"
1625
+ | "UserNotOrgOwner"
1626
+ | "UserNotKeyOwner"
1627
+ | "InvalidRole"
1628
+ | "DisabledRole"
1629
+ | "KeyDisabled"
1630
+ | "RoleNotInOrg"
1631
+ | "KeyNotInRole"
1632
+ | "KeyNotInOrg"
1633
+ | "UserExportRequestNotInOrg"
1634
+ | "UserExportRequestInvalid"
1635
+ | "UserNotOriginalKeyOwner"
1636
+ | "UserNotInRole"
1637
+ | "MustBeFullMember"
1638
+ | "SessionExpired"
1639
+ | "SessionRevoked"
1640
+ | "ExpectedUserSession"
1641
+ | "SessionRoleChanged"
1642
+ | "ScopedNameNotFound"
1643
+ | "SessionInvalidEpochToken"
1644
+ | "SessionInvalidRefreshToken"
1645
+ | "SessionRefreshTokenExpired"
1646
+ | "InvalidAuthHeader"
1647
+ | "SessionNotFound"
1648
+ | "InvalidArn"
1649
+ | "SessionInvalidAuthToken"
1650
+ | "SessionAuthTokenExpired"
1651
+ | "SessionPossiblyStolenToken"
1652
+ | "MfaDisallowedIdentity"
1653
+ | "MfaDisallowedApprover"
1654
+ | "MfaTypeNotAllowed"
1655
+ | "MfaNotApprovedYet"
1656
+ | "MfaConfirmationCodeMismatch"
1657
+ | "MfaHttpRequestMismatch"
1658
+ | "MfaRemoveBelowMin"
1659
+ | "TotpAlreadyConfigured"
1660
+ | "TotpConfigurationChanged"
1661
+ | "MfaTotpBadConfiguration"
1662
+ | "MfaTotpBadCode"
1663
+ | "MfaTotpRateLimit"
1664
+ | "ImproperSessionScope"
1665
+ | "FullSessionRequired"
1666
+ | "SessionWithoutAnyScopeUnder"
1667
+ | "UserRoleUnprivileged"
1668
+ | "MfaNotConfigured";
1456
1669
  /**
1457
1670
  * @description Specifies a fork of the `BeaconChain`, to prevent replay attacks.
1458
1671
  * The schema of `Fork` is defined in the [Beacon chain
@@ -1587,9 +1800,14 @@ export interface components {
1587
1800
  * @description The email associated with the user
1588
1801
  * @example user@email.com
1589
1802
  */
1590
- email: string;
1803
+ email?: string | null;
1591
1804
  exp_epoch: components["schemas"]["EpochDateTime"];
1592
1805
  identity?: components["schemas"]["OIDCIdentity"] | null;
1806
+ /**
1807
+ * @description The username (if any) associated with the user
1808
+ * @example cubistdev
1809
+ */
1810
+ preferred_username?: string | null;
1593
1811
  user_info?: components["schemas"]["CubeSignerUserInfo"] | null;
1594
1812
  } & {
1595
1813
  /** @description An opaque identifier for the proof */
@@ -1617,6 +1835,60 @@ export interface components {
1617
1835
  */
1618
1836
  salt: string;
1619
1837
  };
1838
+ /** @enum {string} */
1839
+ InternalErrorCode:
1840
+ | "SystemTimeError"
1841
+ | "ReqwestError"
1842
+ | "DbQueryError"
1843
+ | "DbGetError"
1844
+ | "DbDeleteError"
1845
+ | "DbPutError"
1846
+ | "DbUpdateError"
1847
+ | "SerdeError"
1848
+ | "TestAndSetError"
1849
+ | "DbGetItemsError"
1850
+ | "DbWriteError"
1851
+ | "CubistSignerError"
1852
+ | "CwPutMetricDataError"
1853
+ | "KmsGenerateRandomError"
1854
+ | "MalformedTotpBytes"
1855
+ | "KmsGenerateRandomNoResponseError"
1856
+ | "CreateKeyError"
1857
+ | "ParseDerivationPathError"
1858
+ | "SplitSignerError"
1859
+ | "CreateImportKeyError"
1860
+ | "CognitoDeleteUserError"
1861
+ | "CognitoListUsersError"
1862
+ | "CognitoGetUserError"
1863
+ | "MissingUserEmail"
1864
+ | "CognitoResendUserInvitation"
1865
+ | "CognitoSetUserPasswordError"
1866
+ | "GenericInternalError"
1867
+ | "OidcAuthWithoutOrg"
1868
+ | "MissingKeyMetadata"
1869
+ | "KmsKeyWithoutId"
1870
+ | "KmsEnableKeyError"
1871
+ | "KmsDisableKeyError"
1872
+ | "SerializeEncryptedExportKeyError"
1873
+ | "DeserializeEncryptedExportKeyError"
1874
+ | "ReEncryptUserExport"
1875
+ | "S3UploadError"
1876
+ | "S3DownloadError"
1877
+ | "ManagedStateMissing"
1878
+ | "InternalHeaderMissing"
1879
+ | "InvalidInternalHeaderValue"
1880
+ | "RequestLocalStateAlreadySet"
1881
+ | "OidcOrgMismatch"
1882
+ | "OrphanedRoleKeyId"
1883
+ | "OidcIssuerJwkEndpointUnavailable"
1884
+ | "OidcIssuerInvalidJwk"
1885
+ | "InvalidPkForMaterialId"
1886
+ | "UncheckedOrg"
1887
+ | "AvaSignCredsMissing"
1888
+ | "AvaSignSignatureMissing"
1889
+ | "ExpectedRoleSession"
1890
+ | "InvalidThirdPartyIdentity"
1891
+ | "CognitoGetUser";
1620
1892
  InviteRequest: {
1621
1893
  /**
1622
1894
  * @description The user's email address
@@ -1775,6 +2047,11 @@ export interface components {
1775
2047
  * ]
1776
2048
  */
1777
2049
  policy?: Record<string, never>[];
2050
+ /**
2051
+ * @description Role ID
2052
+ * @example Role#e427c28a-9c5b-49cc-a257-878aea58a22c
2053
+ */
2054
+ role_id: string;
1778
2055
  };
1779
2056
  KeyInfo: {
1780
2057
  derivation_info?: components["schemas"]["KeyDerivationInfo"] | null;
@@ -1894,6 +2171,8 @@ export interface components {
1894
2171
  },
1895
2172
  ]
1896
2173
  >;
2174
+ /** @enum {string} */
2175
+ MfaVote: "approve" | "reject";
1897
2176
  /**
1898
2177
  * @description Network name ('mainnet', 'prater', 'goerli')
1899
2178
  * @example goerli
@@ -1915,14 +2194,21 @@ export interface components {
1915
2194
  */
1916
2195
  token: string;
1917
2196
  };
2197
+ /** @enum {string} */
2198
+ NotFoundErrorCode:
2199
+ | "UriSegmentMissing"
2200
+ | "UriSegmentInvalid"
2201
+ | "TotpNotConfigured"
2202
+ | "FidoKeyNotFound"
2203
+ | "FidoChallengeNotFound"
2204
+ | "TotpChallengeNotFound"
2205
+ | "UserExportRequestNotFound"
2206
+ | "UserExportCiphertextNotFound";
1918
2207
  /**
1919
2208
  * @description Represents a globally unique OIDC-authorized user by expressing the full "path" to a user. That is:
1920
2209
  *
1921
2210
  * (iss) (sub)
1922
2211
  * Issuer -> Subresource
1923
- *
1924
- * We include a non-standard third-tier `disambiguator` which allows us to map
1925
- * a single OIDC user to multiple `User`s in CubeSigner
1926
2212
  */
1927
2213
  OIDCIdentity: {
1928
2214
  /**
@@ -2043,6 +2329,21 @@ export interface components {
2043
2329
  */
2044
2330
  "page.start"?: string | null;
2045
2331
  };
2332
+ /**
2333
+ * @description Response type that wraps another type and adds base64url-encoded encrypted `last_evaluated_key`
2334
+ * value (which can the user pass back to use as a url query parameter to continue pagination).
2335
+ */
2336
+ PaginatedListKeyRolesResponse: {
2337
+ /** @description All roles the key is in */
2338
+ roles: components["schemas"]["KeyInRoleInfo"][];
2339
+ } & {
2340
+ /**
2341
+ * @description If set, the content of `response` does not contain the entire result set.
2342
+ * To fetch the next page of the result set, call the same endpoint
2343
+ * but specify this value as the 'page.start' query parameter.
2344
+ */
2345
+ last_evaluated_key?: string | null;
2346
+ };
2046
2347
  /**
2047
2348
  * @description Response type that wraps another type and adds base64url-encoded encrypted `last_evaluated_key`
2048
2349
  * value (which can the user pass back to use as a url query parameter to continue pagination).
@@ -2131,6 +2432,42 @@ export interface components {
2131
2432
  */
2132
2433
  last_evaluated_key?: string | null;
2133
2434
  };
2435
+ PolicyErrorCode:
2436
+ | components["schemas"]["PolicyErrorOwnCodes"]
2437
+ | components["schemas"]["EvmTxDepositErrorCode"];
2438
+ /** @enum {string} */
2439
+ PolicyErrorOwnCodes:
2440
+ | "EvmTxReceiverMismatch"
2441
+ | "EvmTxSenderMismatch"
2442
+ | "PolicyDisjunctionError"
2443
+ | "PolicyNegationError"
2444
+ | "Eth2ExceededMaxUnstake"
2445
+ | "Eth2ConcurrentUnstaking"
2446
+ | "NotInIpv4Allowlist"
2447
+ | "NotInOriginAllowlist"
2448
+ | "InvalidSourceIp"
2449
+ | "RawSigningNotAllowed"
2450
+ | "Eip712SigningNotAllowed"
2451
+ | "OidcSourceNotAllowed"
2452
+ | "NoOidcAuthSourcesDefined"
2453
+ | "AddKeyToRoleDisallowed"
2454
+ | "KeysAlreadyInRole"
2455
+ | "KeyInMultipleRoles"
2456
+ | "KeyAccessError"
2457
+ | "Eip191SigningNotAllowed";
2458
+ PreconditionErrorCode:
2459
+ | components["schemas"]["PreconditionErrorOwnCodes"]
2460
+ | components["schemas"]["PolicyErrorCode"];
2461
+ /** @enum {string} */
2462
+ PreconditionErrorOwnCodes:
2463
+ | "Eth2ProposerSlotTooLow"
2464
+ | "Eth2AttestationSourceEpochTooLow"
2465
+ | "Eth2AttestationTargetEpochTooLow"
2466
+ | "Eth2ConcurrentBlockSigning"
2467
+ | "Eth2ConcurrentAttestationSigning"
2468
+ | "Eth2MultiDepositToNonGeneratedKey"
2469
+ | "Eth2MultiDepositUnknownInitialDeposit"
2470
+ | "Eth2MultiDepositWithdrawalAddressMismatch";
2134
2471
  /**
2135
2472
  * @description This type represents a wire-encodable form of the PublicKeyCredential interface
2136
2473
  * Clients may need to manually encode into this format to communicate with the server
@@ -2554,6 +2891,18 @@ export interface components {
2554
2891
  /** @description The list of sessions */
2555
2892
  sessions: components["schemas"]["SessionInfo"][];
2556
2893
  };
2894
+ SignerErrorCode:
2895
+ | components["schemas"]["SignerErrorOwnCodes"]
2896
+ | components["schemas"]["AcceptedValueCode"]
2897
+ | components["schemas"]["BadRequestErrorCode"]
2898
+ | components["schemas"]["BadGatewayErrorCode"]
2899
+ | components["schemas"]["NotFoundErrorCode"]
2900
+ | components["schemas"]["ForbiddenErrorCode"]
2901
+ | components["schemas"]["UnauthorizedErrorCode"]
2902
+ | components["schemas"]["PreconditionErrorCode"]
2903
+ | components["schemas"]["InternalErrorCode"];
2904
+ /** @enum {string} */
2905
+ SignerErrorOwnCodes: "UnhandledError" | "ProxyStartError" | "EnclaveError";
2557
2906
  /**
2558
2907
  * @example {
2559
2908
  * "message_base64": "AQABA8OKVzLEjststN4xXr39kLKHT8d58eQY1QEs6MeXwEFBrxTAlULX1troLbWxuAXQqgbQofGi6z8fJi7KAAIf7YMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJK0tn39k28s+X86W47EvbRRKnYBVQ8Q/l2m1EbfT7+vAQICAAEMAgAAAGQAAAAAAAAA"
@@ -2631,6 +2980,21 @@ export interface components {
2631
2980
  /** @description Tokens purpose */
2632
2981
  purpose: string;
2633
2982
  };
2983
+ /**
2984
+ * @description OAuth2 standard Token Response.
2985
+ *
2986
+ * https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2
2987
+ */
2988
+ TokenResponse: {
2989
+ /** @description The access token issued by the authorization server. */
2990
+ access_token: string;
2991
+ expires_in: components["schemas"]["Seconds"];
2992
+ /** @description An OIDC token issued by Cubist, containing user information */
2993
+ id_token?: string;
2994
+ /** @description The type of the token issued. Value is case insensitive. */
2995
+ token_type: string;
2996
+ [key: string]: unknown;
2997
+ };
2634
2998
  TotpApproveRequest: {
2635
2999
  /** @description TOTP verification code */
2636
3000
  code: string;
@@ -2659,6 +3023,12 @@ export interface components {
2659
3023
  /** @description The name of the issuer; defaults to "Cubist". */
2660
3024
  issuer?: string | null;
2661
3025
  };
3026
+ /** @enum {string} */
3027
+ UnauthorizedErrorCode:
3028
+ | "ClaimsHeaderMissing"
3029
+ | "ClaimsParseError"
3030
+ | "OidcIdentityHeaderMissing"
3031
+ | "OidcIdentityParseError";
2662
3032
  /** @description Options that should be set only for local devnet testing. */
2663
3033
  UnsafeConf: {
2664
3034
  /**
@@ -2974,12 +3344,20 @@ export interface components {
2974
3344
  user_id: string;
2975
3345
  };
2976
3346
  UserInfo: {
2977
- /** @example alice@example.com */
3347
+ /**
3348
+ * @description Optional email
3349
+ * @example alice@example.com
3350
+ */
2978
3351
  email: string;
2979
3352
  /** @description All multi-factor authentication methods configured for this user */
2980
3353
  mfa: components["schemas"]["ConfiguredMfa"][];
2981
3354
  /** @description MFA policy, applies before logging in and other sensitive operations */
2982
3355
  mfa_policy?: unknown;
3356
+ /**
3357
+ * @description Optional name
3358
+ * @example Alice
3359
+ */
3360
+ name?: string | null;
2983
3361
  /**
2984
3362
  * @description All organizations the user belongs to
2985
3363
  * @example [
@@ -3183,9 +3561,14 @@ export interface components {
3183
3561
  * @description The email associated with the user
3184
3562
  * @example user@email.com
3185
3563
  */
3186
- email: string;
3564
+ email?: string | null;
3187
3565
  exp_epoch: components["schemas"]["EpochDateTime"];
3188
3566
  identity?: components["schemas"]["OIDCIdentity"] | null;
3567
+ /**
3568
+ * @description The username (if any) associated with the user
3569
+ * @example cubistdev
3570
+ */
3571
+ preferred_username?: string | null;
3189
3572
  user_info?: components["schemas"]["CubeSignerUserInfo"] | null;
3190
3573
  } & {
3191
3574
  /** @description An opaque identifier for the proof */
@@ -3405,6 +3788,21 @@ export interface components {
3405
3788
  };
3406
3789
  };
3407
3790
  };
3791
+ PaginatedListKeyRolesResponse: {
3792
+ content: {
3793
+ "application/json": {
3794
+ /** @description All roles the key is in */
3795
+ roles: components["schemas"]["KeyInRoleInfo"][];
3796
+ } & {
3797
+ /**
3798
+ * @description If set, the content of `response` does not contain the entire result set.
3799
+ * To fetch the next page of the result set, call the same endpoint
3800
+ * but specify this value as the 'page.start' query parameter.
3801
+ */
3802
+ last_evaluated_key?: string | null;
3803
+ };
3804
+ };
3805
+ };
3408
3806
  PaginatedListKeysResponse: {
3409
3807
  content: {
3410
3808
  "application/json": {
@@ -3604,6 +4002,25 @@ export interface components {
3604
4002
  };
3605
4003
  };
3606
4004
  };
4005
+ /**
4006
+ * @description OAuth2 standard Token Response.
4007
+ *
4008
+ * https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2
4009
+ */
4010
+ TokenResponse: {
4011
+ content: {
4012
+ "application/json": {
4013
+ /** @description The access token issued by the authorization server. */
4014
+ access_token: string;
4015
+ expires_in: components["schemas"]["Seconds"];
4016
+ /** @description An OIDC token issued by Cubist, containing user information */
4017
+ id_token?: string;
4018
+ /** @description The type of the token issued. Value is case insensitive. */
4019
+ token_type: string;
4020
+ [key: string]: unknown;
4021
+ };
4022
+ };
4023
+ };
3607
4024
  TotpInfo: {
3608
4025
  content: {
3609
4026
  "application/json": {
@@ -3722,12 +4139,20 @@ export interface components {
3722
4139
  UserInfo: {
3723
4140
  content: {
3724
4141
  "application/json": {
3725
- /** @example alice@example.com */
4142
+ /**
4143
+ * @description Optional email
4144
+ * @example alice@example.com
4145
+ */
3726
4146
  email: string;
3727
4147
  /** @description All multi-factor authentication methods configured for this user */
3728
4148
  mfa: components["schemas"]["ConfiguredMfa"][];
3729
4149
  /** @description MFA policy, applies before logging in and other sensitive operations */
3730
4150
  mfa_policy?: unknown;
4151
+ /**
4152
+ * @description Optional name
4153
+ * @example Alice
4154
+ */
4155
+ name?: string | null;
3731
4156
  /**
3732
4157
  * @description All organizations the user belongs to
3733
4158
  * @example [
@@ -4362,6 +4787,51 @@ export interface operations {
4362
4787
  };
4363
4788
  };
4364
4789
  };
4790
+ /**
4791
+ * List Key Roles
4792
+ * @description List Key Roles
4793
+ *
4794
+ * Get all roles the key is in
4795
+ */
4796
+ listKeyRoles: {
4797
+ parameters: {
4798
+ query?: {
4799
+ /**
4800
+ * @description Max number of items to return per page.
4801
+ *
4802
+ * If the actual number of returned items may be less that this, even if there exist more
4803
+ * data in the result set. To reliably determine if more data is left in the result set,
4804
+ * inspect the [UnencryptedLastEvalKey] value in the response object.
4805
+ */
4806
+ "page.size"?: number;
4807
+ /**
4808
+ * @description The start of the page. Omit to start from the beginning; otherwise, only specify a
4809
+ * the exact value previously returned as 'last_evaluated_key' from the same endpoint.
4810
+ */
4811
+ "page.start"?: components["schemas"]["LastEvalKey"] | null;
4812
+ };
4813
+ path: {
4814
+ /**
4815
+ * @description Name or ID of the desired Org
4816
+ * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
4817
+ */
4818
+ org_id: string;
4819
+ /**
4820
+ * @description ID of the desired Key
4821
+ * @example Key#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
4822
+ */
4823
+ key_id: string;
4824
+ };
4825
+ };
4826
+ responses: {
4827
+ 200: components["responses"]["PaginatedListKeyRolesResponse"];
4828
+ default: {
4829
+ content: {
4830
+ "application/json": components["schemas"]["ErrorResponse"];
4831
+ };
4832
+ };
4833
+ };
4834
+ };
4365
4835
  /**
4366
4836
  * List Pending MFA Requests
4367
4837
  * @description List Pending MFA Requests
@@ -4419,16 +4889,23 @@ export interface operations {
4419
4889
  };
4420
4890
  };
4421
4891
  /**
4422
- * Approve MFA Request
4423
- * @description Approve MFA Request
4892
+ * Approve or Reject MFA Request
4893
+ * @description Approve or Reject MFA Request
4424
4894
  *
4425
- * Approve request after logging in with CubeSigner. Adds the currently-logged user as an approver
4895
+ * Approve or reject request after logging in with CubeSigner.
4896
+ *
4897
+ * If approving, adds the currently-logged user as an approver
4426
4898
  * of a pending MFA request of the [Status::RequiredApprovers] kind. If the required number of
4427
4899
  * approvers is reached, the MFA request is approved; the confirmation receipt can be used to
4428
4900
  * resume the original HTTP request.
4901
+ *
4902
+ * If rejecting, immediately deletes the pending MFA request.
4429
4903
  */
4430
- mfaApproveCs: {
4904
+ mfaVoteCs: {
4431
4905
  parameters: {
4906
+ query?: {
4907
+ mfa_vote?: components["schemas"]["MfaVote"] | null;
4908
+ };
4432
4909
  path: {
4433
4910
  /**
4434
4911
  * @description Name or ID of the desired Org
@@ -4452,12 +4929,12 @@ export interface operations {
4452
4929
  };
4453
4930
  };
4454
4931
  /**
4455
- * Initiate Approving an MFA Request with FIDO
4456
- * @description Initiate Approving an MFA Request with FIDO
4932
+ * Initiate a FIDO MFA Approval/Rejection
4933
+ * @description Initiate a FIDO MFA Approval/Rejection
4457
4934
  *
4458
- * Initiates the approval process of an MFA Request using FIDO.
4935
+ * Initiates the approval/rejection process of an MFA Request using FIDO.
4459
4936
  */
4460
- mfaApproveFido: {
4937
+ mfaFidoInit: {
4461
4938
  parameters: {
4462
4939
  path: {
4463
4940
  /**
@@ -4482,16 +4959,20 @@ export interface operations {
4482
4959
  };
4483
4960
  };
4484
4961
  /**
4485
- * Finalize a FIDO MFA Approval
4486
- * @description Finalize a FIDO MFA Approval
4487
- *
4488
- * Adds an approver to a pending MFA request.
4962
+ * Finalize a FIDO MFA Approval/Rejection
4963
+ * @description Finalize a FIDO MFA Approval/Rejection
4489
4964
  *
4965
+ * If approving, adds an approver to a pending MFA request.
4490
4966
  * If the required number of approvers is reached, the MFA request is approved;
4491
4967
  * the confirmation receipt can be used to resume the original HTTP request.
4968
+ *
4969
+ * If rejecting, immediately deletes the pending MFA request.
4492
4970
  */
4493
- mfaApproveFidoComplete: {
4971
+ mfaVoteFidoComplete: {
4494
4972
  parameters: {
4973
+ query?: {
4974
+ mfa_vote?: components["schemas"]["MfaVote"] | null;
4975
+ };
4495
4976
  path: {
4496
4977
  /**
4497
4978
  * @description Name or ID of the desired Org
@@ -4520,16 +5001,20 @@ export interface operations {
4520
5001
  };
4521
5002
  };
4522
5003
  /**
4523
- * Approve a TOTP MFA Request
4524
- * @description Approve a TOTP MFA Request
5004
+ * Approve/Reject a TOTP MFA Request
5005
+ * @description Approve/Reject a TOTP MFA Request
4525
5006
  *
4526
- * Adds the current user as approver to a pending MFA request by providing TOTP code.
5007
+ * If approving, adds the current user as approver to a pending MFA request by
5008
+ * providing TOTP code. If the required number of approvers is reached, the MFA request is
5009
+ * approved; the confirmation receipt can be used to resume the original HTTP request.
4527
5010
  *
4528
- * If the required number of approvers is reached, the MFA request is approved;
4529
- * the confirmation receipt can be used to resume the original HTTP request.
5011
+ * If rejecting, immediately deletes the pending MFA request.
4530
5012
  */
4531
- mfaApproveTotp: {
5013
+ mfaVoteTotp: {
4532
5014
  parameters: {
5015
+ query?: {
5016
+ mfa_vote?: components["schemas"]["MfaVote"] | null;
5017
+ };
4533
5018
  path: {
4534
5019
  /**
4535
5020
  * @description Name or ID of the desired Org
@@ -4557,6 +5042,44 @@ export interface operations {
4557
5042
  };
4558
5043
  };
4559
5044
  };
5045
+ /**
5046
+ * Mint an OIDC ID token for Twitter
5047
+ * @description Mint an OIDC ID token for Twitter
5048
+ *
5049
+ * This function acts identically to Twitter's [`oauth2/token`](https://developer.twitter.com/en/docs/authentication/api-reference/token) endpoint,
5050
+ * but extends the output with an `id_token`.
5051
+ *
5052
+ * This `id_token` can then be used with any CubeSigner endpoint that requires an OIDC token.
5053
+ *
5054
+ * > [!IMPORTANT]
5055
+ * > This endpoint will fail unless the org is configured to allow the issuer `https://shim.oauth2.cubist.dev/twitter` and client ID being used for Twitter.
5056
+ */
5057
+ oauth2Twitter: {
5058
+ parameters: {
5059
+ path: {
5060
+ /**
5061
+ * @description Name or ID of the desired Org
5062
+ * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
5063
+ */
5064
+ org_id: string;
5065
+ };
5066
+ };
5067
+ requestBody: {
5068
+ content: {
5069
+ "application/json": {
5070
+ [key: string]: string;
5071
+ };
5072
+ };
5073
+ };
5074
+ responses: {
5075
+ 200: components["responses"]["TokenResponse"];
5076
+ default: {
5077
+ content: {
5078
+ "application/json": components["schemas"]["ErrorResponse"];
5079
+ };
5080
+ };
5081
+ };
5082
+ };
4560
5083
  /**
4561
5084
  * Login with OIDC
4562
5085
  * @description Login with OIDC
@@ -5082,6 +5605,35 @@ export interface operations {
5082
5605
  };
5083
5606
  };
5084
5607
  };
5608
+ /**
5609
+ * Remove User
5610
+ * @description Remove User
5611
+ *
5612
+ * Removes an existing user from an existing role.
5613
+ * Only users in the role or org owners can remove users from a role.
5614
+ */
5615
+ removeUserFromRole: {
5616
+ parameters: {
5617
+ path: {
5618
+ /**
5619
+ * @description Name or ID of the desired Org
5620
+ * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
5621
+ */
5622
+ org_id: string;
5623
+ /**
5624
+ * @description Name or ID of the desired Role
5625
+ * @example Role#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
5626
+ */
5627
+ role_id: string;
5628
+ /**
5629
+ * @description ID of the desired User
5630
+ * @example User#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
5631
+ */
5632
+ user_id: string;
5633
+ };
5634
+ };
5635
+ responses: {};
5636
+ };
5085
5637
  /**
5086
5638
  * List sessions
5087
5639
  * @description List sessions