Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
root, e1 = tree.evidence(key=cap_lookup_key)
_, e2 = tree.evidence(key=claim_lookup_key)
evidence_store = {e.identity(): e for e in e1+e2}
t2 = Tree(evidence_store, root)
assert t2.is_in(key=cap_lookup_key, item=encrypted_cap)
assert t2.is_in(key=claim_lookup_key, item=encrypted_claim)
# Serialize evidence:
evidence = []
for e in e1 + e2:
if isinstance(e, Leaf):
evidence += [(e.key, e.item, tree.store[e.item])]
elif isinstance(e, Branch):
evidence += [(e.pivot, e.left_branch, e.right_branch)]
else:
pass
import zlib
bin_evidence = encode(evidence)
bin_evidence_compressed = zlib.compress(bin_evidence, 9)
print("\t\tSize for one proof: %s bytes (compressed %s bytes)" %
(len(bin_evidence), len(bin_evidence_compressed)))
print("\t\tPayload:")
pprint(payload)