         }
     }
 
-    override public func verify(msg: NSData, signature: String, algorithm: String, key: NSData? = nil) -> Bool {
+    override func verify_signature(msg: NSData, signature: String, algorithm: String, key: NSData? = nil) -> Bool {
         if algorithm == "Ed25519" {
             if key == nil {
                 // use the "kid" field as base64 key string as key if no key provided.

        }
    }

    public func verify(msg: NSData, signature: String, algorithm: String, key: NSData? = nil) -> Bool {
        switch algorithm {
        case "none":  return key == nil // if "none" then the key shall be nil
        case "HS256": return msg.base64digest(HMACAlgorithm.SHA256, key: key!) == signature // TODO: key! => key...
        case "HS384": return msg.base64digest(HMACAlgorithm.SHA384, key: key!) == signature
        case "HS512": return msg.base64digest(HMACAlgorithm.SHA512, key: key!) == signature
        default:      return false
        }
    }
}

// MARK: - NaCl signatures

        return dumps(key_raw, error: error)
    }

    public func setnonce(length: Int = 32) -> String {
        var bytes = NSMutableData(length: length)!
        SecRandomCopyBytes(kSecRandomDefault, UInt(length), UnsafeMutablePointer<UInt8>(bytes.mutableBytes))
        let jti = bytes.base64SafeUrlEncode()
        self.body["jti"] = jti
        return jti
    }
    
    func signature(msg: NSData, algorithm: String, key: NSData) -> String? {
        switch algorithm {
        case "none":  return ""
        case "HS256": return msg.base64digest(HMACAlgorithm.SHA256, key: key)
