@@ -44,11 +44,6 @@ type ffi_RLNProof* = object
4444 share_y* : CFr # Shamir secret share y
4545 nullifier* : CFr # Message nullifier
4646
47- # # Merkle proof structure
48- type ffi_MerkleProof* = object
49- path_elements* : Vec [CFr ]
50- indices* : Vec [uint8 ]
51-
5247# #####################################################################
5348# # RLN Zerokit FFI2 APIs
5449# #####################################################################
@@ -61,13 +56,6 @@ proc ffi_key_gen*(output: ptr ffi_IdentityCredential): bool {.importc: "ffi_key_
6156# # Output is written directly to the ffi_IdentityCredential struct
6257# # Returns true on success, false on failure
6358
64- proc ffi_seeded_key_gen * (
65- seed: ptr Vec [uint8 ], output: ptr ffi_IdentityCredential
66- ): bool {.importc : " ffi_seeded_key_gen" .}
67-
68- # # Generates identity using a seed (hashed with Keccak256, then used with ChaCha20)
69- # # Returns true on success, false on failure
70-
7159# -------------------------------- Circuit/Context Initialization -----------------------------------------
7260
7361proc ffi_new * (config_path: cstring , ctx: ptr (ptr RLN )): bool {.importc : " ffi_new" .}
@@ -76,16 +64,6 @@ proc ffi_new*(config_path: cstring, ctx: ptr (ptr RLN)): bool {.importc: "ffi_ne
7664# # ctx: pointer to store the created RLN instance
7765# # Returns true on success, false on failure
7866
79- proc ffi_new_with_params * (
80- zkey: ptr Vec [uint8 ], graph: ptr Vec [uint8 ], ctx: ptr (ptr RLN )
81- ): bool {.importc : " ffi_new_with_params" .}
82-
83- # # Creates an RLN instance from raw circuit parameters
84- # # zkey: proving key data
85- # # graph: circuit graph data
86- # # ctx: pointer to store the created RLN instance
87- # # Returns true on success, false on failure
88-
8967# -------------------------------- Proof Generation -----------------------------------------
9068
9169proc ffi_generate_rln_proof * (
@@ -101,18 +79,6 @@ proc ffi_generate_rln_proof*(
10179# # output: structured proof output
10280# # Returns true on success, false on failure
10381
104- proc ffi_generate_rln_proof_stateless * (
105- zkey: ptr Vec [uint8 ],
106- graph: ptr Vec [uint8 ],
107- witness: ptr ffi_RLNWitnessInput,
108- signal: ptr Vec [uint8 ],
109- output: ptr ffi_RLNProof,
110- ): bool {.importc : " ffi_generate_rln_proof_stateless" .}
111-
112- # # Generates an RLN proof without maintaining context state
113- # # Useful for one-off proof generation
114- # # Returns true on success, false on failure
115-
11682# -------------------------------- Proof Verification -----------------------------------------
11783
11884proc ffi_verify_rln_proof * (
@@ -131,55 +97,6 @@ proc ffi_verify_rln_proof*(
13197# # Returns true if verification completed, false on error
13298# # Check is_valid for actual proof validity
13399
134- # -------------------------------- Merkle Tree Operations -----------------------------------------
135-
136- proc ffi_set_leaf * (
137- ctx: ptr RLN , index: csize_t , leaf: ptr CFr
138- ): bool {.importc : " ffi_set_leaf" .}
139-
140- # # Sets a leaf at the specified index in the Merkle tree
141- # # Returns true on success, false on failure
142-
143- proc ffi_get_leaf * (
144- ctx: ptr RLN , index: csize_t , output: ptr CFr
145- ): bool {.importc : " ffi_get_leaf" .}
146-
147- # # Gets the leaf at the specified index from the Merkle tree
148- # # Returns true on success, false on failure
149-
150- proc ffi_get_root * (ctx: ptr RLN , output: ptr CFr ): bool {.importc : " ffi_get_root" .}
151- # # Gets the current Merkle tree root
152- # # Returns true on success, false on failure
153-
154- proc ffi_get_proof * (
155- ctx: ptr RLN , index: csize_t , output: ptr ffi_MerkleProof
156- ): bool {.importc : " ffi_get_proof" .}
157-
158- # # Gets the Merkle proof for the leaf at the specified index
159- # # Returns true on success, false on failure
160-
161- proc ffi_verify_merkle_proof * (
162- ctx: ptr RLN , leaf: ptr CFr , proof: ptr ffi_MerkleProof, is_valid: ptr bool
163- ): bool {.importc : " ffi_verify_proof" .}
164-
165- # # Verifies a Merkle proof
166- # # is_valid: output parameter - true if proof is valid
167- # # Returns true if verification completed, false on error
168-
169- proc ffi_set_leaves * (
170- ctx: ptr RLN , start_index: csize_t , leaves: ptr Vec [CFr ]
171- ): bool {.importc : " ffi_set_leaves" .}
172-
173- # # Sets multiple leaves starting at start_index
174- # # Returns true on success, false on failure
175-
176- proc ffi_set_leaves_from * (
177- ctx: ptr RLN , start_index: csize_t , leaves: ptr Vec [CFr ]
178- ): bool {.importc : " ffi_set_leaves_from" .}
179-
180- # # Sets leaves from a specific index (alternative batch operation)
181- # # Returns true on success, false on failure
182-
183100# -------------------------------- Hashing Functions -----------------------------------------
184101
185102proc ffi_hash_to_field_le * (
@@ -190,13 +107,6 @@ proc ffi_hash_to_field_le*(
190107# # Used to map signals to field elements
191108# # Returns true on success, false on failure
192109
193- proc ffi_hash_to_field_be * (
194- input: ptr Vec [uint8 ], output: ptr CFr
195- ): bool {.importc : " ffi_hash_to_field_be" .}
196-
197- # # Hashes arbitrary bytes to a field element (big-endian)
198- # # Returns true on success, false on failure
199-
200110proc ffi_poseidon_hash_pair * (
201111 a: ptr CFr , b: ptr CFr
202112): ptr CFr {.importc : " ffi_poseidon_hash_pair" .}
@@ -212,54 +122,6 @@ proc cfr_to_bytes_le*(cfr: ptr CFr): Vec[uint8] {.importc: "cfr_to_bytes_le".}
212122# # Serializes a field element to bytes (little-endian)
213123# # Returns Vec[uint8] containing the serialized bytes
214124
215- proc cfr_to_bytes_be * (cfr: ptr CFr ): Vec [uint8 ] {.importc : " cfr_to_bytes_be" .}
216-
217- # # Serializes a field element to bytes (big-endian)
218- # # Returns Vec[uint8] containing the serialized bytes
219-
220- proc bytes_le_to_cfr * (bytes: ptr Vec [uint8 ]): ptr CFr {.importc : " bytes_le_to_cfr" .}
221-
222- # # Deserializes bytes (little-endian) to a field element
223- # # Returns pointer to boxed CFr (must be freed with cfr_free)
224-
225- proc bytes_be_to_cfr * (bytes: ptr Vec [uint8 ]): ptr CFr {.importc : " bytes_be_to_cfr" .}
226-
227- # # Deserializes bytes (big-endian) to a field element
228- # # Returns pointer to boxed CFr (must be freed with cfr_free)
229-
230- proc vec_cfr_to_bytes_le * (
231- vec: ptr Vec [CFr ]
232- ): Vec [uint8 ] {.importc : " vec_cfr_to_bytes_le" .}
233-
234- # # Serializes a vector of field elements to bytes (little-endian)
235- # # Returns Vec[uint8] containing the serialized bytes
236-
237- proc vec_cfr_to_bytes_be * (
238- vec: ptr Vec [CFr ]
239- ): Vec [uint8 ] {.importc : " vec_cfr_to_bytes_be" .}
240-
241- # # Serializes a vector of field elements to bytes (big-endian)
242- # # Returns Vec[uint8] containing the serialized bytes
243-
244- # # CResult type for functions that can return errors
245- type CResult * [T, E] = object
246- ok* : ptr T
247- err* : ptr E
248-
249- proc bytes_le_to_vec_cfr * (
250- bytes: ptr Vec [uint8 ]
251- ): CResult [ptr Vec [CFr ], cstring ] {.importc : " bytes_le_to_vec_cfr" .}
252-
253- # # Deserializes bytes (little-endian) to a vector of field elements
254- # # Returns CResult with either ok (ptr Vec[CFr]) or err (cstring)
255-
256- proc bytes_be_to_vec_cfr * (
257- bytes: ptr Vec [uint8 ]
258- ): CResult [ptr Vec [CFr ], cstring ] {.importc : " bytes_be_to_vec_cfr" .}
259-
260- # # Deserializes bytes (big-endian) to a vector of field elements
261- # # Returns CResult with either ok (ptr Vec[CFr]) or err (cstring)
262-
263125proc uint_to_cfr * (value: uint32 ): ptr CFr {.importc : " uint_to_cfr" .}
264126
265127# # Creates a field element from an unsigned integer
@@ -270,17 +132,10 @@ proc cfr_zero*(): ptr CFr {.importc: "cfr_zero".}
270132# # Creates a zero field element
271133# # Returns pointer to boxed CFr (must be freed with cfr_free)
272134
273- proc cfr_one * (): ptr CFr {.importc : " cfr_one" .}
274- # # Creates a one field element
275- # # Returns pointer to boxed CFr (must be freed with cfr_free)
276-
277135proc cfr_free * (cfr: ptr CFr ) {.importc : " cfr_free" .}
278136# # Frees a boxed CFr
279137# # Must be called for all CFr pointers returned by the API
280138
281- proc cfr_debug * (cfr: ptr CFr ): cstring {.importc : " cfr_debug" .}
282- # # Returns debug string representation of CFr
283-
284139# -------------------------------- Helper Procedures -----------------------------------------
285140
286141proc newVec * [T](data: seq [T]): Vec [T] =
0 commit comments