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.smith_publickey_verify, buf, sig) return self._methodcall(lib.smith_publickey_verify_timestamp, buf, sig, max_age)
def validate_register_response(public_key, data, signature, max_age=60 * 15): rv = json.loads( decode_str( rustcall(lib.smith_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.smith_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 parse(cls, string): s = encode_str(string) ptr = rustcall(lib.smith_secretkey_parse, s) return cls._from_objptr(ptr)