@pushforge/builder
Version:
A robust, cross-platform Web Push notification library that handles VAPID authentication and payload encryption following the Web Push Protocol standard. Works in Node.js 16+, Browsers, Deno, Bun and Cloudflare Workers.
12 lines (11 loc) • 685 B
TypeScript
import type { PushSubscription } from './types.js';
/**
* Encrypts the payload for a push notification using the provided keys and context.
*
* @param {CryptoKeyPair} localKeys - The local key pair used for encryption.
* @param {Uint8Array} salt - The salt used in the encryption process.
* @param {string} payload - The original payload to encrypt.
* @param {PushSubscription} target - The target push subscription containing client keys.
* @returns {Promise<ArrayBuffer>} A promise that resolves to the encrypted payload.
*/
export declare const encryptPayload: (localKeys: CryptoKeyPair, salt: Uint8Array, payload: string, target: PushSubscription) => Promise<ArrayBuffer>;