mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
Move signatures from NarInfo to ValidPathInfo
This allows queryPathInfo() to return signatures.
This commit is contained in:
parent
cebc150b7c
commit
712b616a84
4 changed files with 21 additions and 11 deletions
|
@ -66,7 +66,7 @@ NarInfo::NarInfo(const std::string & s, const std::string & whence)
|
|||
else if (name == "System")
|
||||
system = value;
|
||||
else if (name == "Sig")
|
||||
sig = value;
|
||||
sigs.insert(value);
|
||||
|
||||
pos = eol + 1;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ std::string NarInfo::to_string() const
|
|||
if (!system.empty())
|
||||
res += "System: " + system + "\n";
|
||||
|
||||
if (!sig.empty())
|
||||
for (auto sig : sigs)
|
||||
res += "Sig: " + sig + "\n";
|
||||
|
||||
return res;
|
||||
|
@ -123,12 +123,16 @@ Strings NarInfo::shortRefs() const
|
|||
|
||||
void NarInfo::sign(const SecretKey & secretKey)
|
||||
{
|
||||
sig = secretKey.signDetached(fingerprint());
|
||||
sigs.insert(secretKey.signDetached(fingerprint()));
|
||||
}
|
||||
|
||||
bool NarInfo::checkSignature(const PublicKeys & publicKeys) const
|
||||
unsigned int NarInfo::checkSignatures(const PublicKeys & publicKeys) const
|
||||
{
|
||||
return sig != "" && verifyDetached(fingerprint(), sig, publicKeys);
|
||||
unsigned int good = 0;
|
||||
for (auto & sig : sigs)
|
||||
if (verifyDetached(fingerprint(), sig, publicKeys))
|
||||
good++;
|
||||
return good;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue