Expose get_proof

This commit is contained in:
alrevuelta 2024-01-16 10:28:50 +01:00
parent 2d15ecc14e
commit ad40ef83a1
No known key found for this signature in database
GPG Key ID: F345C9F3CCDB886E

View File

@ -245,6 +245,17 @@ func (r *RLN) GetLeaf(index uint) ([]byte, error) {
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)), nil
}
func (r *RLN) GetProof(index uint) ([]byte, error) {
var output []byte
out := toBuffer(output)
if !bool(C.get_proof(r.ptr, C.uintptr_t(index), &out)) {
return nil, errors.New("could not get the proof")
}
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)), nil
}
func (r *RLN) LeavesSet() uint {
return uint(C.leaves_set(r.ptr))
}