chore: expose get_leaf

This commit is contained in:
Richard Ramos 2023-07-31 14:01:45 -04:00
parent 13b66414cd
commit 6df4912fe3
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760

View File

@ -222,3 +222,14 @@ func (r *RLN) GetRoot() ([]byte, error) {
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)), nil
}
func (r *RLN) GetLeaf(index uint) ([]byte, error) {
var output []byte
out := toBuffer(output)
if !bool(C.get_leaf(r.ptr, C.uintptr_t(index), &out)) {
return nil, errors.New("could not get the leaf")
}
return C.GoBytes(unsafe.Pointer(out.ptr), C.int(out.len)), nil
}