@cubist-labs/cubesigner-sdk 0.3.13 → 0.3.19

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 (42) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/package.json +2 -2
  3. package/dist/cjs/src/api.d.ts +50 -5
  4. package/dist/cjs/src/api.js +71 -20
  5. package/dist/cjs/src/client.d.ts +4 -0
  6. package/dist/cjs/src/error.d.ts +2 -0
  7. package/dist/cjs/src/error.js +1 -1
  8. package/dist/cjs/src/evm/index.d.ts +74 -0
  9. package/dist/cjs/src/evm/index.js +165 -0
  10. package/dist/cjs/src/index.d.ts +2 -0
  11. package/dist/cjs/src/index.js +3 -1
  12. package/dist/cjs/src/org.d.ts +8 -1
  13. package/dist/cjs/src/org.js +11 -1
  14. package/dist/cjs/src/schema.d.ts +117 -7
  15. package/dist/cjs/src/schema.js +1 -1
  16. package/dist/cjs/src/schema_types.d.ts +3 -1
  17. package/dist/cjs/src/schema_types.js +1 -1
  18. package/dist/esm/package.json +2 -2
  19. package/dist/esm/src/api.d.ts +50 -5
  20. package/dist/esm/src/api.js +72 -21
  21. package/dist/esm/src/client.d.ts +4 -0
  22. package/dist/esm/src/error.d.ts +2 -0
  23. package/dist/esm/src/error.js +1 -1
  24. package/dist/esm/src/evm/index.d.ts +74 -0
  25. package/dist/esm/src/evm/index.js +161 -0
  26. package/dist/esm/src/index.d.ts +2 -0
  27. package/dist/esm/src/index.js +3 -1
  28. package/dist/esm/src/org.d.ts +8 -1
  29. package/dist/esm/src/org.js +12 -2
  30. package/dist/esm/src/schema.d.ts +117 -7
  31. package/dist/esm/src/schema.js +1 -1
  32. package/dist/esm/src/schema_types.d.ts +3 -1
  33. package/dist/esm/src/schema_types.js +1 -1
  34. package/package.json +2 -2
  35. package/src/api.ts +96 -19
  36. package/src/error.ts +2 -0
  37. package/src/evm/index.ts +192 -0
  38. package/src/index.ts +2 -0
  39. package/src/org.ts +17 -1
  40. package/src/schema.ts +134 -7
  41. package/src/schema_types.ts +3 -1
  42. package/tsconfig.json +3 -3
@@ -283,7 +283,12 @@ export interface paths {
283
283
  * Login with OIDC
284
284
  * @description Login with OIDC
285
285
  *
286
- * Exchange an OIDC ID token (passed via the `Authorization` header) for a signer session
286
+ * Exchange an OIDC ID token (passed via the `Authorization` header) for a signer session.
287
+ *
288
+ * MFA is required when:
289
+ * - an MFA policy is explicitly attached to the user logging in
290
+ * (e.g., an org owner can do that at user creation time to require certain kind of MFA)
291
+ * - the user has at least 1 MFA factor configured
287
292
  */
288
293
  post: operations["oidcAuth"];
289
294
  };
