#ifndef __LOGINDB_H__ #define __LOGINDB_H__ #include #include #include "json.hpp" #include "utils.hpp" namespace login { struct User { int id; std::string username; std::vector salt; std::vector password_hash; std::string last_login; std::string created_at; // SQLite stores DATETIME as TEXT }; inline User newUser(const std::string& username){ return User {-1, username, {}, {}, utils::currentTime(), utils::currentTime()}; } NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(User, id, username, salt, password_hash, last_login, created_at) int createUser(const std::string& username, const std::string& password); std::optional getUser(const std::string& username); std::optional getVerifiedUser(const std::string& username, const std::string& password); } #endif // __LOGINDB_H__