#ifndef __SESSION_H__ #define __SESSION_H__ #include namespace login { class Session { public: static constexpr auto SESSION_LIFETIME = std::chrono::minutes(30); static constexpr size_t SESSION_ID_SIZE = 32; Session(int userId); // extend the session lifetime void extend(); void extend(std::chrono::time_point now); bool isExpired(std::chrono::time_point now); const int userId() { return m_userId; } const std::chrono::steady_clock::time_point expiresAt() {return m_expiresAt;} private: const int m_userId; std::chrono::steady_clock::time_point m_expiresAt; }; } #endif // __SESSION_H__