import type { TokenCacheHook } from '../../types/index.js'; /** * FCM service-account configuration. `clientEmail` and `privateKey` map 1:1 * to the `client_email` and `private_key` fields of a Google service-account * JSON file (download from Firebase console). The PEM-encoded `privateKey` * is passed verbatim into Node's `crypto.createSign('RSA-SHA256')`. * * The wrapper holds no token state, so it signs + exchanges the OAuth access * token on every `.send()` / `sendMessage()` by default. A consumer who wants * amortization plugs in a `tokenCache: TokenCacheHook`; the wrapper memoizes * through the hook with key `'fcm:' + projectId + ':' + clientEmail`. */ export interface FcmConfig { projectId: string; /** Service-account `client_email`. */ clientEmail: string; /** Service-account `private_key` — PEM-encoded RSA private key. */ privateKey: string; /** * Optional consumer-provided token cache for the RS256 -> OAuth2 * access-token exchange. The wrapper holds no token state — pass * a hook here to amortize signing cost. The cache key is exactly * `'fcm:' + projectId + ':' + clientEmail` (deterministic, no time-varying * component). * On vendor 401 the wrapper does NOT evict; eviction is the consumer's * responsibility. */ tokenCache?: TokenCacheHook; /** Bring-your-own fetch implementation BYO-fetch contract. */ fetch?: typeof fetch; }