AniLink - v3.0.0
    Preparing search index...

    Function computeTokenExpiry

    • Computes the absolute expiry time of a token response.

      Shared by both providers' expiry helpers so the validation and the arithmetic live in one place.

      Parameters

      • response: { expires_in: number }

        The token response to compute the expiry for.

      • now: number = ...

        The current time in milliseconds since the Unix epoch. Defaults to the time at which the helper is called.

      Returns Date

      The moment the access token expires.

      A TypeError when expires_in is not a positive finite number. 0, negative, NaN, or Infinity values produce an already-expired or nonsensical expiry that silently breaks proactive-refresh scheduling (and is one comparison-operator slip away from a refresh loop), so they are rejected instead.