import type { PushResult } from '@stacksjs/types'; /** * Configure FCM with a service account * * Optional: without it, the credentials come from `config/services.ts` * (`FCM_PROJECT_ID`, `FCM_CLIENT_EMAIL`, `FCM_PRIVATE_KEY`). Anything set here * wins over config. */ export declare function configure(options: FCMConfig): void; /** Forget what `configure()` set. For tests, and for a process that rotates keys. */ export declare function resetConfiguration(): void; /** * A private key as it comes out of an env file. * * A service account JSON stores the PEM with `\n` escapes, and pasting it * into `.env` keeps them as two characters, so the base64 body arrives with * literal backslash-n sequences in it and `atob` rejects the key. Real * newlines pass through untouched. */ export declare function normalizePrivateKey(key: string): string; /** * The credentials a request uses: what `configure()` set, then the app's * `config/services.ts`. * * `config/services.ts` declared all three FCM values and nothing read them, so * an app that set the documented env vars got "not configured" back * (stacksjs/stacks#2857). Resolved per call, after the app's config has * loaded, so a value set in `config/services.ts` is never shadowed by the * framework default it replaced. */ export declare function resolveConfig(): Promise; /** * Build the signed JWT that Google's OAuth2 endpoint accepts as a service * account assertion. * * `nowSeconds` is a parameter rather than a `Date.now()` read so the encoding * can be asserted against a fixed claim set. */ export declare function buildServiceAccountAssertion(clientEmail: string, privateKey: string, nowSeconds: number): Promise; /** Forget every cached access token. For tests, and after rotating a key. */ export declare function clearAccessTokens(): void; /** * Send push notification via FCM v1 API (using service account) */ export declare function send(message: FCMMessage): Promise; /** * Send to multiple tokens */ export declare function sendMulticast(tokens: string[], message: Omit): Promise; /** * Send to a topic */ export declare function sendToTopic(topic: string, message: Omit): Promise; /** * Subscribe tokens to a topic */ export declare function subscribeToTopic(tokens: string[], topic: string): Promise; /** * Unsubscribe tokens from a topic */ export declare function unsubscribeFromTopic(tokens: string[], topic: string): Promise; declare const __dtsx_default_export__: { send: typeof send; sendMulticast: typeof sendMulticast; sendToTopic: typeof sendToTopic; subscribeToTopic: typeof subscribeToTopic; unsubscribeFromTopic: typeof unsubscribeFromTopic; configure: typeof configure }; export declare interface FCMMessage { to?: string topic?: string condition?: string notification?: { title: string body: string icon?: string image?: string sound?: string badge?: string clickAction?: string tag?: string } data?: Record priority?: 'high' | 'normal' ttl?: number collapseKey?: string } export declare interface FCMConfig { projectId?: string serviceAccount?: { clientEmail: string privateKey: string } } export { send as Send }; export default __dtsx_default_export__;