CSRF-X Auth Library - v1.0.3
    Preparing search index...

    Function isSessionFresh

    • Checks if a cached session is still fresh based on its age.

      Parameters

      • session: SessionData

        The session to check.

      • maxAgeMs: number

        Maximum allowed age in milliseconds.

      Returns boolean

      true if the session's timestamp is within the last maxAgeMs milliseconds,
      otherwise false.

      A session is considered fresh if Date.now() - session.timestamp < maxAgeMs.
      This is a simple age‑based heuristic; it does not validate the session against
      the server.

      if (isSessionFresh(session, 3600000)) {
      console.log('Session is less than 1 hour old');
      }

      0.1.1