Skip to content

Commit

Permalink
Update to uses of seqno to ensure we are properly using hex string or…
Browse files Browse the repository at this point in the history
… int explicitly. (#162)

Signed-off-by: pfeairheller <[email protected]>
  • Loading branch information
pfeairheller authored Dec 27, 2023
1 parent fadc608 commit 087f62f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
13 changes: 10 additions & 3 deletions src/keria/app/credentialing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from keri.app import signing
from keri.app.habbing import SignifyGroupHab
from keri.core import coring, scheming, serdering
from keri.core.eventing import SealEvent
from keri.db import dbing

from keria.core import httping, longrunning
Expand Down Expand Up @@ -755,8 +754,6 @@ def issue(self, regk, iserder, anc):

vcid = iserder.ked["i"]
rseq = coring.Seqner(snh=iserder.ked["s"])
rseal = SealEvent(vcid, rseq.snh, iserder.said)
rseal = dict(i=rseal.i, s=rseal.s, d=rseal.d)

if not isinstance(hab, SignifyGroupHab): # not a multisig group
seqner = coring.Seqner(sn=hab.kever.sner.num)
Expand Down Expand Up @@ -822,6 +819,16 @@ def revoke(self, regk, rserder, anc):
return vcid, rseq.sn

def complete(self, pre, sn=0):
""" Determine if registry event (inception, issuance, revocation, etc.) is finished validation
Parameters:
pre (str): qb64 identifier of registry event
sn (int): integer sequence number of regsitry event
Returns:
bool: True means event has completed and is commited to database
"""

seqner = coring.Seqner(sn=sn)
said = self.rgy.reger.ctel.get(keys=(pre, seqner.qb64))
return said is not None
Expand Down
2 changes: 1 addition & 1 deletion src/keria/app/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def on_post(req, rep, name):

# create seal for the proper location to find the signatures
kever = hab.mhab.kever
seal = eventing.SealEvent(i=hab.mhab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d)
seal = eventing.SealEvent(i=hab.mhab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)
ims.extend(atc.encode("utf-8")) # add the pathed attachments
Expand Down
10 changes: 5 additions & 5 deletions src/keria/app/ipexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def sendAdmit(agent, hab, ked, sigs, rec):

# Now create the stream to send, need the signer seal
kever = hab.kever
seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d)
seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)

Expand Down Expand Up @@ -118,7 +118,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec):

# Now create the stream to send, need the signer seal
kever = hab.kever
seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d)
seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)

Expand Down Expand Up @@ -185,7 +185,7 @@ def sendGrant(agent, hab, ked, sigs, atc, rec):

# Now create the stream to send, need the signer seal
kever = hab.kever
seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d)
seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)
ims = ims + atc.encode("utf-8")
Expand Down Expand Up @@ -213,7 +213,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec):
holder = grant['a']['i']
serder = serdering.SerderKERI(sad=grant)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
seal = eventing.SealEvent(i=hab.pre, s=hex(hab.kever.lastEst.s), d=hab.kever.lastEst.d)
seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(hab.kever.lastEst.s), d=hab.kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)
ims = ims + atc.encode("utf-8")
Expand All @@ -227,7 +227,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec):

# Now create the stream to send, need the signer seal
kever = hab.kever
seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d)
seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)

Expand Down
2 changes: 1 addition & 1 deletion src/keria/peer/exchanging.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def on_post(req, rep, name):

# Now create the stream to send, need the signer seal
kever = hab.kever
seal = eventing.SealEvent(i=hab.pre, s=hex(kever.lastEst.s), d=kever.lastEst.d)
seal = eventing.SealEvent(i=hab.pre, s="{:x}".format(kever.lastEst.s), d=kever.lastEst.d)

ims = eventing.messagize(serder=serder, sigers=sigers, seal=seal)

Expand Down

0 comments on commit 087f62f

Please sign in to comment.