about summary refs log tree commit diff
path: root/src/libstore/crypto.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/crypto.hh')
-rw-r--r--src/libstore/crypto.hh12
1 files changed, 12 insertions, 0 deletions
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
        ‘<name>:<key-in-base64>’. */
     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<std::string, PublicKey> PublicKeys;