From a19e68b9b029d5374604e4b81dcff161d4b465ba Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 10 Feb 2018 03:38:47 +0100 Subject: Add private/public key for users --- include/LocalUser.hpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'include/LocalUser.hpp') diff --git a/include/LocalUser.hpp b/include/LocalUser.hpp index 200f30f..04f483d 100644 --- a/include/LocalUser.hpp +++ b/include/LocalUser.hpp @@ -7,11 +7,23 @@ namespace odhtdb class LocalUser : public User { public: - static LocalUser* create(const std::string &name) + static LocalUser* create(const Signature::KeyPair &keyPair, const std::string &name) { - return new LocalUser(name); + return new LocalUser(keyPair, name); } + + const Signature::PublicKey& getPublicKey() const override + { + return keyPair.getPublicKey(); + } + + const Signature::PrivateKey& getPrivateKey() const + { + return keyPair.getPrivateKey(); + } + private: + LocalUser(const Signature::KeyPair &_keyPair, const std::string &name) : User(name), keyPair(_keyPair) {} private: - LocalUser(const std::string &name) : User(name){} + Signature::KeyPair keyPair; }; -} \ No newline at end of file +} -- cgit v1.2.3