diff options
Diffstat (limited to 'battleNetApi/include/token.hpp')
| -rw-r--r-- | battleNetApi/include/token.hpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/battleNetApi/include/token.hpp b/battleNetApi/include/token.hpp index b913b2b..cc909a8 100644 --- a/battleNetApi/include/token.hpp +++ b/battleNetApi/include/token.hpp @@ -1,32 +1,13 @@ #pragma once -#include <chrono> #include <string> class Token { public: - explicit Token(const std::string &iTokenFilePath); + explicit Token(const std::string &iTokenText); std::string text() const; - const bool hasExpired() const; + void setText(const std::string &iTokenText); private: - const std::string mFilePath; //!< Path to the token file - const std::string mUsername; //!< Username for Battle.net API - const std::string mPassword; //!< Password for Battle.net API - std::string mToken; //!< Token value - - /** - * @return An access token that a user can use to perform API requests. - * First, the cache file is checked. - * A new token is computed if the current token lifetime expired, - * or if there is no token at all. - */ - std::string generateToken(); - void writeTokenToLocalFile(const std::pair<std::string, std::uint64_t> &iToken) const; - std::string getTokenFromLocalFile() const; - std::pair<std::string, std::uint64_t> getTokenWithApi() const; - std::chrono::seconds getCurrentTime() const; - static size_t curlCallbackStringOutput(void *iPtr, size_t iSize, size_t iNmemb, std::string *iUserData); - - static const std::uint16_t kTokenContentMinLength{10}; + std::string mTokenText; //!< Token value }; |
