def __init__(self, api_uri="https://bitpay.com", insecure=False, pem=key_utils.generate_pem(), tokens={}): self.uri = api_uri self.verify = not(insecure) self.pem = pem self.client_id = key_utils.get_sin_from_pem(pem) self.tokens = tokens self.user_agent = 'bitpay-python'
def test_sin_from_pem(self): pem = '-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEICg7E4NN53YkaWuAwpoqjfAofjzKI7Jq1f532dX+0O6QoAcGBSuBBAAK\noUQDQgAEjZcNa6Kdz6GQwXcUD9iJ+t1tJZCx7hpqBuJV2/IrQBfue8jh8H7Q/4vX\nfAArmNMaGotTpjdnymWlMfszzXJhlw==\n-----END EC PRIVATE KEY-----\n' assert utils.get_sin_from_pem( pem) == 'TeyN4LPrXiG5t2yuSamKqP3ynVk3F52iHrX'