@@ -1000,7 +1005,7 @@ export interface components {
1000
1005
  /** @enum {string} */
1001
1006
  BadGatewayErrorCode: "OAuthProviderError";
1002
1007
  /** @enum {string} */
1003
- BadRequestErrorCode: "GenericBadRequest" | "InvalidBody" | "TokenRequestError" | "InvalidMfaReceipt" | "InvalidMfaPolicyCount" | "InvalidMfaPolicyNumAuthFactors" | "InvalidMfaPolicyNumAllowedApprovers" | "InvalidMfaPolicyRedundantRule" | "InvalidCreateKeyCount" | "OrgInviteExistingUser" | "OrgNameTaken" | "RoleNameTaken" | "AddKeyToRoleCountTooHigh" | "InvalidKeyId" | "InvalidKeyMetadataLength" | "InvalidKeyMetadata" | "InvalidKeyMaterialId" | "KeyNotFound" | "UserExportDerivedKey" | "UserExportPublicKeyInvalid" | "UserExportInProgress" | "RoleNotFound" | "InvalidMfaReceiptOrgIdMissing" | "InvalidMfaReceiptInvalidOrgId" | "MfaRequestNotFound" | "InvalidKeyType" | "InvalidKeyMaterial" | "InvalidHexValue" | "InvalidBase32Value" | "InvalidBase58Value" | "InvalidForkVersionLength" | "InvalidEthAddress" | "InvalidStellarAddress" | "InvalidOrgNameOrId" | "InvalidStakeDeposit" | "InvalidBlobSignRequest" | "InvalidSolanaSignRequest" | "InvalidEip712SignRequest" | "InvalidEvmSignRequest" | "InvalidEth2SignRequest" | "InvalidDeriveKeyRequest" | "InvalidStakingAmount" | "CustomStakingAmountNotAllowedForWrapperContract" | "InvalidUnstakeRequest" | "InvalidCreateUserRequest" | "UserAlreadyExists" | "UserNotFound" | "PolicyRuleKeyMismatch" | "EmptyScopes" | "InvalidScopesForRoleSession" | "InvalidLifetime" | "NoSingleKeyForUser" | "InvalidOrgPolicyRule" | "SourceIpAllowlistEmpty" | "InvalidOrgPolicyRepeatedRule" | "AvaSignHashError" | "AvaSignError" | "BtcSegwitHashError" | "BtcSignError" | "Eip712SignError" | "InvalidMemberRoleInUserAdd" | "ThirdPartyUserAlreadyExists" | "ThirdPartyUserNotFound" | "DeleteOidcUserError" | "SessionRoleMismatch" | "InvalidOidcToken" | "OidcIssuerUnsupported" | "OidcIssuerNotAllowed" | "OidcIssuerNoApplicableJwk" | "FidoKeyAlreadyRegistered" | "FidoKeySignCountTooLow" | "FidoVerificationFailed" | "FidoChallengeMfaMismatch" | "UnsupportedLegacyCognitoSession" | "InvalidIdentityProof" | "PaginationDataExpired" | "ExistingKeysViolateExclusiveKeyAccess" | "ExportDelayTooShort" | "ExportWindowTooLong" | "InvalidTotpFailureLimit" | "InvalidEip191SignRequest" | "CannotResendUserInvitation";
1008
+ BadRequestErrorCode: "GenericBadRequest" | "InvalidBody" | "TokenRequestError" | "InvalidMfaReceipt" | "InvalidMfaPolicyCount" | "InvalidMfaPolicyNumAuthFactors" | "InvalidMfaPolicyNumAllowedApprovers" | "InvalidMfaPolicyRedundantRule" | "InvalidCreateKeyCount" | "OrgInviteExistingUser" | "OrgNameTaken" | "RoleNameTaken" | "AddKeyToRoleCountTooHigh" | "InvalidKeyId" | "InvalidKeyMetadataLength" | "InvalidKeyMetadata" | "InvalidKeyMaterialId" | "KeyNotFound" | "UserExportDerivedKey" | "UserExportPublicKeyInvalid" | "UserExportInProgress" | "RoleNotFound" | "InvalidMfaReceiptOrgIdMissing" | "InvalidMfaReceiptInvalidOrgId" | "MfaRequestNotFound" | "InvalidKeyType" | "InvalidKeyMaterial" | "InvalidHexValue" | "InvalidBase32Value" | "InvalidBase58Value" | "InvalidForkVersionLength" | "InvalidEthAddress" | "InvalidStellarAddress" | "InvalidOrgNameOrId" | "InvalidStakeDeposit" | "InvalidBlobSignRequest" | "InvalidSolanaSignRequest" | "InvalidEip712SignRequest" | "InvalidEvmSignRequest" | "InvalidEth2SignRequest" | "InvalidDeriveKeyRequest" | "InvalidStakingAmount" | "CustomStakingAmountNotAllowedForWrapperContract" | "InvalidUnstakeRequest" | "InvalidCreateUserRequest" | "UserAlreadyExists" | "UserNotFound" | "PolicyRuleKeyMismatch" | "EmptyScopes" | "InvalidScopesForRoleSession" | "InvalidLifetime" | "NoSingleKeyForUser" | "InvalidOrgPolicyRule" | "SourceIpAllowlistEmpty" | "InvalidOrgPolicyRepeatedRule" | "AvaSignHashError" | "AvaSignError" | "BtcSegwitHashError" | "BtcSignError" | "Eip712SignError" | "InvalidMemberRoleInUserAdd" | "ThirdPartyUserAlreadyExists" | "ThirdPartyUserNotFound" | "DeleteOidcUserError" | "SessionRoleMismatch" | "InvalidOidcToken" | "OidcIssuerUnsupported" | "OidcIssuerNotAllowed" | "OidcIssuerNoApplicableJwk" | "FidoKeyAlreadyRegistered" | "FidoKeySignCountTooLow" | "FidoVerificationFailed" | "FidoChallengeMfaMismatch" | "UnsupportedLegacyCognitoSession" | "InvalidIdentityProof" | "PaginationDataExpired" | "ExistingKeysViolateExclusiveKeyAccess" | "ExportDelayTooShort" | "ExportWindowTooLong" | "InvalidTotpFailureLimit" | "InvalidEip191SignRequest" | "CannotResendUserInvitation" | "InvalidNotificationEndpointCount" | "InvalidNotificationUrlProtocol" | "EmptyOneOfOrgEventFilter";
1004
1009
  /**
1005
1010
  * @example {
1006
1011
  * "message_base64": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTYK"
@@ -1548,7 +1553,7 @@ export interface components {
1548
1553
  };
1549
1554
  GetUsersInOrgResponse: {
1550
1555
  /** @description The list of users in the org */
1551
- users: components["schemas"]["UserIdInfo"][];
1556
+ users: components["schemas"]["UserInOrgInfo"][];
1552
1557
  };
