paseto-ts
Version:
PASETO v4 (encrypt, decrypt, sign & verify) in TypeScript
27 lines (26 loc) • 1.11 kB
TypeScript
/**
* Convert a UTF-8 string to a Uint8Array
* @param {string} str String to convert
* @returns {Uint8Array} Uint8Array representation of the string
* @see https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode
*/
export declare function stringToUint8Array(str: string): Uint8Array;
/**
* Convert a Uint8Array to a UTF-8 string
* @param {Uint8Array} arr Uint8Array to convert
* @returns {string} String representation of the Uint8Array
*/
export declare function uint8ArrayToString(arr: Uint8Array): string;
/**
* Concatenate multiple Uint8Arrays
* @param {...Uint8Array} arrays Arrays to concatenate
* @returns {Uint8Array} Concatenated array
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array
*/
export declare function concat(...arrays: Uint8Array[]): Uint8Array;
/**
* Convert a string, object, or Uint8Array to a Uint8Array
* @param {string | object | Uint8Array} input Input to convert
* @returns {Uint8Array} Uint8Array representation of the input
*/
export declare function payloadToUint8Array(input: string | object | Uint8Array): Uint8Array;