Skip to content

Commit

Permalink
Change Sealer to Anchorer. Change import of Siger from keri (WebOfTru…
Browse files Browse the repository at this point in the history
…st#225)

* changed interface import to keri for Siger to keri.core.Siger from keri.core.coring.Siger

* Change Sealer to Anchorer
  • Loading branch information
SmithSamuelM authored Apr 6, 2024
1 parent 5fdfebb commit eeafb71
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 55 deletions.
16 changes: 10 additions & 6 deletions src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
from dataclasses import asdict
from urllib.parse import urlparse, urljoin

from keri import kering
from keri.app.notifying import Notifier
from keri.app.storing import Mailboxer

import falcon
from falcon import media
from hio.base import doing
from hio.core import http, tcp
from hio.help import decking

from keri import kering
from keri import core
from keri.app.notifying import Notifier
from keri.app.storing import Mailboxer


from keri.app import configing, keeping, habbing, storing, signaling, oobiing, agenting, \
forwarding, querying, connecting, grouping
from keri.app.grouping import Counselor
Expand Down Expand Up @@ -149,7 +153,7 @@ def createHttpServer(port, app, keypath=None, certpath=None, cafilepath=None):
class Agency(doing.DoDoer):
"""
Agency
"""

def __init__(self, name, bran, base="", configFile=None, configDir=None, adb=None, temp=False):
Expand Down Expand Up @@ -287,7 +291,7 @@ def __init__(self, hby, rgy, agentHab, agency, caid, **opts):
self.agency = agency
self.caid = caid

self.swain = delegating.Sealer(hby=hby, proxy=agentHab)
self.swain = delegating.Anchorer(hby=hby, proxy=agentHab)
self.counselor = Counselor(hby=hby, swain=self.swain, proxy=agentHab)
self.org = connecting.Organizer(hby=hby)

Expand Down Expand Up @@ -814,7 +818,7 @@ def on_post(self, req, rep):
if "sig" not in body:
raise falcon.HTTPBadRequest(title="invalid inception",
description=f'required field "sig" missing from body')
siger = coring.Siger(qb64=body["sig"])
siger = core.Siger(qb64=body["sig"])

caid = icp.pre

Expand Down
19 changes: 10 additions & 9 deletions src/keria/app/aiding.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import falcon
from keri import kering
from keri import core
from keri.app import habbing
from keri.app.keeping import Algos
from keri.core import coring, serdering
Expand Down Expand Up @@ -161,11 +162,11 @@ def on_put(self, req, rep, caid):
sigs = body["sigs"]

ctrlHab = agent.hby.habByName(caid, ns="agent")
ctrlHab.rotate(serder=rot, sigers=[coring.Siger(qb64=sig) for sig in sigs])
ctrlHab.rotate(serder=rot, sigers=[core.Siger(qb64=sig) for sig in sigs])

if not self.authn.verify(req):
raise falcon.HTTPForbidden(description="invalid signature on request")

sxlt = body["sxlt"]
agent.mgr.sxlt = sxlt

Expand Down Expand Up @@ -216,7 +217,7 @@ def interact(req, rep, agent, caid):
ked = body['ixn']
sigs = body['sigs']
ixn = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

ctrlHab = agent.hby.habByName(caid, ns="agent")

Expand Down Expand Up @@ -317,7 +318,7 @@ def on_post(req, rep):

serder = serdering.SerderKERI(sad=icp)

sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

if agent.hby.habByName(name) is not None:
raise falcon.HTTPBadRequest(title=f"AID with name {name} already incepted")
Expand Down Expand Up @@ -545,7 +546,7 @@ def rotate(agent, name, body):
hab = agent.hby.habByName(name)
if hab is None:
raise falcon.HTTPNotFound(title=f"No AID with name {name} found")

rot = body.get("rot")
if rot is None:
raise falcon.HTTPBadRequest(title="invalid rotation",
Expand All @@ -563,7 +564,7 @@ def rotate(agent, name, body):
description=f"required field 'sigs' missing from request")

serder = serdering.SerderKERI(sad=rot)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

hab.rotate(serder=serder, sigers=sigers)

Expand Down Expand Up @@ -629,7 +630,7 @@ def interact(agent, name, body):
description=f"required field 'sigs' missing from request")

serder = serdering.SerderKERI(sad=ixn)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

hab.interact(serder=serder, sigers=sigers)

Expand Down Expand Up @@ -670,7 +671,7 @@ def info(hab, rm, full=False):
data["state"] = asdict(kever.state())
dgkey = dbing.dgKey(kever.prefixer.qb64b, kever.serder.saidb)
wigs = hab.db.getWigs(dgkey)
data["windexes"] = [coring.Siger(qb64b=bytes(wig)).index for wig in wigs]
data["windexes"] = [core.Siger(qb64b=bytes(wig)).index for wig in wigs]

return data

Expand Down Expand Up @@ -851,7 +852,7 @@ def on_post(req, rep, name, aid=None, role=None):
raise falcon.errors.HTTPBadRequest(
description=f"error trying to create end role for unknown local AID {pre}")

rsigers = [coring.Siger(qb64=rsig) for rsig in rsigs]
rsigers = [core.Siger(qb64=rsig) for rsig in rsigs]
tsg = (hab.kever.prefixer, coring.Seqner(sn=hab.kever.sn), coring.Saider(qb64=hab.kever.serder.said), rsigers)
try:
agent.hby.rvy.processReply(rserder, tsgs=[tsg])
Expand Down
4 changes: 2 additions & 2 deletions src/keria/app/delegating.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from keri.db import dbing


