mirror of
https://github.com/logos-messaging/go-zerokit-rln-apple.git
synced 2026-01-02 13:23:13 +00:00
fix: add treepath config
This commit is contained in:
parent
05ef8aca57
commit
70f1ff564b
@ -41,28 +41,33 @@ func sliceToPtr(slice []byte) (*C.uchar, C.int) {
|
||||
}
|
||||
}
|
||||
|
||||
func NewWithParams(depth int, wasm []byte, zkey []byte, verifKey []byte) (*RLN, error) {
|
||||
func NewWithParams(depth int, wasm []byte, zkey []byte, verifKey []byte, treeConfig []byte) (*RLN, error) {
|
||||
wasmBuffer := toCBufferPtr(wasm)
|
||||
zkeyBuffer := toCBufferPtr(zkey)
|
||||
verifKeyBuffer := toCBufferPtr(verifKey)
|
||||
treeConfigBuffer := toCBufferPtr(treeConfig)
|
||||
r := &RLN{}
|
||||
|
||||
if !bool(C.new_with_params(C.uintptr_t(depth), wasmBuffer, zkeyBuffer, verifKeyBuffer, &r.ptr)) {
|
||||
if !bool(C.new_with_params(C.uintptr_t(depth), wasmBuffer, zkeyBuffer, verifKeyBuffer, treeConfigBuffer, &r.ptr)) {
|
||||
return nil, errors.New("failed to initialize")
|
||||
}
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func NewWithFolder(depth int, resourcesFolderPath string) (*RLN, error) {
|
||||
func New(depth uint, config []byte) (*RLN, error) {
|
||||
r := &RLN{}
|
||||
pathBuffer := toCBufferPtr([]byte(resourcesFolderPath))
|
||||
if !bool(C.new(C.uintptr_t(depth), pathBuffer, &r.ptr)) {
|
||||
configBuffer := toCBufferPtr(config)
|
||||
if !bool(C.new(C.uintptr_t(depth), configBuffer, &r.ptr)) {
|
||||
return nil, errors.New("failed to initialize")
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (r *RLN) Flush() bool {
|
||||
return bool(C.flush(r.ptr))
|
||||
}
|
||||
|
||||
func (r *RLN) SetTree(treeHeight uint) bool {
|
||||
return bool(C.set_tree(r.ptr, C.uintptr_t(treeHeight)))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user