UNPKG

@fivesheepco/cloudflare-apns2

Version:

Client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.

34 lines (33 loc) 1.02 kB
import { ApnsError } from "./errors.js"; import { type Notification } from "./notifications/notification.js"; export declare enum Host { production = "api.push.apple.com", development = "api.sandbox.push.apple.com" } export interface SigningToken { value: string; timestamp: number; } export interface ApnsOptions { team: string; signingKey: string; keyId: string | JsonWebKey | CryptoKey; defaultTopic?: string; host?: Host | string; } export declare class ApnsClient { readonly team: string; readonly keyId: string | JsonWebKey | CryptoKey; readonly host: Host | string; readonly signingKey: string; readonly defaultTopic?: string; readonly keepAlive: boolean; private _token; constructor(options: ApnsOptions); sendMany(notifications: Notification[]): Promise<(Notification | { error: ApnsError; })[]>; send(notification: Notification): Promise<Notification>; private _handleServerResponse; private _getSigningToken; }