class Sealer(doing.DoDoer):
class Anchorer(doing.DoDoer):
"""
Sends messages to Delegator of an identifier and wait for the anchoring event to
be processed to ensure the inception or rotation event has been approved by the delegator.
Expand All @@ -32,7 +32,7 @@ def __init__(self, hby, proxy=None, **kwa):
self.witDoer = agenting.Receiptor(hby=self.hby)
self.proxy = proxy

super(Sealer, self).__init__(doers=[self.witq, self.witDoer, self.postman, doing.doify(self.escrowDo)],
super(Anchorer, self).__init__(doers=[self.witq, self.witDoer, self.postman, doing.doify(self.escrowDo)],
**kwa)

def delegation(self, pre, sn=None, proxy=None):
Expand Down
5 changes: 3 additions & 2 deletions src/keria/app/grouping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json

import falcon
from keri import core
from keri.app import habbing
from keri.core import coring, eventing, serdering
from keri.kering import SerializeError
Expand Down Expand Up @@ -56,7 +57,7 @@ def on_post(req, rep, name):
atc = httping.getRequiredParam(body, "atc")

# create sigers from the edge signatures so we can messagize the whole thing
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# create seal for the proper location to find the signatures
kever = hab.mhab.kever
Expand Down Expand Up @@ -116,7 +117,7 @@ def on_post(req, rep, name):
agent.hby.deleteHab(name=name)
raise falcon.HTTPBadRequest(description=f"attempt to merge with unknown AID={recp}")

sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]
verfers = [coring.Verfer(qb64=k) for k in rot['k']]
digers = [coring.Diger(qb64=n) for n in rot['n']]

Expand Down
29 changes: 15 additions & 14 deletions src/keria/app/ipexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json

import falcon
from keri import core
from keri.app import habbing
from keri.core import coring, eventing, serdering
from keri.peer import exchanging
Expand Down Expand Up @@ -46,7 +47,7 @@ def on_post(req, rep, name):
- Registries
responses:
200:
description: long running operation of IPEX admit
description: long running operation of IPEX admit
"""
agent = req.context.agent
Expand Down Expand Up @@ -83,7 +84,7 @@ def sendAdmit(agent, hab, ked, sigs, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.kever
Expand Down Expand Up @@ -122,7 +123,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.mhab.kever
Expand Down Expand Up @@ -210,7 +211,7 @@ def sendGrant(agent, hab, ked, sigs, atc, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.kever
Expand Down Expand Up @@ -246,7 +247,7 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.mhab.kever
Expand Down Expand Up @@ -293,7 +294,7 @@ def on_post(req, rep, name):
responses:
200:
description: long running operation of IPEX apply
"""
agent = req.context.agent
# Get the hab
Expand Down Expand Up @@ -326,7 +327,7 @@ def sendApply(agent, hab, ked, sigs, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.kever
Expand All @@ -342,7 +343,7 @@ def sendApply(agent, hab, ked, sigs, rec):
return agent.monitor.submit(serder.pre, longrunning.OpTypes.exchange, metadata=dict(said=serder.said))

class IpexOfferCollectionEnd:

@staticmethod
def on_post(req, rep, name):
""" IPEX Offer POST endpoint
Expand All @@ -360,7 +361,7 @@ def on_post(req, rep, name):
responses:
200:
description: long running operation of IPEX offer
"""
agent = req.context.agent
hab = agent.hby.habByName(name)
Expand Down Expand Up @@ -393,7 +394,7 @@ def sendOffer(agent, hab, ked, sigs, atc, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.kever
Expand All @@ -407,9 +408,9 @@ def sendOffer(agent, hab, ked, sigs, atc, rec):

agent.exchanges.append(dict(said=serder.said, pre=hab.pre, rec=rec, topic='credential'))
return agent.monitor.submit(serder.pre, longrunning.OpTypes.exchange, metadata=dict(said=serder.said))

class IpexAgreeCollectionEnd:

@staticmethod
def on_post(req, rep, name):
""" IPEX Agree POST endpoint
Expand All @@ -427,7 +428,7 @@ def on_post(req, rep, name):
responses:
200:
description: long running operation of IPEX agree
"""
agent = req.context.agent
hab = agent.hby.habByName(name)
Expand Down Expand Up @@ -459,7 +460,7 @@ def sendAgree(agent, hab, ked, sigs, rec):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.kever
Expand Down
8 changes: 4 additions & 4 deletions src/keria/core/longrunning.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Monitor:
Attributes:
hby (Habery): identifier database environment
opr(Operator): long running operations database
swain(Sealer): Delegation processes tracker
swain(Anchorer): Delegation processes tracker
"""

Expand All @@ -98,7 +98,7 @@ def __init__(self, hby, swain, counselor=None, registrar=None, exchanger=None, c
Parameters:
hby (Habery): identifier database environment
swain(Sealer): Delegation processes tracker
swain(Anchorer): Delegation processes tracker
opr (Operator): long running operations database
"""
Expand Down Expand Up @@ -410,8 +410,8 @@ def status(self, op):
class OperationCollectionEnd:
@staticmethod
def on_get(req, rep):
""" Get list of long running operations
""" Get list of long running operations
Parameters:
req (Request): Falcon HTTP Request object
rep (Response): Falcon HTTP Response object
Expand Down
3 changes: 2 additions & 1 deletion src/keria/peer/exchanging.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import json

import falcon
from keri import core
from keri.core import coring, eventing, serdering
from keri.peer import exchanging

Expand Down Expand Up @@ -58,7 +59,7 @@ def on_post(req, rep, name):

# use that data to create th Serder and Sigers for the exn
serder = serdering.SerderKERI(sad=ked)
sigers = [coring.Siger(qb64=sig) for sig in sigs]
sigers = [core.Siger(qb64=sig) for sig in sigs]

# Now create the stream to send, need the signer seal
kever = hab.kever
Expand Down
Loading

0 comments on commit eeafb71

Please sign in to comment.