 
 open class AFSignedHTTPRequestSerializer : AFJSONRequestSerializer {
   
-  open var clientVersion = "3"
+  open var clientVersion = "4"
   open var clientId: String
   open var clientSecret: String
   

    let signatureParam = components.joined(separator: "\n")
    let signature = signatureParam.sha256HMAC(withKey: clientSecret)
    
    var signedParams = [String : Any]()
    
    signedParams["auth_version"] = self.clientVersion
    signedParams["auth_client_id"] = self.clientId
    signedParams["auth_timestamp"] = timestamp
    signedParams["auth_signature"] = signature
    
    return signedParams
  }
  
  open func parameterString(_ params : [String : Any?]) -> String {

    for (_, key) in sortedKeys.enumerated() {
      
      if let value = lowerCaseParams[key] {
        let encodedParamerer = encode(key, value: value)
        
        if !encodedParamerer.isEmpty {
          encodedParamerers.add(encodedParamerer)
        }
      } else {
        let encodedParamerer = encode(key, value: "")
        
        if !encodedParamerer.isEmpty {
          encodedParamerers.add(encodedParamerer)
        }
      }
    }
    
    return encodedParamerers.componentsJoined(by: "&")
  }
  
  func encode(_ key : String, value : Any?) -> String {
    
    if let currentValue = value as? [String : Any] {
      if currentValue.count == 0 {
        return String(format: "%@=%@", key.af_urlEncodedString(), "")
      }
      
      if let json = try? JSONSerialization.data(withJSONObject: currentValue, options: []), let jsonString = String(data: json, encoding: String.Encoding.utf8) {
        return String(format: "%@=%@", key.af_urlEncodedString(), jsonString.af_urlEncodedString())
      }
    } else if let currentValue = value as? Array<Any> {
      if currentValue.count == 0 {
        return String(format: "%@=%@", key.af_urlEncodedString(), "")
      }
      
      if let json = try? JSONSerialization.data(withJSONObject: currentValue, options: []), let jsonString = String(data: json, encoding: String.Encoding.utf8) {
        return String(format: "%@=%@", key.af_urlEncodedString(), jsonString.af_urlEncodedString())
      }
    } else if let currentValue = value as? String {
      return String(format: "%@=%@", key.af_urlEncodedString(), currentValue.af_urlEncodedString())
