Exemple #1
0
 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)
Exemple #2
0
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'],
    }
Exemple #3
0
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'],
    }
Exemple #4
0
 def sign(self, value):
     buf = make_buf(value)
     return decode_str(self._methodcall(lib.smith_secretkey_sign, buf),
                       free=True)
Exemple #5
0
def get_register_response_relay_id(data):
    return decode_uuid(
        rustcall(lib.smith_get_register_response_relay_id, make_buf(data)))