1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

BinaryCacheStore: Remove publicKeyFile argument

The public key can be derived from the secret key, so there's no need
for the user to supply it separately.
This commit is contained in:
Eelco Dolstra 2016-03-04 17:08:30 +01:00
parent 42bc395b63
commit af7cdb1096
7 changed files with 39 additions and 25 deletions

View file

@ -55,6 +55,17 @@ std::string SecretKey::signDetached(const std::string & data) const
#endif
}
PublicKey SecretKey::toPublicKey() const
{
#if HAVE_SODIUM
unsigned char pk[crypto_sign_PUBLICKEYBYTES];
crypto_sign_ed25519_sk_to_pk(pk, (unsigned char *) key.data());
return PublicKey(name, std::string((char *) pk, crypto_sign_PUBLICKEYBYTES));
#else
noSodium();
#endif
}
PublicKey::PublicKey(const string & s)
: Key(s)
{