1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-19 16:59:35 +01:00

Provide a structured JSON serialisation of hashes

This commit is contained in:
Eelco Dolstra 2025-03-13 18:52:29 +01:00
parent 2a2af3f72f
commit c515bc66f1
3 changed files with 19 additions and 2 deletions

View file

@ -5,6 +5,8 @@
#include "serialise.hh"
#include "file-system.hh"
#include <nlohmann/json_fwd.hpp>
namespace nix {
@ -209,6 +211,10 @@ std::optional<HashAlgorithm> parseHashAlgoOpt(std::string_view s);
*/
std::string_view printHashAlgo(HashAlgorithm ha);
/**
* Write a JSON serialisation of the format `{"algo":"<sha1|...>","base16":"<hex>"}`.
*/
void to_json(nlohmann::json & json, const Hash & hash);
union Ctx;