diff options
Diffstat (limited to 'include/odhtdb/LocalUserEncrypted.hpp')
-rw-r--r-- | include/odhtdb/LocalUserEncrypted.hpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/include/odhtdb/LocalUserEncrypted.hpp b/include/odhtdb/LocalUserEncrypted.hpp index c250d13..952892f 100644 --- a/include/odhtdb/LocalUserEncrypted.hpp +++ b/include/odhtdb/LocalUserEncrypted.hpp @@ -1,15 +1,15 @@ #pragma once -#include "User.hpp" #include "types.hpp" #include "Encryption.hpp" +#include "Signature.hpp" namespace odhtdb { struct EncryptedPrivateKey { u8 nonce[ENCRYPTION_NONCE_BYTE_SIZE]; - u8 encryptedPrivateKey[16 + PRIVATE_KEY_NUM_BYTES]; + u8 encryptedPrivateKey[ENCRYPTION_CHECKSUM_BYTE_SIZE + PRIVATE_KEY_NUM_BYTES]; EncryptedPrivateKey(); EncryptedPrivateKey(const EncryptedPrivateKey &other); @@ -19,15 +19,15 @@ namespace odhtdb }; // Local user with encrypted private key - class LocalUserEncrypted : public User + class LocalUserEncrypted { public: - static LocalUserEncrypted* create(const Signature::PublicKey &publicKey, const EncryptedPrivateKey &encryptedPrivateKey, const std::string &name, Group *group) + static LocalUserEncrypted* create(const Signature::PublicKey &publicKey, const EncryptedPrivateKey &encryptedPrivateKey, const std::string &name) { - return new LocalUserEncrypted(publicKey, encryptedPrivateKey, name, group); + return new LocalUserEncrypted(publicKey, encryptedPrivateKey, name); } - const Signature::PublicKey& getPublicKey() const override + const Signature::PublicKey& getPublicKey() const { return publicKey; } @@ -36,16 +36,22 @@ namespace odhtdb { return encryptedPrivateKey; } + + const std::string& getName() const + { + return name; + } private: - LocalUserEncrypted(const Signature::PublicKey &_publicKey, const EncryptedPrivateKey &_encryptedPrivateKey, const std::string &name, Group *group) : - User(User::Type::LOCAL_ENCRYPTED, name, group), + LocalUserEncrypted(const Signature::PublicKey &_publicKey, const EncryptedPrivateKey &_encryptedPrivateKey, const std::string &_name) : publicKey(_publicKey), - encryptedPrivateKey(_encryptedPrivateKey) + encryptedPrivateKey(_encryptedPrivateKey), + name(_name) { } private: Signature::PublicKey publicKey; EncryptedPrivateKey encryptedPrivateKey; + std::string name; }; } |