#ifndef GRADIDO_LOGIN_SERVER_CONTROLLER_USER_BACKUPS_INCLUDE #define GRADIDO_LOGIN_SERVER_CONTROLLER_USER_BACKUPS_INCLUDE #include "../model/table/UserBackups.h" #include "../Crypto/KeyPair.h" #include "Poco/SharedPtr.h" #include "TableControllerBase.h" namespace controller { class UserBackups : public TableControllerBase { public: ~UserBackups(); static Poco::AutoPtr create(int user_id, const std::string& passphrase); static std::vector> load(int user_id); inline bool deleteFromDB() { return mDBModel->deleteFromDB(); } inline Poco::AutoPtr getModel() { return _getModel(); } //! \return create keyPair from passphrase if not exist, else return existing pointer Poco::SharedPtr getKeyPair(); //! \brief adding newlines to make block format static std::string formatPassphrase(std::string passphrase, int targetLinesCount = 5); std::string getPassphrase(ServerConfig::Mnemonic_Types type); protected: UserBackups(model::table::UserBackups* dbModel); Poco::SharedPtr mKeyPair; }; } #endif //GRADIDO_LOGIN_SERVER_CONTROLLER_USER_BACKUPS_INCLUDE