mirror of https://github.com/nucypher/pyUmbral.git
Facility for clearing CFrags.
parent
3193d1541d
commit
b89decb8c1
|
@ -121,3 +121,15 @@ def test_capsule_length(prepared_capsule, kfrags):
|
|||
assert len(capsule) == counter
|
||||
cfrag = pre.reencrypt(kfrag, capsule)
|
||||
capsule.attach_cfrag(cfrag)
|
||||
|
||||
|
||||
def test_capsule_clear(prepared_capsule, kfrags):
|
||||
capsule = prepared_capsule
|
||||
|
||||
for counter, kfrag in enumerate(kfrags):
|
||||
assert len(capsule) == counter
|
||||
cfrag = pre.reencrypt(kfrag, capsule)
|
||||
capsule.attach_cfrag(cfrag)
|
||||
|
||||
capsule.clear_cfrags()
|
||||
assert len(capsule) == 0
|
|
@ -176,6 +176,9 @@ class Capsule:
|
|||
error_msg = "CFrag is not correct and cannot be attached to the Capsule"
|
||||
raise UmbralCorrectnessError(error_msg, [cfrag])
|
||||
|
||||
def clear_cfrags(self):
|
||||
self._attached_cfrags = set()
|
||||
|
||||
def first_cfrag(self):
|
||||
try:
|
||||
return list(self._attached_cfrags)[0]
|
||||
|
|
Loading…
Reference in New Issue