UNPKG

@waku/rln

Version:

RLN (Rate Limiting Nullifier) implementation for Waku

43 lines (42 loc) 1.68 kB
export declare class BytesUtils { /** * Switches endianness of a byte array */ static switchEndianness(bytes: Uint8Array): Uint8Array; /** * Builds a BigInt from a big-endian Uint8Array * @param bytes The big-endian bytes to convert * @returns The resulting BigInt in big-endian format */ static buildBigIntFromUint8ArrayBE(bytes: Uint8Array): bigint; /** * Switches endianness of a bigint value * @param value The bigint value to switch endianness for * @returns The bigint value with reversed endianness */ static switchEndiannessBigInt(value: bigint): bigint; /** * Converts a big-endian bigint to a 32-byte big-endian Uint8Array * @param value The big-endian bigint to convert * @returns A 32-byte big-endian Uint8Array */ static bigIntToUint8Array32BE(value: bigint): Uint8Array; /** * Writes an unsigned integer to a buffer in little-endian format */ static writeUIntLE(buf: Uint8Array, value: number, offset: number, byteLength: number, noAssert?: boolean): Uint8Array; /** * Fills with zeros to set length * @param array little endian Uint8Array * @param length amount to pad * @returns little endian Uint8Array padded with zeros to set length */ static zeroPadLE(array: Uint8Array, length: number): Uint8Array; static checkInt(buf: Uint8Array, value: number, offset: number, ext: number, max: number, min: number): void; /** * Concatenate Uint8Arrays * @param input * @returns concatenation of all Uint8Array received as input */ static concatenate(...input: Uint8Array[]): Uint8Array; }