1553
1558
  /** @description Stats pertaining the the sender `cube3signer` instance */
1554
1559
  HeartbeatRequest: {
@@ -1667,7 +1672,7 @@ export interface components {
1667
1672
  salt: string;
1668
1673
  };
1669
1674
  /** @enum {string} */
1670
- InternalErrorCode: "SystemTimeError" | "ReqwestError" | "DbQueryError" | "DbGetError" | "DbDeleteError" | "DbPutError" | "DbUpdateError" | "SerdeError" | "TestAndSetError" | "DbGetItemsError" | "DbWriteError" | "CubistSignerError" | "CwPutMetricDataError" | "KmsGenerateRandomError" | "MalformedTotpBytes" | "KmsGenerateRandomNoResponseError" | "CreateKeyError" | "ParseDerivationPathError" | "SplitSignerError" | "CreateImportKeyError" | "CognitoDeleteUserError" | "CognitoListUsersError" | "CognitoGetUserError" | "MissingUserEmail" | "CognitoResendUserInvitation" | "CognitoSetUserPasswordError" | "GenericInternalError" | "OidcAuthWithoutOrg" | "MissingKeyMetadata" | "KmsKeyWithoutId" | "KmsEnableKeyError" | "KmsDisableKeyError" | "SerializeEncryptedExportKeyError" | "DeserializeEncryptedExportKeyError" | "ReEncryptUserExport" | "S3UploadError" | "S3DownloadError" | "ManagedStateMissing" | "InternalHeaderMissing" | "InvalidInternalHeaderValue" | "RequestLocalStateAlreadySet" | "OidcOrgMismatch" | "OrphanedRoleKeyId" | "OidcIssuerJwkEndpointUnavailable" | "OidcIssuerInvalidJwk" | "InvalidPkForMaterialId" | "UncheckedOrg" | "AvaSignCredsMissing" | "AvaSignSignatureMissing" | "ExpectedRoleSession" | "InvalidThirdPartyIdentity" | "CognitoGetUser";
1675
+ InternalErrorCode: "SystemTimeError" | "ReqwestError" | "DbQueryError" | "DbGetError" | "DbDeleteError" | "DbPutError" | "DbUpdateError" | "SerdeError" | "TestAndSetError" | "DbGetItemsError" | "DbWriteError" | "CubistSignerError" | "CwPutMetricDataError" | "KmsGenerateRandomError" | "MalformedTotpBytes" | "KmsGenerateRandomNoResponseError" | "CreateKeyError" | "ParseDerivationPathError" | "SplitSignerError" | "CreateImportKeyError" | "CognitoDeleteUserError" | "CognitoListUsersError" | "CognitoGetUserError" | "MissingUserEmail" | "CognitoResendUserInvitation" | "CognitoSetUserPasswordError" | "GenericInternalError" | "OidcAuthWithoutOrg" | "MissingKeyMetadata" | "KmsKeyWithoutId" | "KmsEnableKeyError" | "KmsDisableKeyError" | "SerializeEncryptedExportKeyError" | "DeserializeEncryptedExportKeyError" | "ReEncryptUserExport" | "S3UploadError" | "S3DownloadError" | "ManagedStateMissing" | "InternalHeaderMissing" | "InvalidInternalHeaderValue" | "RequestLocalStateAlreadySet" | "OidcOrgMismatch" | "OrphanedRoleKeyId" | "OidcIssuerJwkEndpointUnavailable" | "OidcIssuerInvalidJwk" | "InvalidPkForMaterialId" | "UncheckedOrg" | "AvaSignCredsMissing" | "AvaSignSignatureMissing" | "ExpectedRoleSession" | "InvalidThirdPartyIdentity" | "CognitoGetUser" | "SnsSubscribeError" | "SnsUnsubscribeError" | "SnsPublishBatchError";
1671
1676
  InviteRequest: {
1672
1677
  /**
1673
1678
  * @description The user's email address
@@ -1956,6 +1961,12 @@ export interface components {
1956
1961
  };
1957
1962
  /** @enum {string} */
1958
1963
  NotFoundErrorCode: "UriSegmentMissing" | "UriSegmentInvalid" | "TotpNotConfigured" | "FidoKeyNotFound" | "FidoChallengeNotFound" | "TotpChallengeNotFound" | "UserExportRequestNotFound" | "UserExportCiphertextNotFound";
1964
+ /** @description The configuration for an org event endpoint */
1965
+ NotificationEndpointConfiguration: {
1966
+ filter?: components["schemas"]["OrgEventFilter"];
1967
+ /** @description URL of the endpoint */
1968
+ url: string;
1969
+ };
1959
1970
  /**
1960
1971
  * @description Represents a globally unique OIDC-authorized user by expressing the full "path" to a user. That is:
1961
1972
  *
@@ -1996,6 +2007,19 @@ export interface components {
1996
2007
  scopes: string[];
1997
2008
  tokens?: components["schemas"]["RatchetConfig"];
1998
2009
  };
2010
+ /**
2011
+ * @description Auto-generated discriminant enum variants
2012
+ * @enum {string}
2013
+ */
2014
+ OrgEventDiscriminants: "OidcAuth" | "Eth2ConcurrentAttestationSigning" | "Eth2ConcurrentBlockSigning" | "Eth2InvalidBlockProposerSlotTooLow" | "Eth2InvalidAttestationSourceEpochTooLow" | "Eth2InvalidAttestationTargetEpochTooLow" | "Eth2Unstake" | "Eth2ExceededMaxUnstake" | "MfaRejected";
2015
+ /** @description Filter for org events */
2016
+ OrgEventFilter: OneOf<[
2017
+ "All",
2018
+ {
2019
+ /** @description Only accepts org events that are one of the listed events */
2020
+ OneOf: components["schemas"]["OrgEventDiscriminants"][];
2021
+ }
2022
+ ]>;
1999
2023
  OrgInfo: {
2000
2024
  /** @description When false, all cryptographic operations involving keys in this org are disabled. */
2001
2025
  enabled: boolean;
@@ -2022,6 +2046,17 @@ export interface components {
2022
2046
  * @example my_org_name
2023
2047
  */
2024
2048
  name?: string | null;
2049
+ /**
2050
+ * @description The organization's notification endpoints, which are HTTPS URLs are notified about a
2051
+ * configurable set of events in an organization. For each event, CubeSigner sends a POST
2052
+ * request with a JSON-formatted body that contains the event details.
2053
+ * @example [
2054
+ * {
2055
+ * "url": "https://example.com/endpoint"
2056
+ * }
2057
+ * ]
2058
+ */
2059
+ notification_endpoints?: Record<string, never>[];
2025
2060
  /**
2026
2061
  * @description The ID of the organization
2027
2062
  * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
@@ -2836,6 +2871,44 @@ export interface components {
2836
2871
  * @example my_org
2837
2872
  */
2838
2873
  name?: string | null;
2874
+ /**
2875
+ * @description If set, update this org's notification endpoints. Notification endpoints are expected to be
2876
+ * HTTPS URLs, which accept POST requests. The body of the requests sent to these endpoints are
2877
+ * are formatted in JSON and have the following format:
2878
+ *
2879
+ * ```json
2880
+ * {
2881
+ * "org": "...",
2882
+ * "utc_timestamp": "...",
2883
+ * "org_event": "...",
2884
+ * ...
2885
+ * }
2886
+ * ```
2887
+ *
2888
+ * `org` is the org id, `utc_timestamp` is the UTC timestamp of the event in milliseconds, and
2889
+ * `org_event` is a string identifying the type of event that has occurred. The rest of the
2890
+ * fields provide additional information related to the type of the event.
2891
+ *
2892
+ * Endpoints can optionally include filters to customize the org events that they are notified
2893
+ * about. Currently, the only supported filter type is `OneOf`, which expects a list of org
2894
+ * event types to send to the endpoint. If no filter is configured, the system sends all org
2895
+ * events to the endpoint.
2896
+ * @example [
2897
+ * {
2898
+ * "url:": "https://example.com/endpoint1"
2899
+ * },
2900
+ * {
2901
+ * "filter": {
2902
+ * "OneOf": [
2903
+ * "Eth2ConcurrentAttestationSigning",
2904
+ * "Eth2ConcurrentBlockSigning"
2905
+ * ]
2906
+ * },
2907
+ * "url:": "https://example.com/endpoint2"
2908
+ * }
2909
+ * ]
2910
+ */
2911
+ notification_endpoints?: Record<string, never>[] | null;
2839
2912
  /**
2840
2913
  * @description If set, update this org's policies (old policies will be overwritten!).
2841
2914
  * @example [
@@ -2888,6 +2961,15 @@ export interface components {
2888
2961
  * @example my_org_name
2889
2962
  */
2890
2963
  name?: string | null;
2964
+ /**
2965
+ * @description The new notification endpoint configurations
2966
+ * @example [
2967
+ * {
2968
+ * "url": "https://example.com/endpoint"
2969
+ * }
2970
+ * ]
2971
+ */
2972
+ notification_endpoints?: Record<string, never>[];
2891
2973
  /**
2892
2974
  * @description The ID of the organization
2893
2975
  * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
@@ -3035,7 +3117,7 @@ export interface components {
3035
3117
  public_key_hash?: string | null;
3036
3118
  valid_epoch: components["schemas"]["EpochDateTime"];
3037
3119
  };
3038
- UserIdInfo: {
3120
+ UserInOrgInfo: {
3039
3121
  /**
3040
3122
  * @description The user's email
3041
3123
  * @example alice@example.com
@@ -3046,6 +3128,9 @@ export interface components {
3046
3128
  * @example User#c3b9379c-4e8c-4216-bd0a-65ace53cf98f
3047
3129
  */
3048
3130
  id: string;
3131
+ membership: components["schemas"]["MemberRole"];
3132
+ /** @description Optional user name. */
3133
+ name?: string | null;
3049
3134
  };
3050
3135
  UserInRoleInfo: {
3051
3136
  user_id: string;
@@ -3247,7 +3332,7 @@ export interface components {
3247
3332
  content: {
3248
3333
  "application/json": {
3249
3334
  /** @description The list of users in the org */
3250
- users: components["schemas"]["UserIdInfo"][];
3335
+ users: components["schemas"]["UserInOrgInfo"][];
3251
3336
  };
3252
3337
  };
3253
3338
  };
@@ -3455,6 +3540,17 @@ export interface components {
3455
3540
  * @example my_org_name
3456
3541
  */
3457
3542
  name?: string | null;
3543
+ /**
3544
+ * @description The organization's notification endpoints, which are HTTPS URLs are notified about a
3545
+ * configurable set of events in an organization. For each event, CubeSigner sends a POST
3546
+ * request with a JSON-formatted body that contains the event details.
3547
+ * @example [
3548
+ * {
3549
+ * "url": "https://example.com/endpoint"
3550
+ * }
3551
+ * ]
3552
+ */
3553
+ notification_endpoints?: Record<string, never>[];
3458
3554
  /**
3459
3555
  * @description The ID of the organization
3460
3556
  * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
@@ -3774,6 +3870,15 @@ export interface components {
3774
3870
  * @example my_org_name
3775
3871
  */
3776
3872
  name?: string | null;
3873
+ /**
3874
+ * @description The new notification endpoint configurations
3875
+ * @example [
3876
+ * {
3877
+ * "url": "https://example.com/endpoint"
3878
+ * }
3879
+ * ]
3880
+ */
3881
+ notification_endpoints?: Record<string, never>[];
3777
3882
  /**
3778
3883
  * @description The ID of the organization
3779
3884
  * @example Org#124dfe3e-3bbd-487d-80c0-53c55e8ab87a
@@ -4788,7 +4893,12 @@ export interface operations {
4788
4893
  * Login with OIDC
4789
4894
  * @description Login with OIDC
4790
4895
  *
4791
- * Exchange an OIDC ID token (passed via the `Authorization` header) for a signer session
4896
+ * Exchange an OIDC ID token (passed via the `Authorization` header) for a signer session.
4897
+ *
4898
+ * MFA is required when:
4899
+ * - an MFA policy is explicitly attached to the user logging in
4900
+ * (e.g., an org owner can do that at user creation time to require certain kind of MFA)
4901
+ * - the user has at least 1 MFA factor configured
4792
4902
  */
4793
4903
  oidcAuth: {
4794
4904
  parameters: {