/** * {@link createLiveActivityPusher} — the typed, zero-dependency APNs sender for * iOS Live Activities. Sends `update` / `end` to a per-activity update token and * `start` to a push-to-start token (iOS 17.2+), over a single reused HTTP/2 * session with a cached ES256 provider token. * * @packageDocumentation */ import { type ApnsPayload } from './payload'; import { type ApnsPriority, type ApnsResult, type EndOptions, type LiveActivityPusherConfig, type StartViaPushOptions, type UpdateOptions } from './types'; /** * A reusable Live Activity push sender bound to one app/environment. Create it * once at process start and share it; it keeps the HTTP/2 session and provider * token warm. Call {@link LiveActivityPusher.close} on shutdown. */ export interface LiveActivityPusher { /** * Push a content-state update to a running activity's per-activity token. * @param token - Hex update token from `activity.pushTokenUpdates`. */ update(token: string, options: UpdateOptions): Promise; /** * End a running activity (optionally with a final state and dismissal date). * @param token - Hex update token of the activity to end. */ end(token: string, options?: EndOptions): Promise; /** * Start a new activity via push (iOS 17.2+) using a push-to-start token. * `alert` is **required**; throws an {@link ApnsError} `invalid-argument` if * omitted. * @param pushToStartToken - Hex token from `Activity.pushToStartTokenUpdates`. */ startViaPush(pushToStartToken: string, options: StartViaPushOptions): Promise; /** * Send a pre-built APNs payload to a token. Escape hatch for advanced cases; * still enforces the 4 KB limit and standard headers. */ send(token: string, payload: ApnsPayload, options?: { priority?: ApnsPriority; expiration?: number; apnsId?: string; }): Promise; /** The Live Activity APNs topic in use (`.push-type.liveactivity`). */ readonly topic: string; /** Gracefully close the underlying HTTP/2 session. Idempotent. */ close(): Promise; } /** * Validate config and construct a {@link LiveActivityPusher}. * * @example * ```ts * import { createLiveActivityPusher } from 'react-native-live-activity-kit/server'; * * const pusher = createLiveActivityPusher({ * key: process.env.APNS_KEY!, // .p8 PEM contents * keyId: process.env.APNS_KEY_ID!, * teamId: process.env.APPLE_TEAM_ID!, * bundleId: 'com.acme.app', * production: true, * }); * * await pusher.update(token, { state: { title: 'Out for delivery', progress: 0.8 } }); * await pusher.close(); * ``` * * @throws {ApnsError} of kind `'invalid-argument'` when required credentials are * missing or the port is unsupported. */ export declare function createLiveActivityPusher(config: LiveActivityPusherConfig): LiveActivityPusher; //# sourceMappingURL=pusher.d.ts.map