UNPKG

@bit-gpt/h402

Version:

BitGPT's 402 open protocol for blockchain-native payments

26 lines 1.09 kB
/** * Safely encodes a string to base64 format. * * This function works in both browser and Node.js environments by using * the appropriate encoding method for each environment. It includes error * handling to provide clear error messages if encoding fails. * * @param {string} data - The string data to encode to base64 * @returns {string} The base64 encoded string * @throws {Error} If data is empty or if encoding fails */ declare function safeBase64Encode(data: string): string; /** * Safely decodes a base64 string to its original format. * * This function works in both browser and Node.js environments by using * the appropriate decoding method for each environment. It includes error * handling to provide clear error messages if decoding fails. * * @param {string} data - The base64 encoded string to decode * @returns {string} The decoded string in UTF-8 format * @throws {Error} If data is empty or if decoding fails */ declare function safeBase64Decode(data: string): string; export { safeBase64Encode, safeBase64Decode }; //# sourceMappingURL=base64.d.ts.map