UNPKG

@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.

32 lines (31 loc) 1.33 kB
/** * Encodes a string, ArrayBuffer, or Uint8Array into a Base64 URL format. * * This function handles both browser and Node.js environments by using * the appropriate encoding method based on the environment. * * @param {string | ArrayBuffer | Uint8Array} input - The input to encode. * @returns {string} The Base64 URL encoded string. */ export declare const base64UrlEncode: (input: string | ArrayBuffer | Uint8Array) => string; /** * Decodes a Base64 URL encoded string back to its original format. * * This function handles both browser and Node.js environments by using * the appropriate decoding method based on the environment. * * @param {string | undefined} s - The Base64 URL encoded string to decode. * @returns {string} The decoded data as a string. * @throws {Error} Throws an error if the input string is invalid. */ export declare const base64UrlDecodeString: (s: string | undefined) => string; /** * Decodes a Base64 URL encoded string into an ArrayBuffer. * * This function handles both browser and Node.js environments by using * the appropriate decoding method based on the environment. * * @param {string} input - The Base64 URL encoded string to decode. * @returns {ArrayBuffer} The decoded data as an ArrayBuffer. */ export declare const base64UrlDecode: (input: string) => ArrayBuffer;