MCPcopy Create free account
hub / github.com/cryptidtech/oberon / create_proof

Function create_proof

python/oberon/bindings.py:286–348  ·  view source on GitHub ↗
(token: bytes, identifier: bytes, blindings: list[bytes], nonce: bytes)

Source from the content-addressed store, hash-verified

284
285
286def create_proof(token: bytes, identifier: bytes, blindings: list[bytes], nonce: bytes) -> bytes:
287 tk = _encode_bytes(token)
288 id = _encode_bytes(identifier)
289 n = _encode_bytes(nonce)
290 err = FfiError()
291 lib_fn = _get_func("oberon_create_proof_init")
292 lib_fn.restype = c_uint64
293
294 handle = lib_fn(byref(err))
295 if handle == 0:
296 message = string_at(err.message)
297 #_free_string(err)
298 raise Exception(message)
299
300 handle = c_uint64(handle)
301
302 lib_fn = _get_func("oberon_create_proof_set_token")
303 result = lib_fn(handle, tk, byref(err))
304 if result != 0:
305 message = string_at(err.message)
306 #_free_string(err)
307 _free_handle(handle, err)
308 raise Exception(message)
309
310 lib_fn = _get_func("oberon_create_proof_set_id")
311 result = lib_fn(handle, id, byref(err))
312 if result != 0:
313 message = string_at(err.message)
314 #_free_string(err)
315 _free_handle(handle, err)
316 raise Exception(message)
317
318 lib_fn = _get_func("oberon_create_proof_set_nonce")
319 result = lib_fn(handle, n, byref(err))
320 if result != 0:
321 message = string_at(err.message)
322 #_free_string(err)
323 _free_handle(handle, err)
324 raise Exception(message)
325
326 lib_fn = _get_func("oberon_create_proof_add_blinding")
327 for blinder in blindings:
328 b = _encode_bytes(blinder)
329 result = lib_fn(handle, b, byref(err))
330 if result != 0:
331 message = string_at(err.message)
332 #_free_string(err)
333 _free_handle(handle, err)
334 raise Exception(message)
335
336 lib_fn = _get_func("oberon_create_proof_finish")
337 proof = FfiByteBuffer()
338 result = lib_fn(handle, byref(proof), byref(err))
339 if result == 0:
340 _free_handle(handle, err)
341 out = _decode_bytes(proof)
342 #_free_buffer(new)
343 return out

Callers 2

bindings.pyFile · 0.70
create_proofMethod · 0.70

Calls 6

_encode_bytesFunction · 0.85
FfiErrorClass · 0.85
_get_funcFunction · 0.85
_free_handleFunction · 0.85
FfiByteBufferClass · 0.85
_decode_bytesFunction · 0.85

Tested by

no test coverage detected