auth-vir
Version:
Auth made easy and secure via JWT cookies, CSRF tokens, and password hashing helpers.
24 lines (23 loc) • 937 B
TypeScript
import { type AnyDuration, type FullDate, type UtcTimezone } from 'date-vir';
/**
* Determines if enough time has passed since the JWT was issued to start refreshing the session.
*
* Visually, this check looks like this:
*
* I====R===========E
*
* - I = JWT issued time (from the JWT's `iat` claim)
* - R = session refreshing is available now (I + sessionRefreshStartTime)
* - E = JWT expiration
* - `=` between R and E = the time frame in which the return value is `true`.
*
* @category Auth : Host
*/
export declare function isSessionRefreshReady({ now, jwtIssuedAt, sessionRefreshStartTime, }: {
/** The current time. */
now?: Readonly<FullDate<UtcTimezone>> | undefined;
/** When the JWT was issued (`iat` claim). */
jwtIssuedAt: Readonly<FullDate<UtcTimezone>>;
/** How long after JWT issuance before refreshing is available. */
sessionRefreshStartTime: Readonly<AnyDuration>;
}): boolean;