@confluentinc/schemaregistry
Version:
Node.js client for Confluent Schema Registry
74 lines (73 loc) • 2.63 kB
TypeScript
/**
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Does near constant time byte array comparison.
* @param ba1 - The first bytearray to check.
* @param ba2 - The second bytearray to check.
* @returns If the array are equal.
*/
export declare function isEqual(ba1: Uint8Array<ArrayBuffer>, ba2: Uint8Array<ArrayBuffer>): boolean;
/**
* Returns a new array that is the result of joining the arguments.
*/
export declare function concat(...var_args: Uint8Array<ArrayBuffer>[]): Uint8Array<ArrayBuffer>;
/**
* Converts a non-negative integer number to a 64-bit big-endian byte array.
* @param value - The number to convert.
* @returns The number as a big-endian byte array.
* @throws {@link InvalidArgumentsException}
*/
export declare function fromNumber(value: number): Uint8Array<ArrayBuffer>;
/**
* Converts the hex string to a byte array.
*
* @param hex - the input
* @returns the byte array output
* @throws {@link InvalidArgumentsException}
*/
export declare function fromHex(hex: string): Uint8Array<ArrayBuffer>;
/**
* Converts a byte array to hex.
*
* @param bytes - the byte array input
* @returns hex the output
*/
export declare function toHex(bytes: Uint8Array<ArrayBuffer>): string;
/**
* Converts the Base64 string to a byte array.
*
* @param encoded - the base64 string
* @param opt_webSafe - True indicates we should use the alternative
* alphabet, which does not require escaping for use in URLs.
* @returns the byte array output
*/
export declare function fromBase64(encoded: string, opt_webSafe?: boolean): Uint8Array<ArrayBuffer>;
/**
* Base64 encode a byte array.
*
* @param bytes - the byte array input
* @param opt_webSafe - True indicates we should use the alternative
* alphabet, which does not require escaping for use in URLs.
* @returns base64 output
*/
export declare function toBase64(bytes: Uint8Array<ArrayBuffer>, opt_webSafe?: boolean): string;
/**
* Converts a byte string to a byte array. Only support ASCII and Latin-1
* strings, does not support multi-byte characters.
*
* @param str - the input
* @returns the byte array output
*/
export declare function fromByteString(str: string): Uint8Array<ArrayBuffer>;
/**
* Turns a byte array into the string given by the concatenation of the
* characters to which the numbers correspond. Each byte is corresponding to a
* character. Does not support multi-byte characters.
*
* @param bytes - Array of numbers representing
* characters.
* @returns Stringification of the array.
*/
export declare function toByteString(bytes: Uint8Array<ArrayBuffer>): string;