#ifndef DGRID_AUTH_H #define DGRID_AUTH_H #include #include namespace DGrid { namespace SQL { using SQL_result = std::vector >; bool openDBconnection(); void cleanupDBconnection(); std::string quote_string(std::string s); bool exec_query(const std::string& query, SQL_result *result = nullptr); bool read_user(const std::string& username, std::string& hash, std::string& salt); bool save_user(const std::string username, const std::string& hash, const std::string& salt); bool drop_user(const std::string username); } // namespace SQL std::string generate_salt(); std::string calc_passwd_hash(const std::string& user, const std::string& passwd, const std::string& salt); bool checkUserPasswd(const std::string& user, const std::string& passwd, std::string& message); DGridResult createUser(const std::string& user, const std::string& passwd, std::string& message); DGridResult deleteUser(const std::string& user, std::string& message); } // namespace DGrid #endif // DGRID_SQL_H