=begin #Cybrid Bank API ## Welcome Welcome to the Cybrid platform; enabling turnkey crypto banking services! In these documents, you will find information on the operations provided by our platform, as well as details on how our REST API operates more generally. Our complete set of APIs allows you to manage all your resources: your Organization, your banks and your identities. The complete set of APIs can be found on the following pages: | API | Description | |----------------------------------------------------------------|------------------------------| | [Organization API](https://organization.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage organizations | | [Bank API](https://bank.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage banks | | [Identities API](https://id.demo.cybrid.app/api/schema/swagger-ui) | APIs to manage identities | When you're ready, [request access](https://www.cybrid.xyz/access) to your Dashboard to view and administer your Organization. Once you've logged in, you can begin creating Banks, either for sandbox or production usage, and start enabling your customers to leverage DeFi and web3 with confidence. If you have any questions, please contact [Support](mailto:support@cybrid.app) at any time so that we can help. ## Authentication The Cybrid Platform uses OAuth 2.0 Bearer Tokens to authenticate requests to the platform. Credentials to create Organization and Bank tokens can be generated via your Dashboard ([request access](https://www.cybrid.xyz/access)). An Organization Token applies broadly to the whole Organization and all of its Banks, whereas, a Bank Token is specific to an individual Bank. Both Organization and Bank tokens can be created using the OAuth Client Credential Grant flow. Each Organization and Bank has its own unique Client ID and Secret that allows for machine-to-machine authentication. **Never share your Client ID or Secret publicly or in your source code repository** Your Client ID and Secret can be exchanged for a time-limited Bearer Token by interacting with the Cybrid Identity Provider or through interacting with the **Authorize** button in this document: ``` curl -X POST https://id.demo.cybrid.app/oauth/token -d '{ \"grant_type\": \"client_credentials\", \"client_id\": \"\", \"client_secret\": \"\", \"scope\": \"\" }' -H \"Content-Type: application/json\" ``` ## Scopes The Cybrid platform supports the use of scopes to control the level of access a token is limited to. Scopes do not grant access to resources; instead, they provide limits, in support of the least privilege principal. The following scopes are available on the platform and can be requested when generating either an Organization or a Bank token. Generally speaking, the _Read_ scope is required to read and list resources, the _Write_ scope is required to update a resource and the _Execute_ scope is required to create a resource. | Resource | Read scope | Write scope | Execute scope | Token Type | |---------------|--------------------|----------------------|-------------------|--------------------| | Organizations | organizations:read | organizations:write | | Organization/ Bank | | Banks | banks:read | banks:write | banks:execute | Organization/ Bank | | Customers | customers:read | customers:write | customers:execute | Bank | | Assets | prices:read | | | Bank | | Accounts | accounts:read | | accounts:execute | Bank | | Prices | prices:read | | | Bank | | Symbols | prices:read | | | Bank | | Quotes | quotes:read | | quotes:execute | Bank | | Trades | trades:read | | trades:execute | Bank | ## Organizations An Organization is meant to model the organization partnering with Cybrid to use our platform. An Organization does not directly interact with customers. Instead, an Organization has one or more banks, which encompass the financial service offerings of the platform. ## Banks A Bank is owned by an Organization and can be thought of as an environment or container for Customers and product offerings. An example of a Bank would be your customer facing banking website, or an internal staging environment for testing and integration. An Organization can have multiple banks, in sandbox or production environments. A sandbox Bank will be backed by stubbed data and process flows. For instance, identity record and funding source processes will be simulated rather than performed. ## Customers Customers represent your banking users on the platform. At present, we offer support for Individuals as Customers. Customers must be verified in our system before they can play any part on the platform. See the Identity Records section for more details on how a customer can be verified. Customers must also have an account to be able to transact. See the Accounts APIs for more details on setting up accounts for the customer. The version of the OpenAPI document: v0.18.11 Contact: support@cybrid.app Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.4.0 =end require 'date' require 'time' module CybridApiBank class PostVerificationKeyBankModel # The verification key's type. attr_accessor :type # The verification key's algorithm. attr_accessor :algorithm # DER encoded public key in Base64 format. attr_accessor :public_key # Value signed in the **signature** field. attr_accessor :nonce # Signature on **nonce** using PKCS1v15 padding and the SHA512 hashing algorithm in Base64 format. attr_accessor :signature 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', :'algorithm' => :'algorithm', :'public_key' => :'public_key', :'nonce' => :'nonce', :'signature' => :'signature' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'type' => :'String', :'algorithm' => :'String', :'public_key' => :'String', :'nonce' => :'String', :'signature' => :'String' } 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 `CybridApiBank::PostVerificationKeyBankModel` 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 `CybridApiBank::PostVerificationKeyBankModel`. 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?(:'algorithm') self.algorithm = attributes[:'algorithm'] end if attributes.key?(:'public_key') self.public_key = attributes[:'public_key'] end if attributes.key?(:'nonce') self.nonce = attributes[:'nonce'] end if attributes.key?(:'signature') self.signature = attributes[:'signature'] 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 @algorithm.nil? invalid_properties.push('invalid value for "algorithm", algorithm cannot be nil.') end if @public_key.nil? invalid_properties.push('invalid value for "public_key", public_key cannot be nil.') end if @public_key.to_s.length > 6000 invalid_properties.push('invalid value for "public_key", the character length must be smaller than or equal to 6000.') end if @public_key.to_s.length < 1 invalid_properties.push('invalid value for "public_key", the character length must be great than or equal to 1.') end if @nonce.nil? invalid_properties.push('invalid value for "nonce", nonce cannot be nil.') end if @nonce.to_s.length > 256 invalid_properties.push('invalid value for "nonce", the character length must be smaller than or equal to 256.') end if @nonce.to_s.length < 1 invalid_properties.push('invalid value for "nonce", the character length must be great than or equal to 1.') end if @signature.nil? invalid_properties.push('invalid value for "signature", signature cannot be nil.') end if @signature.to_s.length > 6000 invalid_properties.push('invalid value for "signature", the character length must be smaller than or equal to 6000.') end if @signature.to_s.length < 1 invalid_properties.push('invalid value for "signature", the character length must be great than or equal to 1.') 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('String', ["attestation"]) return false unless type_validator.valid?(@type) return false if @algorithm.nil? algorithm_validator = EnumAttributeValidator.new('String', ["RS512"]) return false unless algorithm_validator.valid?(@algorithm) return false if @public_key.nil? return false if @public_key.to_s.length > 6000 return false if @public_key.to_s.length < 1 return false if @nonce.nil? return false if @nonce.to_s.length > 256 return false if @nonce.to_s.length < 1 return false if @signature.nil? return false if @signature.to_s.length > 6000 return false if @signature.to_s.length < 1 true end # Custom attribute writer method checking allowed values (enum). # @param [Object] type Object to be assigned def type=(type) validator = EnumAttributeValidator.new('String', ["attestation"]) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end @type = type end # Custom attribute writer method checking allowed values (enum). # @param [Object] algorithm Object to be assigned def algorithm=(algorithm) validator = EnumAttributeValidator.new('String', ["RS512"]) unless validator.valid?(algorithm) fail ArgumentError, "invalid value for \"algorithm\", must be one of #{validator.allowable_values}." end @algorithm = algorithm end # Custom attribute writer method with validation # @param [Object] public_key Value to be assigned def public_key=(public_key) if public_key.nil? fail ArgumentError, 'public_key cannot be nil' end if public_key.to_s.length > 6000 fail ArgumentError, 'invalid value for "public_key", the character length must be smaller than or equal to 6000.' end if public_key.to_s.length < 1 fail ArgumentError, 'invalid value for "public_key", the character length must be great than or equal to 1.' end @public_key = public_key end # Custom attribute writer method with validation # @param [Object] nonce Value to be assigned def nonce=(nonce) if nonce.nil? fail ArgumentError, 'nonce cannot be nil' end if nonce.to_s.length > 256 fail ArgumentError, 'invalid value for "nonce", the character length must be smaller than or equal to 256.' end if nonce.to_s.length < 1 fail ArgumentError, 'invalid value for "nonce", the character length must be great than or equal to 1.' end @nonce = nonce end # Custom attribute writer method with validation # @param [Object] signature Value to be assigned def signature=(signature) if signature.nil? fail ArgumentError, 'signature cannot be nil' end if signature.to_s.length > 6000 fail ArgumentError, 'invalid value for "signature", the character length must be smaller than or equal to 6000.' end if signature.to_s.length < 1 fail ArgumentError, 'invalid value for "signature", the character length must be great than or equal to 1.' end @signature = signature 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 && algorithm == o.algorithm && public_key == o.public_key && nonce == o.nonce && signature == o.signature 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, algorithm, public_key, nonce, signature].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 attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif 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]])) 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 :Time Time.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 # models (e.g. Pet) or oneOf klass = CybridApiBank.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.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