diff --git a/api/public_api.swagger.json b/api/public_api.swagger.json index 82a489f..caecb22 100644 --- a/api/public_api.swagger.json +++ b/api/public_api.swagger.json @@ -221,6 +221,32 @@ "tags": ["Users"] } }, + "/public/v1/query/get_organization_configs": { + "post": { + "summary": "Get Configs", + "description": "Get quorum settings and features for an organization", + "operationId": "GetOrganizationConfigs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/GetOrganizationConfigsResponse" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/GetOrganizationConfigsRequest" + } + } + ], + "tags": ["Organizations"] + } + }, "/public/v1/query/get_policy": { "post": { "summary": "Get Policy", @@ -2021,7 +2047,9 @@ "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5", "ACTIVITY_TYPE_OAUTH", "ACTIVITY_TYPE_CREATE_API_KEYS_V2", - "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION" + "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION", + "ACTIVITY_TYPE_EMAIL_AUTH_V2", + "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6" ] }, "AddressFormat": { @@ -2081,7 +2109,11 @@ }, "ApiKeyCurve": { "type": "string", - "enum": ["API_KEY_CURVE_P256", "API_KEY_CURVE_SECP256K1"] + "enum": [ + "API_KEY_CURVE_P256", + "API_KEY_CURVE_SECP256K1", + "API_KEY_CURVE_ED25519" + ] }, "ApiKeyParams": { "type": "object", @@ -2342,6 +2374,21 @@ "AUTHENTICATOR_TRANSPORT_HYBRID" ] }, + "Config": { + "type": "object", + "properties": { + "features": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/Feature" + } + }, + "quorum": { + "$ref": "#/definitions/external.data.v1.Quorum" + } + } + }, "CreateApiKeysIntent": { "type": "object", "properties": { @@ -3233,12 +3280,47 @@ }, "required": ["subOrganizationName", "rootUsers", "rootQuorumThreshold"] }, + "CreateSubOrganizationIntentV6": { + "type": "object", + "properties": { + "subOrganizationName": { + "type": "string", + "description": "Name for this sub-organization" + }, + "rootUsers": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/RootUserParamsV3" + }, + "description": "Root users to create within this sub-organization" + }, + "rootQuorumThreshold": { + "type": "integer", + "format": "int32", + "description": "The threshold of unique approvals to reach root quorum. This value must be less than or equal to the number of root users" + }, + "wallet": { + "$ref": "#/definitions/WalletParams", + "description": "The wallet to create for the sub-organization" + }, + "disableEmailRecovery": { + "type": "boolean", + "description": "Disable email recovery for the sub-organization" + }, + "disableEmailAuth": { + "type": "boolean", + "description": "Disable email auth for the sub-organization" + } + }, + "required": ["subOrganizationName", "rootUsers", "rootQuorumThreshold"] + }, "CreateSubOrganizationRequest": { "type": "object", "properties": { "type": { "type": "string", - "enum": ["ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"] + "enum": ["ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"] }, "timestampMs": { "type": "string", @@ -3249,7 +3331,7 @@ "description": "Unique identifier for a given Organization." }, "parameters": { - "$ref": "#/definitions/CreateSubOrganizationIntentV5" + "$ref": "#/definitions/CreateSubOrganizationIntentV6" } }, "required": ["type", "timestampMs", "organizationId", "parameters"] @@ -3328,6 +3410,24 @@ }, "required": ["subOrganizationId"] }, + "CreateSubOrganizationResultV6": { + "type": "object", + "properties": { + "subOrganizationId": { + "type": "string" + }, + "wallet": { + "$ref": "#/definitions/WalletResult" + }, + "rootUserIds": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["subOrganizationId"] + }, "CreateUserTagIntent": { "type": "object", "properties": { @@ -3573,7 +3673,9 @@ "CREDENTIAL_TYPE_WEBAUTHN_AUTHENTICATOR", "CREDENTIAL_TYPE_API_KEY_P256", "CREDENTIAL_TYPE_RECOVER_USER_KEY_P256", - "CREDENTIAL_TYPE_API_KEY_SECP256K1" + "CREDENTIAL_TYPE_API_KEY_SECP256K1", + "CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256", + "CREDENTIAL_TYPE_API_KEY_ED25519" ] }, "Curve": { @@ -4056,6 +4158,40 @@ "emailCustomization": { "$ref": "#/definitions/EmailCustomizationParams", "description": "Optional parameters for customizing emails. If not provided, the default email will be used." + }, + "invalidateExisting": { + "type": "boolean", + "description": "Invalidate all other previously generated Email Auth API keys" + } + }, + "required": ["email", "targetPublicKey"] + }, + "EmailAuthIntentV2": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Email of the authenticating user." + }, + "targetPublicKey": { + "type": "string", + "description": "Client-side public key generated by the user, to which the email auth bundle (credentials) will be encrypted." + }, + "apiKeyName": { + "type": "string", + "description": "Optional human-readable name for an API Key. If none provided, default to Email Auth - \u003cTimestamp\u003e" + }, + "expirationSeconds": { + "type": "string", + "description": "Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used." + }, + "emailCustomization": { + "$ref": "#/definitions/EmailCustomizationParams", + "description": "Optional parameters for customizing emails. If not provided, the default email will be used." + }, + "invalidateExisting": { + "type": "boolean", + "description": "Invalidate all other previously generated Email Auth API keys" } }, "required": ["email", "targetPublicKey"] @@ -4065,7 +4201,7 @@ "properties": { "type": { "type": "string", - "enum": ["ACTIVITY_TYPE_EMAIL_AUTH"] + "enum": ["ACTIVITY_TYPE_EMAIL_AUTH_V2"] }, "timestampMs": { "type": "string", @@ -4076,7 +4212,7 @@ "description": "Unique identifier for a given Organization." }, "parameters": { - "$ref": "#/definitions/EmailAuthIntent" + "$ref": "#/definitions/EmailAuthIntentV2" } }, "required": ["type", "timestampMs", "organizationId", "parameters"] @@ -4480,6 +4616,26 @@ }, "required": ["oauthProviders"] }, + "GetOrganizationConfigsRequest": { + "type": "object", + "properties": { + "organizationId": { + "type": "string", + "description": "Unique identifier for a given Organization." + } + }, + "required": ["organizationId"] + }, + "GetOrganizationConfigsResponse": { + "type": "object", + "properties": { + "configs": { + "$ref": "#/definitions/Config", + "description": "Organization configs including quorum settings and organization features" + } + }, + "required": ["configs"] + }, "GetPoliciesRequest": { "type": "object", "properties": { @@ -5265,6 +5421,12 @@ }, "createReadWriteSessionIntent": { "$ref": "#/definitions/CreateReadWriteSessionIntent" + }, + "emailAuthIntentV2": { + "$ref": "#/definitions/EmailAuthIntentV2" + }, + "createSubOrganizationIntentV6": { + "$ref": "#/definitions/CreateSubOrganizationIntentV6" } } }, @@ -5398,9 +5560,9 @@ "type": "string", "description": "Human-readable name to identify a Provider." }, - "jwksUri": { + "issuer": { "type": "string", - "description": "The URL at which to fetch the OIDC token signers" + "description": "The issuer of the token, typically a URL indicating the authentication server, e.g https://accounts.google.com" }, "audience": { "type": "string", @@ -5420,7 +5582,7 @@ "required": [ "providerId", "providerName", - "jwksUri", + "issuer", "audience", "subject", "createdAt", @@ -5434,16 +5596,12 @@ "type": "string", "description": "Human-readable name to identify a Provider." }, - "jwksUri": { - "type": "string", - "description": "The URL at which to fetch the OIDC token signers" - }, "oidcToken": { "type": "string", "description": "Base64 encoded OIDC token" } }, - "required": ["providerName", "jwksUri", "oidcToken"] + "required": ["providerName", "oidcToken"] }, "OauthRequest": { "type": "object", @@ -6004,6 +6162,9 @@ }, "createReadWriteSessionResult": { "$ref": "#/definitions/CreateReadWriteSessionResult" + }, + "createSubOrganizationResultV6": { + "$ref": "#/definitions/CreateSubOrganizationResultV6" } } }, @@ -6075,6 +6236,44 @@ }, "required": ["userName", "apiKeys", "authenticators", "oauthProviders"] }, + "RootUserParamsV3": { + "type": "object", + "properties": { + "userName": { + "type": "string", + "description": "Human-readable name for a User." + }, + "userEmail": { + "type": "string", + "description": "The user's email address." + }, + "apiKeys": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/ApiKeyParamsV2" + }, + "description": "A list of API Key parameters." + }, + "authenticators": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/AuthenticatorParamsV2" + }, + "description": "A list of Authenticator parameters." + }, + "oauthProviders": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/OauthProviderParams" + }, + "description": "A list of Oauth providers." + } + }, + "required": ["userName", "apiKeys", "authenticators", "oauthProviders"] + }, "Selector": { "type": "object", "properties": { @@ -7152,6 +7351,24 @@ }, "required": ["publicKey", "type"] }, + "external.data.v1.Quorum": { + "type": "object", + "properties": { + "threshold": { + "type": "integer", + "format": "int32", + "description": "Count of unique approvals required to meet quorum." + }, + "userIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Unique identifiers of quorum set members." + } + }, + "required": ["threshold", "userIds"] + }, "external.data.v1.Timestamp": { "type": "object", "properties": { diff --git a/pkg/api/client/organizations/get_organization_configs_parameters.go b/pkg/api/client/organizations/get_organization_configs_parameters.go new file mode 100644 index 0000000..4f629f1 --- /dev/null +++ b/pkg/api/client/organizations/get_organization_configs_parameters.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package organizations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/tkhq/go-sdk/pkg/api/models" +) + +// NewGetOrganizationConfigsParams creates a new GetOrganizationConfigsParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetOrganizationConfigsParams() *GetOrganizationConfigsParams { + return &GetOrganizationConfigsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetOrganizationConfigsParamsWithTimeout creates a new GetOrganizationConfigsParams object +// with the ability to set a timeout on a request. +func NewGetOrganizationConfigsParamsWithTimeout(timeout time.Duration) *GetOrganizationConfigsParams { + return &GetOrganizationConfigsParams{ + timeout: timeout, + } +} + +// NewGetOrganizationConfigsParamsWithContext creates a new GetOrganizationConfigsParams object +// with the ability to set a context for a request. +func NewGetOrganizationConfigsParamsWithContext(ctx context.Context) *GetOrganizationConfigsParams { + return &GetOrganizationConfigsParams{ + Context: ctx, + } +} + +// NewGetOrganizationConfigsParamsWithHTTPClient creates a new GetOrganizationConfigsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetOrganizationConfigsParamsWithHTTPClient(client *http.Client) *GetOrganizationConfigsParams { + return &GetOrganizationConfigsParams{ + HTTPClient: client, + } +} + +/* +GetOrganizationConfigsParams contains all the parameters to send to the API endpoint + + for the get organization configs operation. + + Typically these are written to a http.Request. +*/ +type GetOrganizationConfigsParams struct { + + // Body. + Body *models.GetOrganizationConfigsRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get organization configs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOrganizationConfigsParams) WithDefaults() *GetOrganizationConfigsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get organization configs params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetOrganizationConfigsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get organization configs params +func (o *GetOrganizationConfigsParams) WithTimeout(timeout time.Duration) *GetOrganizationConfigsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get organization configs params +func (o *GetOrganizationConfigsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get organization configs params +func (o *GetOrganizationConfigsParams) WithContext(ctx context.Context) *GetOrganizationConfigsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get organization configs params +func (o *GetOrganizationConfigsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get organization configs params +func (o *GetOrganizationConfigsParams) WithHTTPClient(client *http.Client) *GetOrganizationConfigsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get organization configs params +func (o *GetOrganizationConfigsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the get organization configs params +func (o *GetOrganizationConfigsParams) WithBody(body *models.GetOrganizationConfigsRequest) *GetOrganizationConfigsParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the get organization configs params +func (o *GetOrganizationConfigsParams) SetBody(body *models.GetOrganizationConfigsRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *GetOrganizationConfigsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/pkg/api/client/organizations/get_organization_configs_responses.go b/pkg/api/client/organizations/get_organization_configs_responses.go new file mode 100644 index 0000000..caa8bd6 --- /dev/null +++ b/pkg/api/client/organizations/get_organization_configs_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package organizations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/tkhq/go-sdk/pkg/api/models" +) + +// GetOrganizationConfigsReader is a Reader for the GetOrganizationConfigs structure. +type GetOrganizationConfigsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetOrganizationConfigsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetOrganizationConfigsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[POST /public/v1/query/get_organization_configs] GetOrganizationConfigs", response, response.Code()) + } +} + +// NewGetOrganizationConfigsOK creates a GetOrganizationConfigsOK with default headers values +func NewGetOrganizationConfigsOK() *GetOrganizationConfigsOK { + return &GetOrganizationConfigsOK{} +} + +/* +GetOrganizationConfigsOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetOrganizationConfigsOK struct { + Payload *models.GetOrganizationConfigsResponse +} + +// IsSuccess returns true when this get organization configs o k response has a 2xx status code +func (o *GetOrganizationConfigsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get organization configs o k response has a 3xx status code +func (o *GetOrganizationConfigsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get organization configs o k response has a 4xx status code +func (o *GetOrganizationConfigsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get organization configs o k response has a 5xx status code +func (o *GetOrganizationConfigsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get organization configs o k response a status code equal to that given +func (o *GetOrganizationConfigsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get organization configs o k response +func (o *GetOrganizationConfigsOK) Code() int { + return 200 +} + +func (o *GetOrganizationConfigsOK) Error() string { + return fmt.Sprintf("[POST /public/v1/query/get_organization_configs][%d] getOrganizationConfigsOK %+v", 200, o.Payload) +} + +func (o *GetOrganizationConfigsOK) String() string { + return fmt.Sprintf("[POST /public/v1/query/get_organization_configs][%d] getOrganizationConfigsOK %+v", 200, o.Payload) +} + +func (o *GetOrganizationConfigsOK) GetPayload() *models.GetOrganizationConfigsResponse { + return o.Payload +} + +func (o *GetOrganizationConfigsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.GetOrganizationConfigsResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/pkg/api/client/organizations/organizations_client.go b/pkg/api/client/organizations/organizations_client.go index 8a4104b..4f8cec6 100644 --- a/pkg/api/client/organizations/organizations_client.go +++ b/pkg/api/client/organizations/organizations_client.go @@ -32,6 +32,8 @@ type ClientOption func(*runtime.ClientOperation) type ClientService interface { CreateSubOrganization(params *CreateSubOrganizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CreateSubOrganizationOK, error) + GetOrganizationConfigs(params *GetOrganizationConfigsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrganizationConfigsOK, error) + GetSubOrgIds(params *GetSubOrgIdsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSubOrgIdsOK, error) UpdateRootQuorum(params *UpdateRootQuorumParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateRootQuorumOK, error) @@ -80,6 +82,47 @@ func (a *Client) CreateSubOrganization(params *CreateSubOrganizationParams, auth panic(msg) } +/* +GetOrganizationConfigs gets configs + +Get quorum settings and features for an organization +*/ +func (a *Client) GetOrganizationConfigs(params *GetOrganizationConfigsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetOrganizationConfigsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetOrganizationConfigsParams() + } + op := &runtime.ClientOperation{ + ID: "GetOrganizationConfigs", + Method: "POST", + PathPattern: "/public/v1/query/get_organization_configs", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"https"}, + Params: params, + Reader: &GetOrganizationConfigsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetOrganizationConfigsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for GetOrganizationConfigs: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + /* GetSubOrgIds gets suborgs diff --git a/pkg/api/models/activity_type.go b/pkg/api/models/activity_type.go index 4d79624..0628c3f 100644 --- a/pkg/api/models/activity_type.go +++ b/pkg/api/models/activity_type.go @@ -239,6 +239,12 @@ const ( // ActivityTypeCreateReadWriteSession captures enum value "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION" ActivityTypeCreateReadWriteSession ActivityType = "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION" + + // ActivityTypeEmailAuthV2 captures enum value "ACTIVITY_TYPE_EMAIL_AUTH_V2" + ActivityTypeEmailAuthV2 ActivityType = "ACTIVITY_TYPE_EMAIL_AUTH_V2" + + // ActivityTypeCreateSubOrganizationV6 captures enum value "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6" + ActivityTypeCreateSubOrganizationV6 ActivityType = "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6" ) // for schema @@ -246,7 +252,7 @@ var ActivityTypeEnum []ActivityType func init() { var res []ActivityType - if err := json.Unmarshal([]byte(`["ACTIVITY_TYPE_CREATE_API_KEYS","ACTIVITY_TYPE_CREATE_USERS","ACTIVITY_TYPE_CREATE_PRIVATE_KEYS","ACTIVITY_TYPE_SIGN_RAW_PAYLOAD","ACTIVITY_TYPE_CREATE_INVITATIONS","ACTIVITY_TYPE_ACCEPT_INVITATION","ACTIVITY_TYPE_CREATE_POLICY","ACTIVITY_TYPE_DISABLE_PRIVATE_KEY","ACTIVITY_TYPE_DELETE_USERS","ACTIVITY_TYPE_DELETE_API_KEYS","ACTIVITY_TYPE_DELETE_INVITATION","ACTIVITY_TYPE_DELETE_ORGANIZATION","ACTIVITY_TYPE_DELETE_POLICY","ACTIVITY_TYPE_CREATE_USER_TAG","ACTIVITY_TYPE_DELETE_USER_TAGS","ACTIVITY_TYPE_CREATE_ORGANIZATION","ACTIVITY_TYPE_SIGN_TRANSACTION","ACTIVITY_TYPE_APPROVE_ACTIVITY","ACTIVITY_TYPE_REJECT_ACTIVITY","ACTIVITY_TYPE_DELETE_AUTHENTICATORS","ACTIVITY_TYPE_CREATE_AUTHENTICATORS","ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG","ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS","ACTIVITY_TYPE_SET_PAYMENT_METHOD","ACTIVITY_TYPE_ACTIVATE_BILLING_TIER","ACTIVITY_TYPE_DELETE_PAYMENT_METHOD","ACTIVITY_TYPE_CREATE_POLICY_V2","ACTIVITY_TYPE_CREATE_POLICY_V3","ACTIVITY_TYPE_CREATE_API_ONLY_USERS","ACTIVITY_TYPE_UPDATE_ROOT_QUORUM","ACTIVITY_TYPE_UPDATE_USER_TAG","ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG","ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2","ACTIVITY_TYPE_CREATE_ORGANIZATION_V2","ACTIVITY_TYPE_CREATE_USERS_V2","ACTIVITY_TYPE_ACCEPT_INVITATION_V2","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2","ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS","ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2","ACTIVITY_TYPE_UPDATE_USER","ACTIVITY_TYPE_UPDATE_POLICY","ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3","ACTIVITY_TYPE_CREATE_WALLET","ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS","ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY","ACTIVITY_TYPE_RECOVER_USER","ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE","ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE","ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2","ACTIVITY_TYPE_SIGN_TRANSACTION_V2","ACTIVITY_TYPE_EXPORT_PRIVATE_KEY","ACTIVITY_TYPE_EXPORT_WALLET","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4","ACTIVITY_TYPE_EMAIL_AUTH","ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT","ACTIVITY_TYPE_INIT_IMPORT_WALLET","ACTIVITY_TYPE_IMPORT_WALLET","ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY","ACTIVITY_TYPE_IMPORT_PRIVATE_KEY","ACTIVITY_TYPE_CREATE_POLICIES","ACTIVITY_TYPE_SIGN_RAW_PAYLOADS","ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION","ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS","ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5","ACTIVITY_TYPE_OAUTH","ACTIVITY_TYPE_CREATE_API_KEYS_V2","ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["ACTIVITY_TYPE_CREATE_API_KEYS","ACTIVITY_TYPE_CREATE_USERS","ACTIVITY_TYPE_CREATE_PRIVATE_KEYS","ACTIVITY_TYPE_SIGN_RAW_PAYLOAD","ACTIVITY_TYPE_CREATE_INVITATIONS","ACTIVITY_TYPE_ACCEPT_INVITATION","ACTIVITY_TYPE_CREATE_POLICY","ACTIVITY_TYPE_DISABLE_PRIVATE_KEY","ACTIVITY_TYPE_DELETE_USERS","ACTIVITY_TYPE_DELETE_API_KEYS","ACTIVITY_TYPE_DELETE_INVITATION","ACTIVITY_TYPE_DELETE_ORGANIZATION","ACTIVITY_TYPE_DELETE_POLICY","ACTIVITY_TYPE_CREATE_USER_TAG","ACTIVITY_TYPE_DELETE_USER_TAGS","ACTIVITY_TYPE_CREATE_ORGANIZATION","ACTIVITY_TYPE_SIGN_TRANSACTION","ACTIVITY_TYPE_APPROVE_ACTIVITY","ACTIVITY_TYPE_REJECT_ACTIVITY","ACTIVITY_TYPE_DELETE_AUTHENTICATORS","ACTIVITY_TYPE_CREATE_AUTHENTICATORS","ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG","ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS","ACTIVITY_TYPE_SET_PAYMENT_METHOD","ACTIVITY_TYPE_ACTIVATE_BILLING_TIER","ACTIVITY_TYPE_DELETE_PAYMENT_METHOD","ACTIVITY_TYPE_CREATE_POLICY_V2","ACTIVITY_TYPE_CREATE_POLICY_V3","ACTIVITY_TYPE_CREATE_API_ONLY_USERS","ACTIVITY_TYPE_UPDATE_ROOT_QUORUM","ACTIVITY_TYPE_UPDATE_USER_TAG","ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG","ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2","ACTIVITY_TYPE_CREATE_ORGANIZATION_V2","ACTIVITY_TYPE_CREATE_USERS_V2","ACTIVITY_TYPE_ACCEPT_INVITATION_V2","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V2","ACTIVITY_TYPE_UPDATE_ALLOWED_ORIGINS","ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2","ACTIVITY_TYPE_UPDATE_USER","ACTIVITY_TYPE_UPDATE_POLICY","ACTIVITY_TYPE_SET_PAYMENT_METHOD_V2","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V3","ACTIVITY_TYPE_CREATE_WALLET","ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS","ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY","ACTIVITY_TYPE_RECOVER_USER","ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE","ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE","ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2","ACTIVITY_TYPE_SIGN_TRANSACTION_V2","ACTIVITY_TYPE_EXPORT_PRIVATE_KEY","ACTIVITY_TYPE_EXPORT_WALLET","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V4","ACTIVITY_TYPE_EMAIL_AUTH","ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT","ACTIVITY_TYPE_INIT_IMPORT_WALLET","ACTIVITY_TYPE_IMPORT_WALLET","ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY","ACTIVITY_TYPE_IMPORT_PRIVATE_KEY","ACTIVITY_TYPE_CREATE_POLICIES","ACTIVITY_TYPE_SIGN_RAW_PAYLOADS","ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION","ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS","ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5","ACTIVITY_TYPE_OAUTH","ACTIVITY_TYPE_CREATE_API_KEYS_V2","ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION","ACTIVITY_TYPE_EMAIL_AUTH_V2","ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/api/models/api_key_curve.go b/pkg/api/models/api_key_curve.go index d04c3bc..17ed099 100644 --- a/pkg/api/models/api_key_curve.go +++ b/pkg/api/models/api_key_curve.go @@ -35,6 +35,9 @@ const ( // APIKeyCurveSecp256k1 captures enum value "API_KEY_CURVE_SECP256K1" APIKeyCurveSecp256k1 APIKeyCurve = "API_KEY_CURVE_SECP256K1" + + // APIKeyCurveEd25519 captures enum value "API_KEY_CURVE_ED25519" + APIKeyCurveEd25519 APIKeyCurve = "API_KEY_CURVE_ED25519" ) // for schema @@ -42,7 +45,7 @@ var APIKeyCurveEnum []APIKeyCurve func init() { var res []APIKeyCurve - if err := json.Unmarshal([]byte(`["API_KEY_CURVE_P256","API_KEY_CURVE_SECP256K1"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["API_KEY_CURVE_P256","API_KEY_CURVE_SECP256K1","API_KEY_CURVE_ED25519"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/api/models/config.go b/pkg/api/models/config.go new file mode 100644 index 0000000..b523858 --- /dev/null +++ b/pkg/api/models/config.go @@ -0,0 +1,172 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Config config +// +// swagger:model Config +type Config struct { + + // features + Features []*Feature `json:"features"` + + // quorum + Quorum *ExternalDataV1Quorum `json:"quorum,omitempty"` +} + +// Validate validates this config +func (m *Config) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFeatures(formats); err != nil { + res = append(res, err) + } + + if err := m.validateQuorum(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Config) validateFeatures(formats strfmt.Registry) error { + if swag.IsZero(m.Features) { // not required + return nil + } + + for i := 0; i < len(m.Features); i++ { + if swag.IsZero(m.Features[i]) { // not required + continue + } + + if m.Features[i] != nil { + if err := m.Features[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("features" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("features" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Config) validateQuorum(formats strfmt.Registry) error { + if swag.IsZero(m.Quorum) { // not required + return nil + } + + if m.Quorum != nil { + if err := m.Quorum.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quorum") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("quorum") + } + return err + } + } + + return nil +} + +// ContextValidate validate this config based on the context it is used +func (m *Config) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFeatures(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateQuorum(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Config) contextValidateFeatures(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Features); i++ { + + if m.Features[i] != nil { + + if swag.IsZero(m.Features[i]) { // not required + return nil + } + + if err := m.Features[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("features" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("features" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Config) contextValidateQuorum(ctx context.Context, formats strfmt.Registry) error { + + if m.Quorum != nil { + + if swag.IsZero(m.Quorum) { // not required + return nil + } + + if err := m.Quorum.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("quorum") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("quorum") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Config) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Config) UnmarshalBinary(b []byte) error { + var res Config + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/create_sub_organization_intent_v6.go b/pkg/api/models/create_sub_organization_intent_v6.go new file mode 100644 index 0000000..6b5555a --- /dev/null +++ b/pkg/api/models/create_sub_organization_intent_v6.go @@ -0,0 +1,215 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CreateSubOrganizationIntentV6 create sub organization intent v6 +// +// swagger:model CreateSubOrganizationIntentV6 +type CreateSubOrganizationIntentV6 struct { + + // Disable email auth for the sub-organization + DisableEmailAuth bool `json:"disableEmailAuth,omitempty"` + + // Disable email recovery for the sub-organization + DisableEmailRecovery bool `json:"disableEmailRecovery,omitempty"` + + // The threshold of unique approvals to reach root quorum. This value must be less than or equal to the number of root users + // Required: true + RootQuorumThreshold *int32 `json:"rootQuorumThreshold"` + + // Root users to create within this sub-organization + // Required: true + RootUsers []*RootUserParamsV3 `json:"rootUsers"` + + // Name for this sub-organization + // Required: true + SubOrganizationName *string `json:"subOrganizationName"` + + // The wallet to create for the sub-organization + Wallet *WalletParams `json:"wallet,omitempty"` +} + +// Validate validates this create sub organization intent v6 +func (m *CreateSubOrganizationIntentV6) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRootQuorumThreshold(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRootUsers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSubOrganizationName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWallet(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateSubOrganizationIntentV6) validateRootQuorumThreshold(formats strfmt.Registry) error { + + if err := validate.Required("rootQuorumThreshold", "body", m.RootQuorumThreshold); err != nil { + return err + } + + return nil +} + +func (m *CreateSubOrganizationIntentV6) validateRootUsers(formats strfmt.Registry) error { + + if err := validate.Required("rootUsers", "body", m.RootUsers); err != nil { + return err + } + + for i := 0; i < len(m.RootUsers); i++ { + if swag.IsZero(m.RootUsers[i]) { // not required + continue + } + + if m.RootUsers[i] != nil { + if err := m.RootUsers[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rootUsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rootUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CreateSubOrganizationIntentV6) validateSubOrganizationName(formats strfmt.Registry) error { + + if err := validate.Required("subOrganizationName", "body", m.SubOrganizationName); err != nil { + return err + } + + return nil +} + +func (m *CreateSubOrganizationIntentV6) validateWallet(formats strfmt.Registry) error { + if swag.IsZero(m.Wallet) { // not required + return nil + } + + if m.Wallet != nil { + if err := m.Wallet.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("wallet") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("wallet") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create sub organization intent v6 based on the context it is used +func (m *CreateSubOrganizationIntentV6) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRootUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateWallet(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateSubOrganizationIntentV6) contextValidateRootUsers(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.RootUsers); i++ { + + if m.RootUsers[i] != nil { + + if swag.IsZero(m.RootUsers[i]) { // not required + return nil + } + + if err := m.RootUsers[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rootUsers" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rootUsers" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CreateSubOrganizationIntentV6) contextValidateWallet(ctx context.Context, formats strfmt.Registry) error { + + if m.Wallet != nil { + + if swag.IsZero(m.Wallet) { // not required + return nil + } + + if err := m.Wallet.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("wallet") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("wallet") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateSubOrganizationIntentV6) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateSubOrganizationIntentV6) UnmarshalBinary(b []byte) error { + var res CreateSubOrganizationIntentV6 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/create_sub_organization_request.go b/pkg/api/models/create_sub_organization_request.go index 0223a07..b61c6c5 100644 --- a/pkg/api/models/create_sub_organization_request.go +++ b/pkg/api/models/create_sub_organization_request.go @@ -26,7 +26,7 @@ type CreateSubOrganizationRequest struct { // parameters // Required: true - Parameters *CreateSubOrganizationIntentV5 `json:"parameters"` + Parameters *CreateSubOrganizationIntentV6 `json:"parameters"` // Timestamp (in milliseconds) of the request, used to verify liveness of user requests. // Required: true @@ -34,7 +34,7 @@ type CreateSubOrganizationRequest struct { // type // Required: true - // Enum: [ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5] + // Enum: [ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6] Type *string `json:"type"` } @@ -106,7 +106,7 @@ var createSubOrganizationRequestTypeTypePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -116,8 +116,8 @@ func init() { const ( - // CreateSubOrganizationRequestTypeACTIVITYTYPECREATESUBORGANIZATIONV5 captures enum value "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5" - CreateSubOrganizationRequestTypeACTIVITYTYPECREATESUBORGANIZATIONV5 string = "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V5" + // CreateSubOrganizationRequestTypeACTIVITYTYPECREATESUBORGANIZATIONV6 captures enum value "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6" + CreateSubOrganizationRequestTypeACTIVITYTYPECREATESUBORGANIZATIONV6 string = "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6" ) // prop value enum diff --git a/pkg/api/models/create_sub_organization_result_v6.go b/pkg/api/models/create_sub_organization_result_v6.go new file mode 100644 index 0000000..0175848 --- /dev/null +++ b/pkg/api/models/create_sub_organization_result_v6.go @@ -0,0 +1,130 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// CreateSubOrganizationResultV6 create sub organization result v6 +// +// swagger:model CreateSubOrganizationResultV6 +type CreateSubOrganizationResultV6 struct { + + // root user ids + RootUserIds []string `json:"rootUserIds"` + + // sub organization Id + // Required: true + SubOrganizationID *string `json:"subOrganizationId"` + + // wallet + Wallet *WalletResult `json:"wallet,omitempty"` +} + +// Validate validates this create sub organization result v6 +func (m *CreateSubOrganizationResultV6) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSubOrganizationID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWallet(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateSubOrganizationResultV6) validateSubOrganizationID(formats strfmt.Registry) error { + + if err := validate.Required("subOrganizationId", "body", m.SubOrganizationID); err != nil { + return err + } + + return nil +} + +func (m *CreateSubOrganizationResultV6) validateWallet(formats strfmt.Registry) error { + if swag.IsZero(m.Wallet) { // not required + return nil + } + + if m.Wallet != nil { + if err := m.Wallet.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("wallet") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("wallet") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create sub organization result v6 based on the context it is used +func (m *CreateSubOrganizationResultV6) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateWallet(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateSubOrganizationResultV6) contextValidateWallet(ctx context.Context, formats strfmt.Registry) error { + + if m.Wallet != nil { + + if swag.IsZero(m.Wallet) { // not required + return nil + } + + if err := m.Wallet.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("wallet") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("wallet") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateSubOrganizationResultV6) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateSubOrganizationResultV6) UnmarshalBinary(b []byte) error { + var res CreateSubOrganizationResultV6 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/credential_type.go b/pkg/api/models/credential_type.go index 1c1b2b2..a82c948 100644 --- a/pkg/api/models/credential_type.go +++ b/pkg/api/models/credential_type.go @@ -41,6 +41,12 @@ const ( // CredentialTypeAPIKeySecp256k1 captures enum value "CREDENTIAL_TYPE_API_KEY_SECP256K1" CredentialTypeAPIKeySecp256k1 CredentialType = "CREDENTIAL_TYPE_API_KEY_SECP256K1" + + // CredentialTypeEmailAuthKeyP256 captures enum value "CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256" + CredentialTypeEmailAuthKeyP256 CredentialType = "CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256" + + // CredentialTypeAPIKeyEd25519 captures enum value "CREDENTIAL_TYPE_API_KEY_ED25519" + CredentialTypeAPIKeyEd25519 CredentialType = "CREDENTIAL_TYPE_API_KEY_ED25519" ) // for schema @@ -48,7 +54,7 @@ var CredentialTypeEnum []CredentialType func init() { var res []CredentialType - if err := json.Unmarshal([]byte(`["CREDENTIAL_TYPE_WEBAUTHN_AUTHENTICATOR","CREDENTIAL_TYPE_API_KEY_P256","CREDENTIAL_TYPE_RECOVER_USER_KEY_P256","CREDENTIAL_TYPE_API_KEY_SECP256K1"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["CREDENTIAL_TYPE_WEBAUTHN_AUTHENTICATOR","CREDENTIAL_TYPE_API_KEY_P256","CREDENTIAL_TYPE_RECOVER_USER_KEY_P256","CREDENTIAL_TYPE_API_KEY_SECP256K1","CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256","CREDENTIAL_TYPE_API_KEY_ED25519"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/pkg/api/models/email_auth_intent.go b/pkg/api/models/email_auth_intent.go index cd4d4c0..e8ac90b 100644 --- a/pkg/api/models/email_auth_intent.go +++ b/pkg/api/models/email_auth_intent.go @@ -32,6 +32,9 @@ type EmailAuthIntent struct { // Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used. ExpirationSeconds string `json:"expirationSeconds,omitempty"` + // Invalidate all other previously generated Email Auth API keys + InvalidateExisting bool `json:"invalidateExisting,omitempty"` + // Client-side public key generated by the user, to which the email auth bundle (credentials) will be encrypted. // Required: true TargetPublicKey *string `json:"targetPublicKey"` diff --git a/pkg/api/models/email_auth_intent_v2.go b/pkg/api/models/email_auth_intent_v2.go new file mode 100644 index 0000000..235e1af --- /dev/null +++ b/pkg/api/models/email_auth_intent_v2.go @@ -0,0 +1,153 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// EmailAuthIntentV2 email auth intent v2 +// +// swagger:model EmailAuthIntentV2 +type EmailAuthIntentV2 struct { + + // Optional human-readable name for an API Key. If none provided, default to Email Auth - + APIKeyName string `json:"apiKeyName,omitempty"` + + // Email of the authenticating user. + // Required: true + Email *string `json:"email"` + + // Optional parameters for customizing emails. If not provided, the default email will be used. + EmailCustomization *EmailCustomizationParams `json:"emailCustomization,omitempty"` + + // Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used. + ExpirationSeconds string `json:"expirationSeconds,omitempty"` + + // Invalidate all other previously generated Email Auth API keys + InvalidateExisting bool `json:"invalidateExisting,omitempty"` + + // Client-side public key generated by the user, to which the email auth bundle (credentials) will be encrypted. + // Required: true + TargetPublicKey *string `json:"targetPublicKey"` +} + +// Validate validates this email auth intent v2 +func (m *EmailAuthIntentV2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmailCustomization(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTargetPublicKey(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EmailAuthIntentV2) validateEmail(formats strfmt.Registry) error { + + if err := validate.Required("email", "body", m.Email); err != nil { + return err + } + + return nil +} + +func (m *EmailAuthIntentV2) validateEmailCustomization(formats strfmt.Registry) error { + if swag.IsZero(m.EmailCustomization) { // not required + return nil + } + + if m.EmailCustomization != nil { + if err := m.EmailCustomization.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emailCustomization") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emailCustomization") + } + return err + } + } + + return nil +} + +func (m *EmailAuthIntentV2) validateTargetPublicKey(formats strfmt.Registry) error { + + if err := validate.Required("targetPublicKey", "body", m.TargetPublicKey); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this email auth intent v2 based on the context it is used +func (m *EmailAuthIntentV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmailCustomization(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EmailAuthIntentV2) contextValidateEmailCustomization(ctx context.Context, formats strfmt.Registry) error { + + if m.EmailCustomization != nil { + + if swag.IsZero(m.EmailCustomization) { // not required + return nil + } + + if err := m.EmailCustomization.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emailCustomization") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emailCustomization") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *EmailAuthIntentV2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EmailAuthIntentV2) UnmarshalBinary(b []byte) error { + var res EmailAuthIntentV2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/email_auth_request.go b/pkg/api/models/email_auth_request.go index b1cf908..5e9ef7d 100644 --- a/pkg/api/models/email_auth_request.go +++ b/pkg/api/models/email_auth_request.go @@ -26,7 +26,7 @@ type EmailAuthRequest struct { // parameters // Required: true - Parameters *EmailAuthIntent `json:"parameters"` + Parameters *EmailAuthIntentV2 `json:"parameters"` // Timestamp (in milliseconds) of the request, used to verify liveness of user requests. // Required: true @@ -34,7 +34,7 @@ type EmailAuthRequest struct { // type // Required: true - // Enum: [ACTIVITY_TYPE_EMAIL_AUTH] + // Enum: [ACTIVITY_TYPE_EMAIL_AUTH_V2] Type *string `json:"type"` } @@ -106,7 +106,7 @@ var emailAuthRequestTypeTypePropEnum []interface{} func init() { var res []string - if err := json.Unmarshal([]byte(`["ACTIVITY_TYPE_EMAIL_AUTH"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["ACTIVITY_TYPE_EMAIL_AUTH_V2"]`), &res); err != nil { panic(err) } for _, v := range res { @@ -116,8 +116,8 @@ func init() { const ( - // EmailAuthRequestTypeACTIVITYTYPEEMAILAUTH captures enum value "ACTIVITY_TYPE_EMAIL_AUTH" - EmailAuthRequestTypeACTIVITYTYPEEMAILAUTH string = "ACTIVITY_TYPE_EMAIL_AUTH" + // EmailAuthRequestTypeACTIVITYTYPEEMAILAUTHV2 captures enum value "ACTIVITY_TYPE_EMAIL_AUTH_V2" + EmailAuthRequestTypeACTIVITYTYPEEMAILAUTHV2 string = "ACTIVITY_TYPE_EMAIL_AUTH_V2" ) // prop value enum diff --git a/pkg/api/models/external_data_v1_quorum.go b/pkg/api/models/external_data_v1_quorum.go new file mode 100644 index 0000000..320b4b4 --- /dev/null +++ b/pkg/api/models/external_data_v1_quorum.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// ExternalDataV1Quorum external data v1 quorum +// +// swagger:model external.data.v1.Quorum +type ExternalDataV1Quorum struct { + + // Count of unique approvals required to meet quorum. + // Required: true + Threshold *int32 `json:"threshold"` + + // Unique identifiers of quorum set members. + // Required: true + UserIds []string `json:"userIds"` +} + +// Validate validates this external data v1 quorum +func (m *ExternalDataV1Quorum) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateThreshold(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserIds(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExternalDataV1Quorum) validateThreshold(formats strfmt.Registry) error { + + if err := validate.Required("threshold", "body", m.Threshold); err != nil { + return err + } + + return nil +} + +func (m *ExternalDataV1Quorum) validateUserIds(formats strfmt.Registry) error { + + if err := validate.Required("userIds", "body", m.UserIds); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this external data v1 quorum based on context it is used +func (m *ExternalDataV1Quorum) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ExternalDataV1Quorum) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExternalDataV1Quorum) UnmarshalBinary(b []byte) error { + var res ExternalDataV1Quorum + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/get_organization_configs_request.go b/pkg/api/models/get_organization_configs_request.go new file mode 100644 index 0000000..137acf9 --- /dev/null +++ b/pkg/api/models/get_organization_configs_request.go @@ -0,0 +1,71 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetOrganizationConfigsRequest get organization configs request +// +// swagger:model GetOrganizationConfigsRequest +type GetOrganizationConfigsRequest struct { + + // Unique identifier for a given Organization. + // Required: true + OrganizationID *string `json:"organizationId"` +} + +// Validate validates this get organization configs request +func (m *GetOrganizationConfigsRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOrganizationID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetOrganizationConfigsRequest) validateOrganizationID(formats strfmt.Registry) error { + + if err := validate.Required("organizationId", "body", m.OrganizationID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this get organization configs request based on context it is used +func (m *GetOrganizationConfigsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *GetOrganizationConfigsRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetOrganizationConfigsRequest) UnmarshalBinary(b []byte) error { + var res GetOrganizationConfigsRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/get_organization_configs_response.go b/pkg/api/models/get_organization_configs_response.go new file mode 100644 index 0000000..d353b44 --- /dev/null +++ b/pkg/api/models/get_organization_configs_response.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// GetOrganizationConfigsResponse get organization configs response +// +// swagger:model GetOrganizationConfigsResponse +type GetOrganizationConfigsResponse struct { + + // Organization configs including quorum settings and organization features + // Required: true + Configs *Config `json:"configs"` +} + +// Validate validates this get organization configs response +func (m *GetOrganizationConfigsResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateConfigs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetOrganizationConfigsResponse) validateConfigs(formats strfmt.Registry) error { + + if err := validate.Required("configs", "body", m.Configs); err != nil { + return err + } + + if m.Configs != nil { + if err := m.Configs.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configs") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configs") + } + return err + } + } + + return nil +} + +// ContextValidate validate this get organization configs response based on the context it is used +func (m *GetOrganizationConfigsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConfigs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *GetOrganizationConfigsResponse) contextValidateConfigs(ctx context.Context, formats strfmt.Registry) error { + + if m.Configs != nil { + + if err := m.Configs.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configs") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configs") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *GetOrganizationConfigsResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *GetOrganizationConfigsResponse) UnmarshalBinary(b []byte) error { + var res GetOrganizationConfigsResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/pkg/api/models/intent.go b/pkg/api/models/intent.go index d313ad1..5b274e6 100644 --- a/pkg/api/models/intent.go +++ b/pkg/api/models/intent.go @@ -99,6 +99,9 @@ type Intent struct { // create sub organization intent v5 CreateSubOrganizationIntentV5 *CreateSubOrganizationIntentV5 `json:"createSubOrganizationIntentV5,omitempty"` + // create sub organization intent v6 + CreateSubOrganizationIntentV6 *CreateSubOrganizationIntentV6 `json:"createSubOrganizationIntentV6,omitempty"` + // create user tag intent CreateUserTagIntent *CreateUserTagIntent `json:"createUserTagIntent,omitempty"` @@ -150,6 +153,9 @@ type Intent struct { // email auth intent EmailAuthIntent *EmailAuthIntent `json:"emailAuthIntent,omitempty"` + // email auth intent v2 + EmailAuthIntentV2 *EmailAuthIntentV2 `json:"emailAuthIntentV2,omitempty"` + // export private key intent ExportPrivateKeyIntent *ExportPrivateKeyIntent `json:"exportPrivateKeyIntent,omitempty"` @@ -337,6 +343,10 @@ func (m *Intent) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCreateSubOrganizationIntentV6(formats); err != nil { + res = append(res, err) + } + if err := m.validateCreateUserTagIntent(formats); err != nil { res = append(res, err) } @@ -405,6 +415,10 @@ func (m *Intent) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateEmailAuthIntentV2(formats); err != nil { + res = append(res, err) + } + if err := m.validateExportPrivateKeyIntent(formats); err != nil { res = append(res, err) } @@ -1009,6 +1023,25 @@ func (m *Intent) validateCreateSubOrganizationIntentV5(formats strfmt.Registry) return nil } +func (m *Intent) validateCreateSubOrganizationIntentV6(formats strfmt.Registry) error { + if swag.IsZero(m.CreateSubOrganizationIntentV6) { // not required + return nil + } + + if m.CreateSubOrganizationIntentV6 != nil { + if err := m.CreateSubOrganizationIntentV6.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("createSubOrganizationIntentV6") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("createSubOrganizationIntentV6") + } + return err + } + } + + return nil +} + func (m *Intent) validateCreateUserTagIntent(formats strfmt.Registry) error { if swag.IsZero(m.CreateUserTagIntent) { // not required return nil @@ -1332,6 +1365,25 @@ func (m *Intent) validateEmailAuthIntent(formats strfmt.Registry) error { return nil } +func (m *Intent) validateEmailAuthIntentV2(formats strfmt.Registry) error { + if swag.IsZero(m.EmailAuthIntentV2) { // not required + return nil + } + + if m.EmailAuthIntentV2 != nil { + if err := m.EmailAuthIntentV2.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emailAuthIntentV2") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emailAuthIntentV2") + } + return err + } + } + + return nil +} + func (m *Intent) validateExportPrivateKeyIntent(formats strfmt.Registry) error { if swag.IsZero(m.ExportPrivateKeyIntent) { // not required return nil @@ -1934,6 +1986,10 @@ func (m *Intent) ContextValidate(ctx context.Context, formats strfmt.Registry) e res = append(res, err) } + if err := m.contextValidateCreateSubOrganizationIntentV6(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateCreateUserTagIntent(ctx, formats); err != nil { res = append(res, err) } @@ -2002,6 +2058,10 @@ func (m *Intent) ContextValidate(ctx context.Context, formats strfmt.Registry) e res = append(res, err) } + if err := m.contextValidateEmailAuthIntentV2(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateExportPrivateKeyIntent(ctx, formats); err != nil { res = append(res, err) } @@ -2658,6 +2718,27 @@ func (m *Intent) contextValidateCreateSubOrganizationIntentV5(ctx context.Contex return nil } +func (m *Intent) contextValidateCreateSubOrganizationIntentV6(ctx context.Context, formats strfmt.Registry) error { + + if m.CreateSubOrganizationIntentV6 != nil { + + if swag.IsZero(m.CreateSubOrganizationIntentV6) { // not required + return nil + } + + if err := m.CreateSubOrganizationIntentV6.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("createSubOrganizationIntentV6") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("createSubOrganizationIntentV6") + } + return err + } + } + + return nil +} + func (m *Intent) contextValidateCreateUserTagIntent(ctx context.Context, formats strfmt.Registry) error { if m.CreateUserTagIntent != nil { @@ -3015,6 +3096,27 @@ func (m *Intent) contextValidateEmailAuthIntent(ctx context.Context, formats str return nil } +func (m *Intent) contextValidateEmailAuthIntentV2(ctx context.Context, formats strfmt.Registry) error { + + if m.EmailAuthIntentV2 != nil { + + if swag.IsZero(m.EmailAuthIntentV2) { // not required + return nil + } + + if err := m.EmailAuthIntentV2.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emailAuthIntentV2") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emailAuthIntentV2") + } + return err + } + } + + return nil +} + func (m *Intent) contextValidateExportPrivateKeyIntent(ctx context.Context, formats strfmt.Registry) error { if m.ExportPrivateKeyIntent != nil { diff --git a/pkg/api/models/oauth_provider.go b/pkg/api/models/oauth_provider.go index f5e69b8..6668eb0 100644 --- a/pkg/api/models/oauth_provider.go +++ b/pkg/api/models/oauth_provider.go @@ -27,9 +27,9 @@ type OauthProvider struct { // Required: true CreatedAt *ExternalDataV1Timestamp `json:"createdAt"` - // The URL at which to fetch the OIDC token signers + // The issuer of the token, typically a URL indicating the authentication server, e.g https://accounts.google.com // Required: true - JwksURI *string `json:"jwksUri"` + Issuer *string `json:"issuer"` // Unique identifier for an OAuth Provider // Required: true @@ -60,7 +60,7 @@ func (m *OauthProvider) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateJwksURI(formats); err != nil { + if err := m.validateIssuer(formats); err != nil { res = append(res, err) } @@ -115,9 +115,9 @@ func (m *OauthProvider) validateCreatedAt(formats strfmt.Registry) error { return nil } -func (m *OauthProvider) validateJwksURI(formats strfmt.Registry) error { +func (m *OauthProvider) validateIssuer(formats strfmt.Registry) error { - if err := validate.Required("jwksUri", "body", m.JwksURI); err != nil { + if err := validate.Required("issuer", "body", m.Issuer); err != nil { return err } diff --git a/pkg/api/models/oauth_provider_params.go b/pkg/api/models/oauth_provider_params.go index 0015d2e..0cf50b4 100644 --- a/pkg/api/models/oauth_provider_params.go +++ b/pkg/api/models/oauth_provider_params.go @@ -19,10 +19,6 @@ import ( // swagger:model OauthProviderParams type OauthProviderParams struct { - // The URL at which to fetch the OIDC token signers - // Required: true - JwksURI *string `json:"jwksUri"` - // Base64 encoded OIDC token // Required: true OidcToken *string `json:"oidcToken"` @@ -36,10 +32,6 @@ type OauthProviderParams struct { func (m *OauthProviderParams) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateJwksURI(formats); err != nil { - res = append(res, err) - } - if err := m.validateOidcToken(formats); err != nil { res = append(res, err) } @@ -54,15 +46,6 @@ func (m *OauthProviderParams) Validate(formats strfmt.Registry) error { return nil } -func (m *OauthProviderParams) validateJwksURI(formats strfmt.Registry) error { - - if err := validate.Required("jwksUri", "body", m.JwksURI); err != nil { - return err - } - - return nil -} - func (m *OauthProviderParams) validateOidcToken(formats strfmt.Registry) error { if err := validate.Required("oidcToken", "body", m.OidcToken); err != nil { diff --git a/pkg/api/models/result.go b/pkg/api/models/result.go index 38907e0..5450159 100644 --- a/pkg/api/models/result.go +++ b/pkg/api/models/result.go @@ -75,6 +75,9 @@ type Result struct { // create sub organization result v5 CreateSubOrganizationResultV5 *CreateSubOrganizationResultV5 `json:"createSubOrganizationResultV5,omitempty"` + // create sub organization result v6 + CreateSubOrganizationResultV6 *CreateSubOrganizationResultV6 `json:"createSubOrganizationResultV6,omitempty"` + // create user tag result CreateUserTagResult *CreateUserTagResult `json:"createUserTagResult,omitempty"` @@ -270,6 +273,10 @@ func (m *Result) Validate(formats strfmt.Registry) error { res = append(res, err) } + if err := m.validateCreateSubOrganizationResultV6(formats); err != nil { + res = append(res, err) + } + if err := m.validateCreateUserTagResult(formats); err != nil { res = append(res, err) } @@ -781,6 +788,25 @@ func (m *Result) validateCreateSubOrganizationResultV5(formats strfmt.Registry) return nil } +func (m *Result) validateCreateSubOrganizationResultV6(formats strfmt.Registry) error { + if swag.IsZero(m.CreateSubOrganizationResultV6) { // not required + return nil + } + + if m.CreateSubOrganizationResultV6 != nil { + if err := m.CreateSubOrganizationResultV6.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("createSubOrganizationResultV6") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("createSubOrganizationResultV6") + } + return err + } + } + + return nil +} + func (m *Result) validateCreateUserTagResult(formats strfmt.Registry) error { if swag.IsZero(m.CreateUserTagResult) { // not required return nil @@ -1545,6 +1571,10 @@ func (m *Result) ContextValidate(ctx context.Context, formats strfmt.Registry) e res = append(res, err) } + if err := m.contextValidateCreateSubOrganizationResultV6(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateCreateUserTagResult(ctx, formats); err != nil { res = append(res, err) } @@ -2094,6 +2124,27 @@ func (m *Result) contextValidateCreateSubOrganizationResultV5(ctx context.Contex return nil } +func (m *Result) contextValidateCreateSubOrganizationResultV6(ctx context.Context, formats strfmt.Registry) error { + + if m.CreateSubOrganizationResultV6 != nil { + + if swag.IsZero(m.CreateSubOrganizationResultV6) { // not required + return nil + } + + if err := m.CreateSubOrganizationResultV6.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("createSubOrganizationResultV6") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("createSubOrganizationResultV6") + } + return err + } + } + + return nil +} + func (m *Result) contextValidateCreateUserTagResult(ctx context.Context, formats strfmt.Registry) error { if m.CreateUserTagResult != nil { diff --git a/pkg/api/models/root_user_params_v3.go b/pkg/api/models/root_user_params_v3.go new file mode 100644 index 0000000..d06c698 --- /dev/null +++ b/pkg/api/models/root_user_params_v3.go @@ -0,0 +1,272 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// RootUserParamsV3 root user params v3 +// +// swagger:model RootUserParamsV3 +type RootUserParamsV3 struct { + + // A list of API Key parameters. + // Required: true + APIKeys []*APIKeyParamsV2 `json:"apiKeys"` + + // A list of Authenticator parameters. + // Required: true + Authenticators []*AuthenticatorParamsV2 `json:"authenticators"` + + // A list of Oauth providers. + // Required: true + OauthProviders []*OauthProviderParams `json:"oauthProviders"` + + // The user's email address. + UserEmail string `json:"userEmail,omitempty"` + + // Human-readable name for a User. + // Required: true + UserName *string `json:"userName"` +} + +// Validate validates this root user params v3 +func (m *RootUserParamsV3) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAPIKeys(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAuthenticators(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOauthProviders(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RootUserParamsV3) validateAPIKeys(formats strfmt.Registry) error { + + if err := validate.Required("apiKeys", "body", m.APIKeys); err != nil { + return err + } + + for i := 0; i < len(m.APIKeys); i++ { + if swag.IsZero(m.APIKeys[i]) { // not required + continue + } + + if m.APIKeys[i] != nil { + if err := m.APIKeys[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("apiKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("apiKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RootUserParamsV3) validateAuthenticators(formats strfmt.Registry) error { + + if err := validate.Required("authenticators", "body", m.Authenticators); err != nil { + return err + } + + for i := 0; i < len(m.Authenticators); i++ { + if swag.IsZero(m.Authenticators[i]) { // not required + continue + } + + if m.Authenticators[i] != nil { + if err := m.Authenticators[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authenticators" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authenticators" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RootUserParamsV3) validateOauthProviders(formats strfmt.Registry) error { + + if err := validate.Required("oauthProviders", "body", m.OauthProviders); err != nil { + return err + } + + for i := 0; i < len(m.OauthProviders); i++ { + if swag.IsZero(m.OauthProviders[i]) { // not required + continue + } + + if m.OauthProviders[i] != nil { + if err := m.OauthProviders[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oauthProviders" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("oauthProviders" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RootUserParamsV3) validateUserName(formats strfmt.Registry) error { + + if err := validate.Required("userName", "body", m.UserName); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this root user params v3 based on the context it is used +func (m *RootUserParamsV3) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAPIKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAuthenticators(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOauthProviders(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *RootUserParamsV3) contextValidateAPIKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.APIKeys); i++ { + + if m.APIKeys[i] != nil { + + if swag.IsZero(m.APIKeys[i]) { // not required + return nil + } + + if err := m.APIKeys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("apiKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("apiKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RootUserParamsV3) contextValidateAuthenticators(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Authenticators); i++ { + + if m.Authenticators[i] != nil { + + if swag.IsZero(m.Authenticators[i]) { // not required + return nil + } + + if err := m.Authenticators[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authenticators" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authenticators" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *RootUserParamsV3) contextValidateOauthProviders(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.OauthProviders); i++ { + + if m.OauthProviders[i] != nil { + + if swag.IsZero(m.OauthProviders[i]) { // not required + return nil + } + + if err := m.OauthProviders[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("oauthProviders" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("oauthProviders" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *RootUserParamsV3) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *RootUserParamsV3) UnmarshalBinary(b []byte) error { + var res RootUserParamsV3 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}