feat(notifications): mint JWT pool for native fetcher; log API response

- Mint BACKGROUND_JWT_POOL_SIZE (90 + 10) distinct background JWTs with
  unique jti; pass jwtTokens from nativeFetcherConfig into configureNativeFetcher.
- Android TimeSafariNativeFetcher: overload configure with jwtTokenPool;
  select bearer via epoch day mod pool size; fall back to primary jwtToken.
- Log truncated plansLastUpdatedBetween response at DEBUG for prefetch debugging.
This commit is contained in:
Jose Olarte III
2026-03-30 17:25:50 +08:00
parent 9f44a53047
commit 2c8aa21fa5
4 changed files with 98 additions and 9 deletions

View File

@@ -1,9 +1,15 @@
/**
* JWT lifetime for native New Activity background prefetch (`configureNativeFetcher`).
* Phase A: single long-lived token minted in TS; see doc/plan-background-jwt-pool-and-expiry.md.
* Confirm max `exp` with Endorser before raising.
* See doc/plan-background-jwt-pool-and-expiry.md. Confirm max `exp` with Endorser before raising.
*/
export const BACKGROUND_JWT_EXPIRY_DAYS = 90;
export const BACKGROUND_JWT_EXPIRY_SECONDS =
BACKGROUND_JWT_EXPIRY_DAYS * 24 * 60 * 60;
/** Headroom for retries / tests; pool size should be ≥ expiryDays + buffer. */
export const BACKGROUND_JWT_POOL_BUFFER = 10;
/** Distinct JWT strings minted per configure (duplicate-JWT / daily slot). */
export const BACKGROUND_JWT_POOL_SIZE =
BACKGROUND_JWT_EXPIRY_DAYS + BACKGROUND_JWT_POOL_BUFFER;