Skip to content

Commit

Permalink
Add support for the --send argument back into kli revoke. It got cl…
Browse files Browse the repository at this point in the history
…obbered in a merge. (WebOfTrust#725)

Signed-off-by: pfeairheller <[email protected]>
  • Loading branch information
pfeairheller authored Mar 26, 2024
1 parent c97212d commit d18fe3f
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/keri/app/cli/commands/vc/revoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ def revokeDo(self, tymth, tock=0.0):
aserder = serdering.SerderKERI(raw=bytes(anc))
self.registrar.revoke(creder, rserder, aserder)

senderHab = self.hab
if isinstance(self.hab, GroupHab):
senderHab = self.hab.mhab
smids = self.hab.db.signingMembers(pre=self.hab.pre)
smids.remove(self.hab.mhab.pre)

Expand All @@ -139,8 +137,13 @@ def revokeDo(self, tymth, tock=0.0):
while not self.registrar.complete(creder.said, sn=1):
yield self.tock

if self.hab.witnesser() and 'i' in creder.attrib:
recp = creder.attrib['i']
recps = [creder.attrib['i']] if 'i' in creder.attrib else []
if self.send is not None:
recps.extend(self.send)

senderHab = self.hab.mhab if isinstance(self.hab, GroupHab) else self.hab

if len(recps) > 0:
msgs = []
for msg in self.hby.db.clonePreIter(pre=creder.issuer):
serder = serdering.SerderKERI(raw=msg)
Expand All @@ -151,12 +154,21 @@ def revokeDo(self, tymth, tock=0.0):
atc = msg[serder.size:]
msgs.append((serder, atc))

for (serder, atc) in msgs:
self.postman.send(src=senderHab.pre, dest=recp, topic="credential", serder=serder,
attachment=atc)

last = msgs[-1][0]
while not self.postman.sent(said=last.said):
sent = 0
for send in recps:
if send in self.hby.kevers:
recp = send
else:
recp = self.org.find("alias", send)
if len(recp) != 1:
raise ValueError(f"invalid recipient {send}")
recp = recp[0]['id']
for (serder, atc) in msgs:
self.postman.send(src=senderHab.pre, dest=recp, topic="credential", serder=serder,
attachment=atc)
sent += 1

while not len(self.postman.cues) == sent:
yield self.tock

except kering.ValidationError as ex:
Expand Down

0 comments on commit d18fe3f

Please sign in to comment.