Beispiel #1
0
 def resolve(self, k):
     if is_address(k):
         return {
             'address': k,
             'type': 'address'
         }
     if k in self.keys():
         _type, addr = self[k]
         if _type == 'address':
             return {
                 'address': addr,
                 'type': 'contact'
             }
     raise Exception("Invalid Bitcoin address or alias", k)
Beispiel #2
0
def _validate_signed_claim(claim, claim_address, certificate):
    if not claim.has_signature:
        raise Exception("Claim is not signed")
    if not is_address(claim_address):
        raise Exception("Not given a valid claim address")
    try:
        if claim.validate_signature(claim_address, certificate.protobuf):
            return True
    except BadSignatureError:
        # print_msg("Signature for %s is invalid" % claim_id)
        return False
    except Exception as err:
        log.error("Signature for %s is invalid, reason: %s - %s", claim_address,
                  str(type(err)), err)
        return False
    return False
Beispiel #3
0
 def test_is_valid_address(self):
     self.assertTrue(is_address(self.main_address))
     self.assertFalse(is_address("not an address"))
Beispiel #4
0
 def test_is_address(self):
     self.assertFalse(is_address("something wrong"))
     self.assertFalse(is_address("123"))
     self.assertFalse(is_address("bYqee1aDgxA5oB4qr3PzjQ5xXzwGuyymH"))
     self.assertTrue(is_address("bYqee1aDgxA5oB4qr3PzjQ5xXzwGuyymH6"))
     self.assertTrue(is_address("bPJ9RPtyJSW9k5fGtJaxt3UhzUZSi59X9m"))
Beispiel #5
0
 def test_is_address(self):
     self.assertFalse(is_address("something wrong"))
     self.assertFalse(is_address("123"))
     self.assertFalse(is_address("bYqee1aDgxA5oB4qr3PzjQ5xXzwGuyymH"))
     self.assertTrue(is_address("bYqee1aDgxA5oB4qr3PzjQ5xXzwGuyymH6"))
     self.assertTrue(is_address("bPJ9RPtyJSW9k5fGtJaxt3UhzUZSi59X9m"))