mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
use default value in fetchers::PublicKey
json deserialization
This commit is contained in:
parent
c73172e986
commit
943a877a6a
1 changed files with 7 additions and 3 deletions
|
@ -419,9 +419,13 @@ namespace nlohmann {
|
||||||
using namespace nix;
|
using namespace nix;
|
||||||
|
|
||||||
fetchers::PublicKey adl_serializer<fetchers::PublicKey>::from_json(const json & json) {
|
fetchers::PublicKey adl_serializer<fetchers::PublicKey>::from_json(const json & json) {
|
||||||
auto type = optionalValueAt(json, "type").value_or("ssh-ed25519");
|
fetchers::PublicKey res = { };
|
||||||
auto key = valueAt(json, "key");
|
if (auto type = optionalValueAt(json, "type"))
|
||||||
return fetchers::PublicKey { getString(type), getString(key) };
|
res.type = getString(*type);
|
||||||
|
|
||||||
|
res.key = getString(valueAt(json, "key"));
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void adl_serializer<fetchers::PublicKey>::to_json(json & json, fetchers::PublicKey p) {
|
void adl_serializer<fetchers::PublicKey>::to_json(json & json, fetchers::PublicKey p) {
|
||||||
|
|
Loading…
Reference in a new issue