def verify(self, buf, sig, max_age=None): buf = make_buf(buf) sig = encode_str(sig) if max_age is None: return self._methodcall(lib.semaphore_publickey_verify, buf, sig) return self._methodcall(lib.semaphore_publickey_verify_timestamp, buf, sig, max_age)
def verify(self, buf, sig, max_age=None): buf = make_buf(buf) sig = encode_str(sig) if max_age is None: return self._methodcall(lib.semaphore_publickey_verify, buf, sig) return self._methodcall( lib.semaphore_publickey_verify_timestamp, buf, sig, max_age )
def create_register_challenge(data, signature, max_age=60 * 15): rv = json.loads( decode_str( rustcall(lib.semaphore_create_register_challenge, make_buf(data), encode_str(signature), max_age))) return { 'relay_id': uuid.UUID(rv['relay_id']), 'public_key': PublicKey.parse(rv['public_key']), 'token': rv['token'], }
def validate_register_response(public_key, data, signature, max_age=60 * 15): rv = json.loads( decode_str( rustcall(lib.semaphore_validate_register_response, public_key._objptr, make_buf(data), encode_str(signature), max_age))) return { 'relay_id': uuid.UUID(rv['relay_id']), 'token': rv['token'], }
def validate_register_response(public_key, data, signature, max_age=60 * 15): rv = json.loads( decode_str( rustcall( lib.semaphore_validate_register_response, public_key._objptr, make_buf(data), encode_str(signature), max_age, ) ) ) return {"relay_id": uuid.UUID(rv["relay_id"]), "token": rv["token"]}
def create_register_challenge(data, signature, max_age=60 * 15): rv = json.loads( decode_str( rustcall( lib.semaphore_create_register_challenge, make_buf(data), encode_str(signature), max_age, ) ) ) return { "relay_id": uuid.UUID(rv["relay_id"]), "public_key": PublicKey.parse(rv["public_key"]), "token": rv["token"], }
def sign(self, value): buf = make_buf(value) return decode_str( self._methodcall(lib.semaphore_secretkey_sign, buf), free=True )
def get_register_response_relay_id(data): return decode_uuid( rustcall(lib.semaphore_get_register_response_relay_id, make_buf(data)) )