/** * Encode a string in Base64, cross-platform (no dependencies) * @param input String to encode * @returns Base64-encoded string */ export const encodeBase64 = (input: string) => { if (window !== undefined && btoa !== undefined) { return btoa(input); } else if (Buffer !== undefined) { return Buffer.from(input).toString('base64'); } return input; };