UNPKG

@turnkey/encoding

Version:

Encoding utility functions

24 lines 1.28 kB
/** * Code modified from https://github.com/github/webauthn-json/blob/e932b3585fa70b0bd5b5a4012ba7dbad7b0a0d0f/src/webauthn-json/base64url.ts#L23 */ export declare const DEFAULT_JWK_MEMBER_BYTE_LENGTH = 32; export declare function stringToBase64urlString(input: string): string; export declare function hexStringToBase64url(input: string, length?: number): string; export declare function base64StringToBase64UrlEncodedString(input: string): string; export declare function uint8ArrayToHexString(input: Uint8Array): string; export declare const uint8ArrayFromHexString: (hexString: string, length?: number) => Uint8Array; /** * Converts a hex string to an ASCII string. * @param {string} hexString - The input hex string to convert. * @returns {string} - The converted ASCII string. */ export declare function hexToAscii(hexString: string): string; /** * Function to normalize padding of byte array with 0's to a target length. * * @param {Uint8Array} byteArray - The byte array to pad or trim. * @param {number} targetLength - The target length after padding or trimming. * @returns {Uint8Array} - The normalized byte array. */ export declare const normalizePadding: (byteArray: Uint8Array, targetLength: number) => Uint8Array; //# sourceMappingURL=index.d.ts.map