/*!
 * Copyright (c) 2026 Vertex Software LLC. All rights reserved.
 */
import add from "date-fns/add";
import differenceInMilliseconds from "date-fns/differenceInMilliseconds";
import isAfter from "date-fns/isAfter";
import sub from "date-fns/sub";
export class Token {
    constructor(token, expiresIn, expiresAt) {
        this.token = token;
        this.expiresIn = expiresIn;
        this.expiresAt = expiresAt;
    }
    static create(token, expiresIn) {
        const expiresAt = add(new Date(), { seconds: expiresIn });
        return new Token(token, expiresIn, expiresAt);
    }
    hasExpired() {
        return isAfter(new Date(), this.expiresAt);
    }
    remainingTimeInMs(offsetInSeconds) {
        return differenceInMilliseconds(sub(this.expiresAt, { seconds: offsetInSeconds }), new Date());
    }
}
//# sourceMappingURL=token.js.map
