torrent-api-ts
Version:
[](https://github.com/semantic-release/semantic-release) [](https
33 lines • 713 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
class Token {
constructor(token) {
this.invalid = false;
this.token = token;
this.date = new Date();
}
/**
* Expired token
* @returns {Token}
*/
static expired() {
const token = new Token('');
token.invalid = true;
return token;
}
/**
* Has the token expired
* @returns {boolean}
*/
hasExpired() {
return this.invalid || (Date.now() - +this.date) / 60000 >= 14;
}
/**
* Invalidate a token
*/
invalidate() {
this.invalid = true;
}
}
exports.Token = Token;
//# sourceMappingURL=Token.js.map
;