• Retrieves the token expiration timestamp

    Gets the expiration time for the current access token. Dynamically imports the token module to avoid circular dependencies.

    This function:

    • Attempts to retrieve expiry from memory state first
    • Falls back to secure storage if not in memory
    • Rehydrates memory state from storage when needed
    • Returns null if no expiry information exists
    • Provides time in milliseconds since epoch format

    Returns Promise<null | number>

    Promise resolving to expiry timestamp (milliseconds since epoch) or null

    // Check if token expires soon and needs refresh
    const expiry = await getTokenExpiry();
    if (expiry) {
    const timeUntilExpiry = expiry - Date.now();
    if (timeUntilExpiry < 300000) { // Less than 5 minutes
    await refreshAccessToken();
    }
    }
    export async function getTokenExpiry(): Promise<number | null> {
    const mod = await import("./storage/token-operations");
    return mod.getTokenExpiry();
    }