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

Function new_token

python/oberon/bindings.py:211–227  ·  view source on GitHub ↗

Create a new token if the secret key is well-formed.

(secret_key: bytes, identifier: bytes)

Source from the content-addressed store, hash-verified

209
210
211def new_token(secret_key: bytes, identifier: bytes) -> bytes:
212 """Create a new token if the secret key is well-formed."""
213 sk = _encode_bytes(secret_key)
214 id = _encode_bytes(identifier)
215 token = FfiByteBuffer()
216 err = FfiError()
217
218 lib_fn = _get_func("oberon_new_token")
219 result = lib_fn(sk, id, byref(token), byref(err))
220 if result == 0:
221 out = _decode_bytes(token)
222 #_free_buffer(token)
223 return out
224 else:
225 message = string_at(err.message)
226 #_free_string(err)
227 raise Exception(message)
228
229
230def verify_token(token: bytes, public_key: bytes, identifier: bytes) -> bool:

Callers 2

bindings.pyFile · 0.70
new_tokenMethod · 0.70

Calls 5

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

Tested by

no test coverage detected