From af7cdb1096dd12f0ca06d78f5e5a3f5e9f57b3a8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 4 Mar 2016 17:08:30 +0100 Subject: 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. --- src/libstore/crypto.hh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/libstore/crypto.hh') diff --git a/src/libstore/crypto.hh b/src/libstore/crypto.hh index a1489e753649..33b79cb2e8fe 100644 --- a/src/libstore/crypto.hh +++ b/src/libstore/crypto.hh @@ -15,19 +15,31 @@ struct Key ‘:’. */ Key(const std::string & s); +protected: + Key(const std::string & name, const std::string & key) + : name(name), key(key) { } }; +struct PublicKey; + struct SecretKey : Key { SecretKey(const std::string & s); /* Return a detached signature of the given string. */ std::string signDetached(const std::string & s) const; + + PublicKey toPublicKey() const; }; struct PublicKey : Key { PublicKey(const std::string & data); + +private: + PublicKey(const std::string & name, const std::string & key) + : Key(name, key) { } + friend class SecretKey; }; typedef std::map PublicKeys; -- cgit 1.4.1