UNPKG

@inworld/web-core

Version:
14 lines (13 loc) 451 B
const TIME_DIFF_MS = 5 * 60 * 1000; // 5 minutes export class SessionToken { constructor(props) { this.token = props.token; this.type = props.type; this.expirationTime = props.expirationTime; this.sessionId = props.sessionId; } static isExpired(token) { const expirationTime = token.expirationTime; return (new Date(expirationTime).getTime() - new Date().getTime() <= TIME_DIFF_MS); } }