| 153 | }; |
| 154 | |
| 155 | std::optional<std::map<std::string, std::string>> parseCBORMetadata(bytes const& _metadata) |
| 156 | { |
| 157 | try |
| 158 | { |
| 159 | TinyCBORParser parser(_metadata); |
| 160 | std::map<std::string, std::string> ret; |
| 161 | unsigned count = parser.mapItemCount(); |
| 162 | for (unsigned i = 0; i < count; i++) |
| 163 | { |
| 164 | std::string key = parser.readKey(); |
| 165 | std::string value = parser.readValue(); |
| 166 | ret[std::move(key)] = std::move(value); |
| 167 | } |
| 168 | return ret; |
| 169 | } |
| 170 | catch (CBORException const&) |
| 171 | { |
| 172 | return {}; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | bool isValidMetadata(std::string const& _serialisedMetadata) |
| 177 | { |
no test coverage detected