summaryrefslogtreecommitdiff
path: root/battleNetApi/src/token.cpp
blob: a54136cf7c9df1ac46279b9471103b6f9d7e5bfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "token.hpp"

namespace bnet {
Token::Token() {}

std::optional<TokenText> Token::text() const { return _tokenText; }

std::optional<std::chrono::seconds> Token::expirationTime() const { return _expirationTime; }

Token &Token::setText(const TokenText &iTokenText) {
    _tokenText = iTokenText;
    return *this;
}

Token &Token::setLifetime(const std::chrono::seconds &iLifetime) {
    _expirationTime = iLifetime + currentTime();
    return *this;
}

Token &Token::setExpirationTime(const std::chrono::seconds &iExpirationTime) {
    _expirationTime = iExpirationTime;
    return *this;
}

bool Token::isExpired() { return _expirationTime <= currentTime(); }
} // namespace bnet