summaryrefslogtreecommitdiff
path: root/submodules/battleNetApi/include/token.hpp
diff options
context:
space:
mode:
authorAotrix <[email protected]>2025-11-17 13:30:23 +0100
committerAotrix <[email protected]>2025-11-17 13:30:23 +0100
commit9dab564d3aaabda88efda5e3289392d0be716084 (patch)
tree4d2d0188119ba33f29c0dc6c362c26a47a9e637d /submodules/battleNetApi/include/token.hpp
parentf78e3e1428f59fb96cb02cf6fbaad692a582f9d5 (diff)
changed subprojects to submodules
Diffstat (limited to 'submodules/battleNetApi/include/token.hpp')
-rw-r--r--submodules/battleNetApi/include/token.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/submodules/battleNetApi/include/token.hpp b/submodules/battleNetApi/include/token.hpp
new file mode 100644
index 0000000..e2e3088
--- /dev/null
+++ b/submodules/battleNetApi/include/token.hpp
@@ -0,0 +1,25 @@
+#include <chrono>
+#include <string>
+
+class Token {
+ public:
+ Token(const std::string &iTokenFilePath, const std::string &iUsername, const std::string &iPassword);
+ std::string toString() const;
+
+ 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
+ const std::string mToken; //!< Token value
+
+ std::string getValidToken() const;
+ void refreshToken() const;
+ void writeNewTokenToFile() const;
+ void writeTokenToFile(const std::string &iToken) const;
+ std::string getValidTokenWithApi() const;
+ std::chrono::seconds getCurrentTime() const;
+ std::string extractTokenWithRegex(const std::string &iText, const std::string &iRegex) const;
+ static size_t curlCallbackStringOutput(void *iPtr, size_t iSize, size_t iNmemb, std::string *iUserData);
+
+ friend class TokenTests;
+};