From b64bfcaaa3d0172a32e4d441d9507c189e592de7 Mon Sep 17 00:00:00 2001 From: decanus <7621705+decanus@users.noreply.github.com> Date: Mon, 13 Sep 2021 23:19:49 +0200 Subject: [PATCH] readd --- rln/librln.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 rln/librln.h diff --git a/rln/librln.h b/rln/librln.h new file mode 100644 index 0000000..8cca80a --- /dev/null +++ b/rln/librln.h @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +typedef struct RLN_Bn256 RLN_Bn256; + +/** + * Buffer struct is taken from + * https://github.com/celo-org/celo-threshold-bls-rs/blob/master/crates/threshold-bls-ffi/src/ffi.rs + */ +typedef struct Buffer { + const uint8_t *ptr; + uintptr_t len; +} Buffer; + +bool new_circuit_from_params(uintptr_t merkle_depth, + const struct Buffer *parameters_buffer, + struct RLN_Bn256 **ctx); + +bool generate_proof(const struct RLN_Bn256 *ctx, + const struct Buffer *input_buffer, + struct Buffer *output_buffer); + +bool verify(const struct RLN_Bn256 *ctx, + const struct Buffer *proof_buffer, + const struct Buffer *public_inputs_buffer, + uint32_t *result_ptr); + +bool hash(const struct RLN_Bn256 *ctx, + const struct Buffer *inputs_buffer, + const uintptr_t *input_len, + struct Buffer *output_buffer); + +bool key_gen(const struct RLN_Bn256 *ctx, struct Buffer *keypair_buffer);