diff --git a/turnkey_client/lib/turnkey_client.rb b/turnkey_client/lib/turnkey_client.rb index d6c3662..490495a 100644 --- a/turnkey_client/lib/turnkey_client.rb +++ b/turnkey_client/lib/turnkey_client.rb @@ -91,12 +91,14 @@ require 'turnkey_client/models/create_sub_organization_intent_v4' require 'turnkey_client/models/create_sub_organization_intent_v5' require 'turnkey_client/models/create_sub_organization_intent_v6' +require 'turnkey_client/models/create_sub_organization_intent_v7' require 'turnkey_client/models/create_sub_organization_request' require 'turnkey_client/models/create_sub_organization_result' require 'turnkey_client/models/create_sub_organization_result_v3' require 'turnkey_client/models/create_sub_organization_result_v4' require 'turnkey_client/models/create_sub_organization_result_v5' require 'turnkey_client/models/create_sub_organization_result_v6' +require 'turnkey_client/models/create_sub_organization_result_v7' require 'turnkey_client/models/create_user_tag_intent' require 'turnkey_client/models/create_user_tag_request' require 'turnkey_client/models/create_user_tag_result' @@ -223,6 +225,9 @@ require 'turnkey_client/models/init_import_wallet_intent' require 'turnkey_client/models/init_import_wallet_request' require 'turnkey_client/models/init_import_wallet_result' +require 'turnkey_client/models/init_otp_auth_intent' +require 'turnkey_client/models/init_otp_auth_request' +require 'turnkey_client/models/init_otp_auth_result' require 'turnkey_client/models/init_user_email_recovery_intent' require 'turnkey_client/models/init_user_email_recovery_request' require 'turnkey_client/models/init_user_email_recovery_result' @@ -239,6 +244,9 @@ require 'turnkey_client/models/oauth_request' require 'turnkey_client/models/oauth_result' require 'turnkey_client/models/operator' +require 'turnkey_client/models/otp_auth_intent' +require 'turnkey_client/models/otp_auth_request' +require 'turnkey_client/models/otp_auth_result' require 'turnkey_client/models/pagination' require 'turnkey_client/models/path_format' require 'turnkey_client/models/payload_encoding' @@ -259,6 +267,7 @@ require 'turnkey_client/models/root_user_params' require 'turnkey_client/models/root_user_params_v2' require 'turnkey_client/models/root_user_params_v3' +require 'turnkey_client/models/root_user_params_v4' require 'turnkey_client/models/selector' require 'turnkey_client/models/selector_v2' require 'turnkey_client/models/set_organization_feature_intent' diff --git a/turnkey_client/lib/turnkey_client/api/features_api.rb b/turnkey_client/lib/turnkey_client/api/features_api.rb index 41e1a64..7a16082 100644 --- a/turnkey_client/lib/turnkey_client/api/features_api.rb +++ b/turnkey_client/lib/turnkey_client/api/features_api.rb @@ -16,7 +16,7 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # Remove Organization Feature - # Removes an organization feature + # Removes an organization feature. This activity must be approved by the current root quorum. # @param body # @param [Hash] opts the optional parameters # @return [ActivityResponse] @@ -26,7 +26,7 @@ def remove_organization_feature(body, opts = {}) end # Remove Organization Feature - # Removes an organization feature + # Removes an organization feature. This activity must be approved by the current root quorum. # @param body # @param [Hash] opts the optional parameters # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers @@ -74,7 +74,7 @@ def remove_organization_feature_with_http_info(body, opts = {}) return data, status_code, headers end # Set Organization Feature - # Sets an organization feature + # Sets an organization feature. This activity must be approved by the current root quorum. # @param body # @param [Hash] opts the optional parameters # @return [ActivityResponse] @@ -84,7 +84,7 @@ def set_organization_feature(body, opts = {}) end # Set Organization Feature - # Sets an organization feature + # Sets an organization feature. This activity must be approved by the current root quorum. # @param body # @param [Hash] opts the optional parameters # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers diff --git a/turnkey_client/lib/turnkey_client/api/organizations_api.rb b/turnkey_client/lib/turnkey_client/api/organizations_api.rb index 5a47bcc..738c674 100644 --- a/turnkey_client/lib/turnkey_client/api/organizations_api.rb +++ b/turnkey_client/lib/turnkey_client/api/organizations_api.rb @@ -248,7 +248,7 @@ def get_sub_org_ids_with_http_info(body, opts = {}) return data, status_code, headers end # Update Root Quorum - # Set the threshold and members of the root quorum. This must be approved by the current root quorum. + # Set the threshold and members of the root quorum. This activity must be approved by the current root quorum. # @param body # @param [Hash] opts the optional parameters # @return [ActivityResponse] @@ -258,7 +258,7 @@ def update_root_quorum(body, opts = {}) end # Update Root Quorum - # Set the threshold and members of the root quorum. This must be approved by the current root quorum. + # Set the threshold and members of the root quorum. This activity must be approved by the current root quorum. # @param body # @param [Hash] opts the optional parameters # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers diff --git a/turnkey_client/lib/turnkey_client/api/users_api.rb b/turnkey_client/lib/turnkey_client/api/users_api.rb index 24d6f43..5fec3cd 100644 --- a/turnkey_client/lib/turnkey_client/api/users_api.rb +++ b/turnkey_client/lib/turnkey_client/api/users_api.rb @@ -421,6 +421,64 @@ def get_users_with_http_info(body, opts = {}) end return data, status_code, headers end + # Init OTP auth + # Initiate an OTP auth activity + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def init_otp_auth(body, opts = {}) + data, _status_code, _headers = init_otp_auth_with_http_info(body, opts) + data + end + + # Init OTP auth + # Initiate an OTP auth activity + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def init_otp_auth_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.init_otp_auth ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UsersApi.init_otp_auth" + end + # resource path + local_var_path = '/public/v1/submit/init_otp_auth' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(body) + + return_type = opts[:return_type] || 'ActivityResponse' + + auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth'] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type) + + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsersApi#init_otp_auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Oauth # Authenticate a user with an Oidc token (Oauth) - BETA # @param body @@ -479,6 +537,64 @@ def oauth_with_http_info(body, opts = {}) end return data, status_code, headers end + # OTP auth + # Authenticate a user with an OTP code sent via email or SMS + # @param body + # @param [Hash] opts the optional parameters + # @return [ActivityResponse] + def otp_auth(body, opts = {}) + data, _status_code, _headers = otp_auth_with_http_info(body, opts) + data + end + + # OTP auth + # Authenticate a user with an OTP code sent via email or SMS + # @param body + # @param [Hash] opts the optional parameters + # @return [Array<(ActivityResponse, Integer, Hash)>] ActivityResponse data, response status code and response headers + def otp_auth_with_http_info(body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: UsersApi.otp_auth ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling UsersApi.otp_auth" + end + # resource path + local_var_path = '/public/v1/submit/otp_auth' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:body] || @api_client.object_to_http_body(body) + + return_type = opts[:return_type] || 'ActivityResponse' + + auth_names = opts[:auth_names] || ['ApiKeyAuth', 'AuthenticatorAuth'] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type) + + if @api_client.config.debugging + @api_client.config.logger.debug "API called: UsersApi#otp_auth\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end # Update User # Update a User in an existing Organization # @param body diff --git a/turnkey_client/lib/turnkey_client/models/activity_type.rb b/turnkey_client/lib/turnkey_client/models/activity_type.rb index af741ce..92194a7 100644 --- a/turnkey_client/lib/turnkey_client/models/activity_type.rb +++ b/turnkey_client/lib/turnkey_client/models/activity_type.rb @@ -88,6 +88,9 @@ class ActivityType DELETE_WALLETS = 'ACTIVITY_TYPE_DELETE_WALLETS'.freeze CREATE_READ_WRITE_SESSION_V2 = 'ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2'.freeze DELETE_SUB_ORGANIZATION = 'ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION'.freeze + INIT_OTP_AUTH = 'ACTIVITY_TYPE_INIT_OTP_AUTH'.freeze + OTP_AUTH = 'ACTIVITY_TYPE_OTP_AUTH'.freeze + CREATE_SUB_ORGANIZATION_V7 = 'ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7'.freeze # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/turnkey_client/lib/turnkey_client/models/address_format.rb b/turnkey_client/lib/turnkey_client/models/address_format.rb index 526ed0e..1f08fe7 100644 --- a/turnkey_client/lib/turnkey_client/models/address_format.rb +++ b/turnkey_client/lib/turnkey_client/models/address_format.rb @@ -40,6 +40,12 @@ class AddressFormat BITCOIN_REGTEST_P2_WPKH = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2WPKH'.freeze BITCOIN_REGTEST_P2_WSH = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2WSH'.freeze BITCOIN_REGTEST_P2_TR = 'ADDRESS_FORMAT_BITCOIN_REGTEST_P2TR'.freeze + SEI = 'ADDRESS_FORMAT_SEI'.freeze + XLM = 'ADDRESS_FORMAT_XLM'.freeze + DOGE_MAINNET = 'ADDRESS_FORMAT_DOGE_MAINNET'.freeze + DOGE_TESTNET = 'ADDRESS_FORMAT_DOGE_TESTNET'.freeze + TON_V3_R2 = 'ADDRESS_FORMAT_TON_V3R2'.freeze + TON_V4_R2 = 'ADDRESS_FORMAT_TON_V4R2'.freeze # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v7.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v7.rb new file mode 100644 index 0000000..2c21f54 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_intent_v7.rb @@ -0,0 +1,292 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class CreateSubOrganizationIntentV7 + # Name for this sub-organization + attr_accessor :sub_organization_name + + # Root users to create within this sub-organization + attr_accessor :root_users + + # The threshold of unique approvals to reach root quorum. This value must be less than or equal to the number of root users + attr_accessor :root_quorum_threshold + + attr_accessor :wallet + + # Disable email recovery for the sub-organization + attr_accessor :disable_email_recovery + + # Disable email auth for the sub-organization + attr_accessor :disable_email_auth + + # Disable OTP SMS auth for the sub-organization + attr_accessor :disable_sms_auth + + # Disable OTP email auth for the sub-organization + attr_accessor :disable_otp_email_auth + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub_organization_name' => :'subOrganizationName', + :'root_users' => :'rootUsers', + :'root_quorum_threshold' => :'rootQuorumThreshold', + :'wallet' => :'wallet', + :'disable_email_recovery' => :'disableEmailRecovery', + :'disable_email_auth' => :'disableEmailAuth', + :'disable_sms_auth' => :'disableSmsAuth', + :'disable_otp_email_auth' => :'disableOtpEmailAuth' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sub_organization_name' => :'Object', + :'root_users' => :'Object', + :'root_quorum_threshold' => :'Object', + :'wallet' => :'Object', + :'disable_email_recovery' => :'Object', + :'disable_email_auth' => :'Object', + :'disable_sms_auth' => :'Object', + :'disable_otp_email_auth' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSubOrganizationIntentV7` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSubOrganizationIntentV7`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sub_organization_name') + self.sub_organization_name = attributes[:'sub_organization_name'] + end + + if attributes.key?(:'root_users') + if (value = attributes[:'root_users']).is_a?(Array) + self.root_users = value + end + end + + if attributes.key?(:'root_quorum_threshold') + self.root_quorum_threshold = attributes[:'root_quorum_threshold'] + end + + if attributes.key?(:'wallet') + self.wallet = attributes[:'wallet'] + end + + if attributes.key?(:'disable_email_recovery') + self.disable_email_recovery = attributes[:'disable_email_recovery'] + end + + if attributes.key?(:'disable_email_auth') + self.disable_email_auth = attributes[:'disable_email_auth'] + end + + if attributes.key?(:'disable_sms_auth') + self.disable_sms_auth = attributes[:'disable_sms_auth'] + end + + if attributes.key?(:'disable_otp_email_auth') + self.disable_otp_email_auth = attributes[:'disable_otp_email_auth'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @sub_organization_name.nil? + invalid_properties.push('invalid value for "sub_organization_name", sub_organization_name cannot be nil.') + end + + if @root_users.nil? + invalid_properties.push('invalid value for "root_users", root_users cannot be nil.') + end + + if @root_quorum_threshold.nil? + invalid_properties.push('invalid value for "root_quorum_threshold", root_quorum_threshold cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @sub_organization_name.nil? + return false if @root_users.nil? + return false if @root_quorum_threshold.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sub_organization_name == o.sub_organization_name && + root_users == o.root_users && + root_quorum_threshold == o.root_quorum_threshold && + wallet == o.wallet && + disable_email_recovery == o.disable_email_recovery && + disable_email_auth == o.disable_email_auth && + disable_sms_auth == o.disable_sms_auth && + disable_otp_email_auth == o.disable_otp_email_auth + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sub_organization_name, root_users, root_quorum_threshold, wallet, disable_email_recovery, disable_email_auth, disable_sms_auth, disable_otp_email_auth].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb index 30d1dcb..7351171 100644 --- a/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_request.rb @@ -129,7 +129,7 @@ def list_invalid_properties # @return true if the model is valid def valid? return false if @type.nil? - type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6']) + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7']) return false unless type_validator.valid?(@type) return false if @timestamp_ms.nil? return false if @organization_id.nil? @@ -140,7 +140,7 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) - validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6']) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7']) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end diff --git a/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v7.rb b/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v7.rb new file mode 100644 index 0000000..fa8885f --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/create_sub_organization_result_v7.rb @@ -0,0 +1,230 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class CreateSubOrganizationResultV7 + attr_accessor :sub_organization_id + + attr_accessor :wallet + + attr_accessor :root_user_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sub_organization_id' => :'subOrganizationId', + :'wallet' => :'wallet', + :'root_user_ids' => :'rootUserIds' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'sub_organization_id' => :'Object', + :'wallet' => :'Object', + :'root_user_ids' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::CreateSubOrganizationResultV7` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::CreateSubOrganizationResultV7`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sub_organization_id') + self.sub_organization_id = attributes[:'sub_organization_id'] + end + + if attributes.key?(:'wallet') + self.wallet = attributes[:'wallet'] + end + + if attributes.key?(:'root_user_ids') + if (value = attributes[:'root_user_ids']).is_a?(Array) + self.root_user_ids = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @sub_organization_id.nil? + invalid_properties.push('invalid value for "sub_organization_id", sub_organization_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @sub_organization_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sub_organization_id == o.sub_organization_id && + wallet == o.wallet && + root_user_ids == o.root_user_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sub_organization_id, wallet, root_user_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/credential_type.rb b/turnkey_client/lib/turnkey_client/models/credential_type.rb index 6c49053..349ed1f 100644 --- a/turnkey_client/lib/turnkey_client/models/credential_type.rb +++ b/turnkey_client/lib/turnkey_client/models/credential_type.rb @@ -18,6 +18,7 @@ class CredentialType API_KEY_SECP256_K1 = 'CREDENTIAL_TYPE_API_KEY_SECP256K1'.freeze EMAIL_AUTH_KEY_P256 = 'CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256'.freeze API_KEY_ED25519 = 'CREDENTIAL_TYPE_API_KEY_ED25519'.freeze + OTP_AUTH_KEY_P256 = 'CREDENTIAL_TYPE_OTP_AUTH_KEY_P256'.freeze # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/turnkey_client/lib/turnkey_client/models/feature_name.rb b/turnkey_client/lib/turnkey_client/models/feature_name.rb index 0ffac1f..ad586ec 100644 --- a/turnkey_client/lib/turnkey_client/models/feature_name.rb +++ b/turnkey_client/lib/turnkey_client/models/feature_name.rb @@ -17,6 +17,8 @@ class FeatureName EMAIL_AUTH = 'FEATURE_NAME_EMAIL_AUTH'.freeze EMAIL_RECOVERY = 'FEATURE_NAME_EMAIL_RECOVERY'.freeze WEBHOOK = 'FEATURE_NAME_WEBHOOK'.freeze + SMS_AUTH = 'FEATURE_NAME_SMS_AUTH'.freeze + OTP_EMAIL_AUTH = 'FEATURE_NAME_OTP_EMAIL_AUTH'.freeze # Builds the enum from string # @param [String] The enum value in the form of the string diff --git a/turnkey_client/lib/turnkey_client/models/init_otp_auth_intent.rb b/turnkey_client/lib/turnkey_client/models/init_otp_auth_intent.rb new file mode 100644 index 0000000..b5d892b --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/init_otp_auth_intent.rb @@ -0,0 +1,235 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class InitOtpAuthIntent + # Enum to specifiy whether to send OTP via SMS or email + attr_accessor :otp_type + + # Email or phone number to send the OTP code to + attr_accessor :contact + + attr_accessor :email_customization + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'otp_type' => :'otpType', + :'contact' => :'contact', + :'email_customization' => :'emailCustomization' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'otp_type' => :'Object', + :'contact' => :'Object', + :'email_customization' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::InitOtpAuthIntent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::InitOtpAuthIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'otp_type') + self.otp_type = attributes[:'otp_type'] + end + + if attributes.key?(:'contact') + self.contact = attributes[:'contact'] + end + + if attributes.key?(:'email_customization') + self.email_customization = attributes[:'email_customization'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @otp_type.nil? + invalid_properties.push('invalid value for "otp_type", otp_type cannot be nil.') + end + + if @contact.nil? + invalid_properties.push('invalid value for "contact", contact cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @otp_type.nil? + return false if @contact.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + otp_type == o.otp_type && + contact == o.contact && + email_customization == o.email_customization + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [otp_type, contact, email_customization].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/init_otp_auth_request.rb b/turnkey_client/lib/turnkey_client/models/init_otp_auth_request.rb new file mode 100644 index 0000000..82c8935 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/init_otp_auth_request.rb @@ -0,0 +1,288 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class InitOtpAuthRequest + attr_accessor :type + + # Timestamp (in milliseconds) of the request, used to verify liveness of user requests. + attr_accessor :timestamp_ms + + # Unique identifier for a given Organization. + attr_accessor :organization_id + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'timestamp_ms' => :'timestampMs', + :'organization_id' => :'organizationId', + :'parameters' => :'parameters' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'Object', + :'timestamp_ms' => :'Object', + :'organization_id' => :'Object', + :'parameters' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::InitOtpAuthRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::InitOtpAuthRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'timestamp_ms') + self.timestamp_ms = attributes[:'timestamp_ms'] + end + + if attributes.key?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @timestamp_ms.nil? + invalid_properties.push('invalid value for "timestamp_ms", timestamp_ms cannot be nil.') + end + + if @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.') + end + + if @parameters.nil? + invalid_properties.push('invalid value for "parameters", parameters cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_INIT_OTP_AUTH']) + return false unless type_validator.valid?(@type) + return false if @timestamp_ms.nil? + return false if @organization_id.nil? + return false if @parameters.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_INIT_OTP_AUTH']) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + timestamp_ms == o.timestamp_ms && + organization_id == o.organization_id && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, timestamp_ms, organization_id, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/init_otp_auth_result.rb b/turnkey_client/lib/turnkey_client/models/init_otp_auth_result.rb new file mode 100644 index 0000000..2dfe204 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/init_otp_auth_result.rb @@ -0,0 +1,211 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class InitOtpAuthResult + # Unique identifier for an OTP authentication + attr_accessor :otp_id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'otp_id' => :'otpId' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'otp_id' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::InitOtpAuthResult` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::InitOtpAuthResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'otp_id') + self.otp_id = attributes[:'otp_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @otp_id.nil? + invalid_properties.push('invalid value for "otp_id", otp_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @otp_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + otp_id == o.otp_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [otp_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/intent.rb b/turnkey_client/lib/turnkey_client/models/intent.rb index 023f036..9b8c6c2 100644 --- a/turnkey_client/lib/turnkey_client/models/intent.rb +++ b/turnkey_client/lib/turnkey_client/models/intent.rb @@ -164,6 +164,12 @@ class Intent attr_accessor :delete_sub_organization_intent + attr_accessor :init_otp_auth_intent + + attr_accessor :otp_auth_intent + + attr_accessor :create_sub_organization_intent_v7 + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -242,7 +248,10 @@ def self.attribute_map :'delete_private_keys_intent' => :'deletePrivateKeysIntent', :'delete_wallets_intent' => :'deleteWalletsIntent', :'create_read_write_session_intent_v2' => :'createReadWriteSessionIntentV2', - :'delete_sub_organization_intent' => :'deleteSubOrganizationIntent' + :'delete_sub_organization_intent' => :'deleteSubOrganizationIntent', + :'init_otp_auth_intent' => :'initOtpAuthIntent', + :'otp_auth_intent' => :'otpAuthIntent', + :'create_sub_organization_intent_v7' => :'createSubOrganizationIntentV7' } end @@ -324,7 +333,10 @@ def self.openapi_types :'delete_private_keys_intent' => :'Object', :'delete_wallets_intent' => :'Object', :'create_read_write_session_intent_v2' => :'Object', - :'delete_sub_organization_intent' => :'Object' + :'delete_sub_organization_intent' => :'Object', + :'init_otp_auth_intent' => :'Object', + :'otp_auth_intent' => :'Object', + :'create_sub_organization_intent_v7' => :'Object' } end @@ -652,6 +664,18 @@ def initialize(attributes = {}) if attributes.key?(:'delete_sub_organization_intent') self.delete_sub_organization_intent = attributes[:'delete_sub_organization_intent'] end + + if attributes.key?(:'init_otp_auth_intent') + self.init_otp_auth_intent = attributes[:'init_otp_auth_intent'] + end + + if attributes.key?(:'otp_auth_intent') + self.otp_auth_intent = attributes[:'otp_auth_intent'] + end + + if attributes.key?(:'create_sub_organization_intent_v7') + self.create_sub_organization_intent_v7 = attributes[:'create_sub_organization_intent_v7'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -747,7 +771,10 @@ def ==(o) delete_private_keys_intent == o.delete_private_keys_intent && delete_wallets_intent == o.delete_wallets_intent && create_read_write_session_intent_v2 == o.create_read_write_session_intent_v2 && - delete_sub_organization_intent == o.delete_sub_organization_intent + delete_sub_organization_intent == o.delete_sub_organization_intent && + init_otp_auth_intent == o.init_otp_auth_intent && + otp_auth_intent == o.otp_auth_intent && + create_sub_organization_intent_v7 == o.create_sub_organization_intent_v7 end # @see the `==` method @@ -759,7 +786,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [create_organization_intent, create_authenticators_intent, create_users_intent, create_private_keys_intent, sign_raw_payload_intent, create_invitations_intent, accept_invitation_intent, create_policy_intent, disable_private_key_intent, delete_users_intent, delete_authenticators_intent, delete_invitation_intent, delete_organization_intent, delete_policy_intent, create_user_tag_intent, delete_user_tags_intent, sign_transaction_intent, create_api_keys_intent, delete_api_keys_intent, approve_activity_intent, reject_activity_intent, create_private_key_tag_intent, delete_private_key_tags_intent, create_policy_intent_v2, set_payment_method_intent, activate_billing_tier_intent, delete_payment_method_intent, create_policy_intent_v3, create_api_only_users_intent, update_root_quorum_intent, update_user_tag_intent, update_private_key_tag_intent, create_authenticators_intent_v2, accept_invitation_intent_v2, create_organization_intent_v2, create_users_intent_v2, create_sub_organization_intent, create_sub_organization_intent_v2, update_allowed_origins_intent, create_private_keys_intent_v2, update_user_intent, update_policy_intent, set_payment_method_intent_v2, create_sub_organization_intent_v3, create_wallet_intent, create_wallet_accounts_intent, init_user_email_recovery_intent, recover_user_intent, set_organization_feature_intent, remove_organization_feature_intent, sign_raw_payload_intent_v2, sign_transaction_intent_v2, export_private_key_intent, export_wallet_intent, create_sub_organization_intent_v4, email_auth_intent, export_wallet_account_intent, init_import_wallet_intent, import_wallet_intent, init_import_private_key_intent, import_private_key_intent, create_policies_intent, sign_raw_payloads_intent, create_read_only_session_intent, create_oauth_providers_intent, delete_oauth_providers_intent, create_sub_organization_intent_v5, oauth_intent, create_api_keys_intent_v2, create_read_write_session_intent, email_auth_intent_v2, create_sub_organization_intent_v6, delete_private_keys_intent, delete_wallets_intent, create_read_write_session_intent_v2, delete_sub_organization_intent].hash + [create_organization_intent, create_authenticators_intent, create_users_intent, create_private_keys_intent, sign_raw_payload_intent, create_invitations_intent, accept_invitation_intent, create_policy_intent, disable_private_key_intent, delete_users_intent, delete_authenticators_intent, delete_invitation_intent, delete_organization_intent, delete_policy_intent, create_user_tag_intent, delete_user_tags_intent, sign_transaction_intent, create_api_keys_intent, delete_api_keys_intent, approve_activity_intent, reject_activity_intent, create_private_key_tag_intent, delete_private_key_tags_intent, create_policy_intent_v2, set_payment_method_intent, activate_billing_tier_intent, delete_payment_method_intent, create_policy_intent_v3, create_api_only_users_intent, update_root_quorum_intent, update_user_tag_intent, update_private_key_tag_intent, create_authenticators_intent_v2, accept_invitation_intent_v2, create_organization_intent_v2, create_users_intent_v2, create_sub_organization_intent, create_sub_organization_intent_v2, update_allowed_origins_intent, create_private_keys_intent_v2, update_user_intent, update_policy_intent, set_payment_method_intent_v2, create_sub_organization_intent_v3, create_wallet_intent, create_wallet_accounts_intent, init_user_email_recovery_intent, recover_user_intent, set_organization_feature_intent, remove_organization_feature_intent, sign_raw_payload_intent_v2, sign_transaction_intent_v2, export_private_key_intent, export_wallet_intent, create_sub_organization_intent_v4, email_auth_intent, export_wallet_account_intent, init_import_wallet_intent, import_wallet_intent, init_import_private_key_intent, import_private_key_intent, create_policies_intent, sign_raw_payloads_intent, create_read_only_session_intent, create_oauth_providers_intent, delete_oauth_providers_intent, create_sub_organization_intent_v5, oauth_intent, create_api_keys_intent_v2, create_read_write_session_intent, email_auth_intent_v2, create_sub_organization_intent_v6, delete_private_keys_intent, delete_wallets_intent, create_read_write_session_intent_v2, delete_sub_organization_intent, init_otp_auth_intent, otp_auth_intent, create_sub_organization_intent_v7].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/otp_auth_intent.rb b/turnkey_client/lib/turnkey_client/models/otp_auth_intent.rb new file mode 100644 index 0000000..9cab56c --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/otp_auth_intent.rb @@ -0,0 +1,266 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class OtpAuthIntent + # ID representing the result of an init OTP activity. + attr_accessor :otp_id + + # 6 digit OTP code sent out to a user's contact (email or SMS) + attr_accessor :otp_code + + # Client-side public key generated by the user, to which the OTP bundle (credentials) will be encrypted. + attr_accessor :target_public_key + + # Optional human-readable name for an API Key. If none provided, default to OTP Auth - + attr_accessor :api_key_name + + # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used. + attr_accessor :expiration_seconds + + # Invalidate all other previously generated OTP Auth API keys + attr_accessor :invalidate_existing + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'otp_id' => :'otpId', + :'otp_code' => :'otpCode', + :'target_public_key' => :'targetPublicKey', + :'api_key_name' => :'apiKeyName', + :'expiration_seconds' => :'expirationSeconds', + :'invalidate_existing' => :'invalidateExisting' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'otp_id' => :'Object', + :'otp_code' => :'Object', + :'target_public_key' => :'Object', + :'api_key_name' => :'Object', + :'expiration_seconds' => :'Object', + :'invalidate_existing' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::OtpAuthIntent` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::OtpAuthIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'otp_id') + self.otp_id = attributes[:'otp_id'] + end + + if attributes.key?(:'otp_code') + self.otp_code = attributes[:'otp_code'] + end + + if attributes.key?(:'target_public_key') + self.target_public_key = attributes[:'target_public_key'] + end + + if attributes.key?(:'api_key_name') + self.api_key_name = attributes[:'api_key_name'] + end + + if attributes.key?(:'expiration_seconds') + self.expiration_seconds = attributes[:'expiration_seconds'] + end + + if attributes.key?(:'invalidate_existing') + self.invalidate_existing = attributes[:'invalidate_existing'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @otp_id.nil? + invalid_properties.push('invalid value for "otp_id", otp_id cannot be nil.') + end + + if @otp_code.nil? + invalid_properties.push('invalid value for "otp_code", otp_code cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @otp_id.nil? + return false if @otp_code.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + otp_id == o.otp_id && + otp_code == o.otp_code && + target_public_key == o.target_public_key && + api_key_name == o.api_key_name && + expiration_seconds == o.expiration_seconds && + invalidate_existing == o.invalidate_existing + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [otp_id, otp_code, target_public_key, api_key_name, expiration_seconds, invalidate_existing].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/otp_auth_request.rb b/turnkey_client/lib/turnkey_client/models/otp_auth_request.rb new file mode 100644 index 0000000..c6a4953 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/otp_auth_request.rb @@ -0,0 +1,288 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class OtpAuthRequest + attr_accessor :type + + # Timestamp (in milliseconds) of the request, used to verify liveness of user requests. + attr_accessor :timestamp_ms + + # Unique identifier for a given Organization. + attr_accessor :organization_id + + attr_accessor :parameters + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'timestamp_ms' => :'timestampMs', + :'organization_id' => :'organizationId', + :'parameters' => :'parameters' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'Object', + :'timestamp_ms' => :'Object', + :'organization_id' => :'Object', + :'parameters' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::OtpAuthRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::OtpAuthRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'timestamp_ms') + self.timestamp_ms = attributes[:'timestamp_ms'] + end + + if attributes.key?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'parameters') + self.parameters = attributes[:'parameters'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @type.nil? + invalid_properties.push('invalid value for "type", type cannot be nil.') + end + + if @timestamp_ms.nil? + invalid_properties.push('invalid value for "timestamp_ms", timestamp_ms cannot be nil.') + end + + if @organization_id.nil? + invalid_properties.push('invalid value for "organization_id", organization_id cannot be nil.') + end + + if @parameters.nil? + invalid_properties.push('invalid value for "parameters", parameters cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @type.nil? + type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_OTP_AUTH']) + return false unless type_validator.valid?(@type) + return false if @timestamp_ms.nil? + return false if @organization_id.nil? + return false if @parameters.nil? + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_OTP_AUTH']) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type && + timestamp_ms == o.timestamp_ms && + organization_id == o.organization_id && + parameters == o.parameters + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type, timestamp_ms, organization_id, parameters].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/otp_auth_result.rb b/turnkey_client/lib/turnkey_client/models/otp_auth_result.rb new file mode 100644 index 0000000..2b45714 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/otp_auth_result.rb @@ -0,0 +1,231 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class OtpAuthResult + # Unique identifier for the authenticating User. + attr_accessor :user_id + + # Unique identifier for the created API key. + attr_accessor :api_key_id + + # HPKE encrypted credential bundle + attr_accessor :credential_bundle + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_id' => :'userId', + :'api_key_id' => :'apiKeyId', + :'credential_bundle' => :'credentialBundle' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_id' => :'Object', + :'api_key_id' => :'Object', + :'credential_bundle' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::OtpAuthResult` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::OtpAuthResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_id') + self.user_id = attributes[:'user_id'] + end + + if attributes.key?(:'api_key_id') + self.api_key_id = attributes[:'api_key_id'] + end + + if attributes.key?(:'credential_bundle') + self.credential_bundle = attributes[:'credential_bundle'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @user_id.nil? + invalid_properties.push('invalid value for "user_id", user_id cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @user_id.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_id == o.user_id && + api_key_id == o.api_key_id && + credential_bundle == o.credential_bundle + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_id, api_key_id, credential_bundle].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/result.rb b/turnkey_client/lib/turnkey_client/models/result.rb index c48bda6..522fb63 100644 --- a/turnkey_client/lib/turnkey_client/models/result.rb +++ b/turnkey_client/lib/turnkey_client/models/result.rb @@ -136,6 +136,12 @@ class Result attr_accessor :delete_sub_organization_result + attr_accessor :init_otp_auth_result + + attr_accessor :otp_auth_result + + attr_accessor :create_sub_organization_result_v7 + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -200,7 +206,10 @@ def self.attribute_map :'delete_private_keys_result' => :'deletePrivateKeysResult', :'delete_wallets_result' => :'deleteWalletsResult', :'create_read_write_session_result_v2' => :'createReadWriteSessionResultV2', - :'delete_sub_organization_result' => :'deleteSubOrganizationResult' + :'delete_sub_organization_result' => :'deleteSubOrganizationResult', + :'init_otp_auth_result' => :'initOtpAuthResult', + :'otp_auth_result' => :'otpAuthResult', + :'create_sub_organization_result_v7' => :'createSubOrganizationResultV7' } end @@ -268,7 +277,10 @@ def self.openapi_types :'delete_private_keys_result' => :'Object', :'delete_wallets_result' => :'Object', :'create_read_write_session_result_v2' => :'Object', - :'delete_sub_organization_result' => :'Object' + :'delete_sub_organization_result' => :'Object', + :'init_otp_auth_result' => :'Object', + :'otp_auth_result' => :'Object', + :'create_sub_organization_result_v7' => :'Object' } end @@ -540,6 +552,18 @@ def initialize(attributes = {}) if attributes.key?(:'delete_sub_organization_result') self.delete_sub_organization_result = attributes[:'delete_sub_organization_result'] end + + if attributes.key?(:'init_otp_auth_result') + self.init_otp_auth_result = attributes[:'init_otp_auth_result'] + end + + if attributes.key?(:'otp_auth_result') + self.otp_auth_result = attributes[:'otp_auth_result'] + end + + if attributes.key?(:'create_sub_organization_result_v7') + self.create_sub_organization_result_v7 = attributes[:'create_sub_organization_result_v7'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -621,7 +645,10 @@ def ==(o) delete_private_keys_result == o.delete_private_keys_result && delete_wallets_result == o.delete_wallets_result && create_read_write_session_result_v2 == o.create_read_write_session_result_v2 && - delete_sub_organization_result == o.delete_sub_organization_result + delete_sub_organization_result == o.delete_sub_organization_result && + init_otp_auth_result == o.init_otp_auth_result && + otp_auth_result == o.otp_auth_result && + create_sub_organization_result_v7 == o.create_sub_organization_result_v7 end # @see the `==` method @@ -633,7 +660,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [create_organization_result, create_authenticators_result, create_users_result, create_private_keys_result, create_invitations_result, accept_invitation_result, sign_raw_payload_result, create_policy_result, disable_private_key_result, delete_users_result, delete_authenticators_result, delete_invitation_result, delete_organization_result, delete_policy_result, create_user_tag_result, delete_user_tags_result, sign_transaction_result, delete_api_keys_result, create_api_keys_result, create_private_key_tag_result, delete_private_key_tags_result, set_payment_method_result, activate_billing_tier_result, delete_payment_method_result, create_api_only_users_result, update_root_quorum_result, update_user_tag_result, update_private_key_tag_result, create_sub_organization_result, update_allowed_origins_result, create_private_keys_result_v2, update_user_result, update_policy_result, create_sub_organization_result_v3, create_wallet_result, create_wallet_accounts_result, init_user_email_recovery_result, recover_user_result, set_organization_feature_result, remove_organization_feature_result, export_private_key_result, export_wallet_result, create_sub_organization_result_v4, email_auth_result, export_wallet_account_result, init_import_wallet_result, import_wallet_result, init_import_private_key_result, import_private_key_result, create_policies_result, sign_raw_payloads_result, create_read_only_session_result, create_oauth_providers_result, delete_oauth_providers_result, create_sub_organization_result_v5, oauth_result, create_read_write_session_result, create_sub_organization_result_v6, delete_private_keys_result, delete_wallets_result, create_read_write_session_result_v2, delete_sub_organization_result].hash + [create_organization_result, create_authenticators_result, create_users_result, create_private_keys_result, create_invitations_result, accept_invitation_result, sign_raw_payload_result, create_policy_result, disable_private_key_result, delete_users_result, delete_authenticators_result, delete_invitation_result, delete_organization_result, delete_policy_result, create_user_tag_result, delete_user_tags_result, sign_transaction_result, delete_api_keys_result, create_api_keys_result, create_private_key_tag_result, delete_private_key_tags_result, set_payment_method_result, activate_billing_tier_result, delete_payment_method_result, create_api_only_users_result, update_root_quorum_result, update_user_tag_result, update_private_key_tag_result, create_sub_organization_result, update_allowed_origins_result, create_private_keys_result_v2, update_user_result, update_policy_result, create_sub_organization_result_v3, create_wallet_result, create_wallet_accounts_result, init_user_email_recovery_result, recover_user_result, set_organization_feature_result, remove_organization_feature_result, export_private_key_result, export_wallet_result, create_sub_organization_result_v4, email_auth_result, export_wallet_account_result, init_import_wallet_result, import_wallet_result, init_import_private_key_result, import_private_key_result, create_policies_result, sign_raw_payloads_result, create_read_only_session_result, create_oauth_providers_result, delete_oauth_providers_result, create_sub_organization_result_v5, oauth_result, create_read_write_session_result, create_sub_organization_result_v6, delete_private_keys_result, delete_wallets_result, create_read_write_session_result_v2, delete_sub_organization_result, init_otp_auth_result, otp_auth_result, create_sub_organization_result_v7].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/root_user_params_v4.rb b/turnkey_client/lib/turnkey_client/models/root_user_params_v4.rb new file mode 100644 index 0000000..ee16d55 --- /dev/null +++ b/turnkey_client/lib/turnkey_client/models/root_user_params_v4.rb @@ -0,0 +1,282 @@ +=begin +#API Reference + +#Review our [API Introduction](../api-introduction) to get started. + +OpenAPI spec version: 1.0 + +Generated by: https://github.com/swagger-api/swagger-codegen.git +=end + +require 'date' + +module TurnkeyClient + class RootUserParamsV4 + # Human-readable name for a User. + attr_accessor :user_name + + # The user's email address. + attr_accessor :user_email + + # The user's phone number in E.164 format e.g. +13214567890 + attr_accessor :user_phone_number + + # A list of API Key parameters. + attr_accessor :api_keys + + # A list of Authenticator parameters. + attr_accessor :authenticators + + # A list of Oauth providers. + attr_accessor :oauth_providers + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'user_name' => :'userName', + :'user_email' => :'userEmail', + :'user_phone_number' => :'userPhoneNumber', + :'api_keys' => :'apiKeys', + :'authenticators' => :'authenticators', + :'oauth_providers' => :'oauthProviders' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'user_name' => :'Object', + :'user_email' => :'Object', + :'user_phone_number' => :'Object', + :'api_keys' => :'Object', + :'authenticators' => :'Object', + :'oauth_providers' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::RootUserParamsV4` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::RootUserParamsV4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'user_name') + self.user_name = attributes[:'user_name'] + end + + if attributes.key?(:'user_email') + self.user_email = attributes[:'user_email'] + end + + if attributes.key?(:'user_phone_number') + self.user_phone_number = attributes[:'user_phone_number'] + end + + if attributes.key?(:'api_keys') + if (value = attributes[:'api_keys']).is_a?(Array) + self.api_keys = value + end + end + + if attributes.key?(:'authenticators') + if (value = attributes[:'authenticators']).is_a?(Array) + self.authenticators = value + end + end + + if attributes.key?(:'oauth_providers') + if (value = attributes[:'oauth_providers']).is_a?(Array) + self.oauth_providers = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @user_name.nil? + invalid_properties.push('invalid value for "user_name", user_name cannot be nil.') + end + + if @api_keys.nil? + invalid_properties.push('invalid value for "api_keys", api_keys cannot be nil.') + end + + if @authenticators.nil? + invalid_properties.push('invalid value for "authenticators", authenticators cannot be nil.') + end + + if @oauth_providers.nil? + invalid_properties.push('invalid value for "oauth_providers", oauth_providers cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @user_name.nil? + return false if @api_keys.nil? + return false if @authenticators.nil? + return false if @oauth_providers.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + user_name == o.user_name && + user_email == o.user_email && + user_phone_number == o.user_phone_number && + api_keys == o.api_keys && + authenticators == o.authenticators && + oauth_providers == o.oauth_providers + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [user_name, user_email, user_phone_number, api_keys, authenticators, oauth_providers].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + TurnkeyClient.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end end +end diff --git a/turnkey_client/lib/turnkey_client/models/update_user_intent.rb b/turnkey_client/lib/turnkey_client/models/update_user_intent.rb index 8adbbd2..fd59d8f 100644 --- a/turnkey_client/lib/turnkey_client/models/update_user_intent.rb +++ b/turnkey_client/lib/turnkey_client/models/update_user_intent.rb @@ -24,13 +24,17 @@ class UpdateUserIntent # An updated list of User Tags to apply to this User. attr_accessor :user_tag_ids + # The user's phone number in E.164 format e.g. +13214567890 + attr_accessor :user_phone_number + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'user_id' => :'userId', :'user_name' => :'userName', :'user_email' => :'userEmail', - :'user_tag_ids' => :'userTagIds' + :'user_tag_ids' => :'userTagIds', + :'user_phone_number' => :'userPhoneNumber' } end @@ -40,7 +44,8 @@ def self.openapi_types :'user_id' => :'Object', :'user_name' => :'Object', :'user_email' => :'Object', - :'user_tag_ids' => :'Object' + :'user_tag_ids' => :'Object', + :'user_phone_number' => :'Object' } end @@ -82,6 +87,10 @@ def initialize(attributes = {}) self.user_tag_ids = value end end + + if attributes.key?(:'user_phone_number') + self.user_phone_number = attributes[:'user_phone_number'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -110,7 +119,8 @@ def ==(o) user_id == o.user_id && user_name == o.user_name && user_email == o.user_email && - user_tag_ids == o.user_tag_ids + user_tag_ids == o.user_tag_ids && + user_phone_number == o.user_phone_number end # @see the `==` method @@ -122,7 +132,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [user_id, user_name, user_email, user_tag_ids].hash + [user_id, user_name, user_email, user_tag_ids, user_phone_number].hash end # Builds the object from hash diff --git a/turnkey_client/lib/turnkey_client/models/user.rb b/turnkey_client/lib/turnkey_client/models/user.rb index b322f7a..53a411d 100644 --- a/turnkey_client/lib/turnkey_client/models/user.rb +++ b/turnkey_client/lib/turnkey_client/models/user.rb @@ -21,6 +21,9 @@ class User # The user's email address. attr_accessor :user_email + # The user's phone number in E.164 format e.g. +13214567890 + attr_accessor :user_phone_number + # A list of Authenticator parameters. attr_accessor :authenticators @@ -43,6 +46,7 @@ def self.attribute_map :'user_id' => :'userId', :'user_name' => :'userName', :'user_email' => :'userEmail', + :'user_phone_number' => :'userPhoneNumber', :'authenticators' => :'authenticators', :'api_keys' => :'apiKeys', :'user_tags' => :'userTags', @@ -58,6 +62,7 @@ def self.openapi_types :'user_id' => :'Object', :'user_name' => :'Object', :'user_email' => :'Object', + :'user_phone_number' => :'Object', :'authenticators' => :'Object', :'api_keys' => :'Object', :'user_tags' => :'Object', @@ -100,6 +105,10 @@ def initialize(attributes = {}) self.user_email = attributes[:'user_email'] end + if attributes.key?(:'user_phone_number') + self.user_phone_number = attributes[:'user_phone_number'] + end + if attributes.key?(:'authenticators') if (value = attributes[:'authenticators']).is_a?(Array) self.authenticators = value @@ -194,6 +203,7 @@ def ==(o) user_id == o.user_id && user_name == o.user_name && user_email == o.user_email && + user_phone_number == o.user_phone_number && authenticators == o.authenticators && api_keys == o.api_keys && user_tags == o.user_tags && @@ -211,7 +221,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [user_id, user_name, user_email, authenticators, api_keys, user_tags, oauth_providers, created_at, updated_at].hash + [user_id, user_name, user_email, user_phone_number, authenticators, api_keys, user_tags, oauth_providers, created_at, updated_at].hash end # Builds the object from hash diff --git a/turnkey_client_inputs/public_api.swagger.json b/turnkey_client_inputs/public_api.swagger.json index 019eb65..bb1d5b8 100644 --- a/turnkey_client_inputs/public_api.swagger.json +++ b/turnkey_client_inputs/public_api.swagger.json @@ -1521,6 +1521,32 @@ "tags": ["Wallets"] } }, + "/public/v1/submit/init_otp_auth": { + "post": { + "summary": "Init OTP auth", + "description": "Initiate an OTP auth activity", + "operationId": "InitOtpAuth", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ActivityResponse" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/InitOtpAuthRequest" + } + } + ], + "tags": ["Users"] + } + }, "/public/v1/submit/init_user_email_recovery": { "post": { "summary": "Init Email Recovery", @@ -1573,6 +1599,32 @@ "tags": ["Users"] } }, + "/public/v1/submit/otp_auth": { + "post": { + "summary": "OTP auth", + "description": "Authenticate a user with an OTP code sent via email or SMS", + "operationId": "OtpAuth", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ActivityResponse" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/OtpAuthRequest" + } + } + ], + "tags": ["Users"] + } + }, "/public/v1/submit/recover_user": { "post": { "summary": "Recover a user", @@ -1628,7 +1680,7 @@ "/public/v1/submit/remove_organization_feature": { "post": { "summary": "Remove Organization Feature", - "description": "Removes an organization feature", + "description": "Removes an organization feature. This activity must be approved by the current root quorum.", "operationId": "RemoveOrganizationFeature", "responses": { "200": { @@ -1654,7 +1706,7 @@ "/public/v1/submit/set_organization_feature": { "post": { "summary": "Set Organization Feature", - "description": "Sets an organization feature", + "description": "Sets an organization feature. This activity must be approved by the current root quorum.", "operationId": "SetOrganizationFeature", "responses": { "200": { @@ -1810,7 +1862,7 @@ "/public/v1/submit/update_root_quorum": { "post": { "summary": "Update Root Quorum", - "description": "Set the threshold and members of the root quorum. This must be approved by the current root quorum.", + "description": "Set the threshold and members of the root quorum. This activity must be approved by the current root quorum.", "operationId": "UpdateRootQuorum", "responses": { "200": { @@ -2131,7 +2183,10 @@ "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS", "ACTIVITY_TYPE_DELETE_WALLETS", "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2", - "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION" + "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION", + "ACTIVITY_TYPE_INIT_OTP_AUTH", + "ACTIVITY_TYPE_OTP_AUTH", + "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7" ] }, "AddressFormat": { @@ -2164,7 +2219,13 @@ "ADDRESS_FORMAT_BITCOIN_REGTEST_P2SH", "ADDRESS_FORMAT_BITCOIN_REGTEST_P2WPKH", "ADDRESS_FORMAT_BITCOIN_REGTEST_P2WSH", - "ADDRESS_FORMAT_BITCOIN_REGTEST_P2TR" + "ADDRESS_FORMAT_BITCOIN_REGTEST_P2TR", + "ADDRESS_FORMAT_SEI", + "ADDRESS_FORMAT_XLM", + "ADDRESS_FORMAT_DOGE_MAINNET", + "ADDRESS_FORMAT_DOGE_TESTNET", + "ADDRESS_FORMAT_TON_V3R2", + "ADDRESS_FORMAT_TON_V4R2" ] }, "Any": { @@ -3478,12 +3539,55 @@ }, "required": ["subOrganizationName", "rootUsers", "rootQuorumThreshold"] }, + "CreateSubOrganizationIntentV7": { + "type": "object", + "properties": { + "subOrganizationName": { + "type": "string", + "description": "Name for this sub-organization" + }, + "rootUsers": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/RootUserParamsV4" + }, + "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" + }, + "disableSmsAuth": { + "type": "boolean", + "description": "Disable OTP SMS auth for the sub-organization" + }, + "disableOtpEmailAuth": { + "type": "boolean", + "description": "Disable OTP email auth for the sub-organization" + } + }, + "required": ["subOrganizationName", "rootUsers", "rootQuorumThreshold"] + }, "CreateSubOrganizationRequest": { "type": "object", "properties": { "type": { "type": "string", - "enum": ["ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V6"] + "enum": ["ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7"] }, "timestampMs": { "type": "string", @@ -3494,7 +3598,7 @@ "description": "Unique identifier for a given Organization." }, "parameters": { - "$ref": "#/definitions/CreateSubOrganizationIntentV6" + "$ref": "#/definitions/CreateSubOrganizationIntentV7" } }, "required": ["type", "timestampMs", "organizationId", "parameters"] @@ -3591,6 +3695,24 @@ }, "required": ["subOrganizationId"] }, + "CreateSubOrganizationResultV7": { + "type": "object", + "properties": { + "subOrganizationId": { + "type": "string" + }, + "wallet": { + "$ref": "#/definitions/WalletResult" + }, + "rootUserIds": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["subOrganizationId"] + }, "CreateUserTagIntent": { "type": "object", "properties": { @@ -3838,7 +3960,8 @@ "CREDENTIAL_TYPE_RECOVER_USER_KEY_P256", "CREDENTIAL_TYPE_API_KEY_SECP256K1", "CREDENTIAL_TYPE_EMAIL_AUTH_KEY_P256", - "CREDENTIAL_TYPE_API_KEY_ED25519" + "CREDENTIAL_TYPE_API_KEY_ED25519", + "CREDENTIAL_TYPE_OTP_AUTH_KEY_P256" ] }, "Curve": { @@ -4730,7 +4853,9 @@ "FEATURE_NAME_WEBAUTHN_ORIGINS", "FEATURE_NAME_EMAIL_AUTH", "FEATURE_NAME_EMAIL_RECOVERY", - "FEATURE_NAME_WEBHOOK" + "FEATURE_NAME_WEBHOOK", + "FEATURE_NAME_SMS_AUTH", + "FEATURE_NAME_OTP_EMAIL_AUTH" ] }, "GetActivitiesRequest": { @@ -5461,6 +5586,55 @@ }, "required": ["importBundle"] }, + "InitOtpAuthIntent": { + "type": "object", + "properties": { + "otpType": { + "type": "string", + "description": "Enum to specifiy whether to send OTP via SMS or email" + }, + "contact": { + "type": "string", + "description": "Email or phone number to send the OTP code to" + }, + "emailCustomization": { + "$ref": "#/definitions/EmailCustomizationParams", + "description": "Optional parameters for customizing emails. If not provided, the default email will be used." + } + }, + "required": ["otpType", "contact"] + }, + "InitOtpAuthRequest": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["ACTIVITY_TYPE_INIT_OTP_AUTH"] + }, + "timestampMs": { + "type": "string", + "description": "Timestamp (in milliseconds) of the request, used to verify liveness of user requests." + }, + "organizationId": { + "type": "string", + "description": "Unique identifier for a given Organization." + }, + "parameters": { + "$ref": "#/definitions/InitOtpAuthIntent" + } + }, + "required": ["type", "timestampMs", "organizationId", "parameters"] + }, + "InitOtpAuthResult": { + "type": "object", + "properties": { + "otpId": { + "type": "string", + "description": "Unique identifier for an OTP authentication" + } + }, + "required": ["otpId"] + }, "InitUserEmailRecoveryIntent": { "type": "object", "properties": { @@ -5744,6 +5918,15 @@ }, "deleteSubOrganizationIntent": { "$ref": "#/definitions/DeleteSubOrganizationIntent" + }, + "initOtpAuthIntent": { + "$ref": "#/definitions/InitOtpAuthIntent" + }, + "otpAuthIntent": { + "$ref": "#/definitions/OtpAuthIntent" + }, + "createSubOrganizationIntentV7": { + "$ref": "#/definitions/CreateSubOrganizationIntentV7" } } }, @@ -5975,6 +6158,75 @@ "OPERATOR_CONTAINS_ALL" ] }, + "OtpAuthIntent": { + "type": "object", + "properties": { + "otpId": { + "type": "string", + "description": "ID representing the result of an init OTP activity." + }, + "otpCode": { + "type": "string", + "description": "6 digit OTP code sent out to a user's contact (email or SMS)" + }, + "targetPublicKey": { + "type": "string", + "description": "Client-side public key generated by the user, to which the OTP bundle (credentials) will be encrypted." + }, + "apiKeyName": { + "type": "string", + "description": "Optional human-readable name for an API Key. If none provided, default to OTP 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." + }, + "invalidateExisting": { + "type": "boolean", + "description": "Invalidate all other previously generated OTP Auth API keys" + } + }, + "required": ["otpId", "otpCode"] + }, + "OtpAuthRequest": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": ["ACTIVITY_TYPE_OTP_AUTH"] + }, + "timestampMs": { + "type": "string", + "description": "Timestamp (in milliseconds) of the request, used to verify liveness of user requests." + }, + "organizationId": { + "type": "string", + "description": "Unique identifier for a given Organization." + }, + "parameters": { + "$ref": "#/definitions/OtpAuthIntent" + } + }, + "required": ["type", "timestampMs", "organizationId", "parameters"] + }, + "OtpAuthResult": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "description": "Unique identifier for the authenticating User." + }, + "apiKeyId": { + "type": "string", + "description": "Unique identifier for the created API key." + }, + "credentialBundle": { + "type": "string", + "description": "HPKE encrypted credential bundle" + } + }, + "required": ["userId"] + }, "Pagination": { "type": "object", "properties": { @@ -6494,6 +6746,15 @@ }, "deleteSubOrganizationResult": { "$ref": "#/definitions/DeleteSubOrganizationResult" + }, + "initOtpAuthResult": { + "$ref": "#/definitions/InitOtpAuthResult" + }, + "otpAuthResult": { + "$ref": "#/definitions/OtpAuthResult" + }, + "createSubOrganizationResultV7": { + "$ref": "#/definitions/CreateSubOrganizationResultV7" } } }, @@ -6603,6 +6864,48 @@ }, "required": ["userName", "apiKeys", "authenticators", "oauthProviders"] }, + "RootUserParamsV4": { + "type": "object", + "properties": { + "userName": { + "type": "string", + "description": "Human-readable name for a User." + }, + "userEmail": { + "type": "string", + "description": "The user's email address." + }, + "userPhoneNumber": { + "type": "string", + "description": "The user's phone number in E.164 format e.g. +13214567890" + }, + "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": { @@ -7201,6 +7504,10 @@ "type": "string" }, "description": "An updated list of User Tags to apply to this User." + }, + "userPhoneNumber": { + "type": "string", + "description": "The user's phone number in E.164 format e.g. +13214567890" } }, "required": ["userId"] @@ -7310,6 +7617,10 @@ "type": "string", "description": "The user's email address." }, + "userPhoneNumber": { + "type": "string", + "description": "The user's phone number in E.164 format e.g. +13214567890" + }, "authenticators": { "type": "array", "items": {