vanillae project reorganization

This commit is contained in:
2023-05-25 12:58:23 -06:00
parent 6c80c37efa
commit 35ef2e0b1d
274 changed files with 144239 additions and 18 deletions
@@ -0,0 +1,28 @@
/**
* Miscellaneous binary utility functions
*
* @module
*/
export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes };
/**
* Concatenate two arrays
*/
declare function concat(arr1: Uint8Array, arr2: Uint8Array): Uint8Array;
/**
* Cryptographically random bytes
*/
declare function strong_rand_bytes(how_many: number): Uint8Array;
/**
* Convert a byte array to a bigint
*
* Equivalent to `binary:decode_unsigned/1` from Erlang
*/
declare function bytes_to_bigint(bytes: Uint8Array): bigint;
/**
* Convert a bigint to a byte array
*
* Equivalent to `binary:encode_unsigned/1` from Erlang
*
* Requires input to be positive
*/
declare function bigint_to_bytes(q: bigint): Uint8Array;