UNPKG

@alessiofrittoli/crypto-encoder

Version:
43 lines (40 loc) 1.32 kB
import { CoerceToUint8ArrayInput } from '@alessiofrittoli/crypto-buffer'; /** * Base64 Utility static class. * */ declare class Base64 { /** * Encode a string or Buffer to a base64/base64url string. * * @param data The data to encode. * @param normalize ( Optional ) Whether to normalize the string to base64url. Default: `true`. * * @returns The encoded base64url ( or base64 if `normalize` is set to false ) string. */ static encode(data: CoerceToUint8ArrayInput, normalize?: boolean): string; /** * Decode a base64url data. * * @param data The data to decode. * * @returns The decoded base64url Buffer. */ static decode(data: CoerceToUint8ArrayInput): Uint8Array<ArrayBufferLike> | Buffer<ArrayBuffer>; /** * Normalize a base64 encoded string to base64url. * * @param string The string to normalize. * @returns The normalized string. */ static fromBase64(string: string, normalize?: boolean): string; /** * Normalize a base64url encoded string to base64. * * @param string The string to normalize. * @returns The normalized string. */ static fromBase64url(string: string): string; static toString: (input: CoerceToUint8ArrayInput) => string; } export { Base64 };