     }
     #endif
 
-    private static func encodeAny(_ any: Any) throws -> [UInt8] {
+    private static func encodeAny(_ any: Any?) throws -> [UInt8] {
         switch any {
         case is Bool:
             return (any as! Bool).encode()

        return res
    }

    public static func encodeMap<A: CBOREncodable>(_ map: [A: Any]) throws -> [UInt8] {
        var res: [UInt8] = []
        res = map.count.encode()
        res[0] = res[0] | 0b101_00000

        }
    }

    private static func encodeMap<A: CBOREncodable>(_ map: [A: Any?], into res: inout [UInt8]) throws {
        let sortedKeysWithEncodedKeys = map.keys.map {
            (encoded: $0.encode(), key: $0)
        }.sorted(by: {
