diff --git a/src/keria/app/agenting.py b/src/keria/app/agenting.py index 1ce7444f..a548aae7 100644 --- a/src/keria/app/agenting.py +++ b/src/keria/app/agenting.py @@ -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 @@ -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): @@ -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) @@ -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 diff --git a/src/keria/app/aiding.py b/src/keria/app/aiding.py index 2b63061d..83605f1a 100644 --- a/src/keria/app/aiding.py +++ b/src/keria/app/aiding.py @@ -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 @@ -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 @@ -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") @@ -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") @@ -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", @@ -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) @@ -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) @@ -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 @@ -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]) diff --git a/src/keria/app/delegating.py b/src/keria/app/delegating.py index cb68293b..45f080ed 100644 --- a/src/keria/app/delegating.py +++ b/src/keria/app/delegating.py @@ -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. @@ -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): diff --git a/src/keria/app/grouping.py b/src/keria/app/grouping.py index 90ebd548..0d61df22 100644 --- a/src/keria/app/grouping.py +++ b/src/keria/app/grouping.py @@ -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 @@ -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 @@ -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']] diff --git a/src/keria/app/ipexing.py b/src/keria/app/ipexing.py index 9c26222a..37289c2f 100644 --- a/src/keria/app/ipexing.py +++ b/src/keria/app/ipexing.py @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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) @@ -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 @@ -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 @@ -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) @@ -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 diff --git a/src/keria/core/longrunning.py b/src/keria/core/longrunning.py index c0d41122..06016184 100644 --- a/src/keria/core/longrunning.py +++ b/src/keria/core/longrunning.py @@ -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 """ @@ -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 """ @@ -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 diff --git a/src/keria/peer/exchanging.py b/src/keria/peer/exchanging.py index fb27ee3c..3a98cf7e 100644 --- a/src/keria/peer/exchanging.py +++ b/src/keria/peer/exchanging.py @@ -7,6 +7,7 @@ import json import falcon +from keri import core from keri.core import coring, eventing, serdering from keri.peer import exchanging @@ -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 diff --git a/tests/app/test_delegating.py b/tests/app/test_delegating.py index 2c569357..01d4fb54 100644 --- a/tests/app/test_delegating.py +++ b/tests/app/test_delegating.py @@ -3,7 +3,7 @@ KERIA keria.app.delegating module -Testing the Mark II Agent Sealer +Testing the Mark II Agent Anchorer """ import pytest from hio.base import doing @@ -16,12 +16,12 @@ def test_sealer(): with habbing.openHby(name="p1", temp=True) as hby: - # Create Sealer to test - sealer = delegating.Sealer(hby=hby) + # Create Anchorer to test + anchorer = delegating.Anchorer(hby=hby) # Doer hierarchy doist = doing.Doist(tock=0.03125, real=True) - deeds = doist.enter(doers=[sealer]) + deeds = doist.enter(doers=[anchorer]) # Create delegator and delegate Habs delegator = hby.makeHab("delegator") @@ -30,34 +30,34 @@ def test_sealer(): # Try with a bad AID with pytest.raises(kering.ValidationError): - sealer.delegation(pre="EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY") + anchorer.delegation(pre="EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY") # Needs a proxy with pytest.raises(kering.ValidationError): - sealer.delegation(pre=delegate.pre) + anchorer.delegation(pre=delegate.pre) # Run delegation to escrow inception event - sealer.delegation(pre=delegate.pre, proxy=proxy) + anchorer.delegation(pre=delegate.pre, proxy=proxy) doist.recur(deeds=deeds) prefixer = coring.Prefixer(qb64=delegate.pre) seqner = coring.Seqner(sn=0) - assert sealer.complete(prefixer=prefixer, seqner=seqner) is False + assert anchorer.complete(prefixer=prefixer, seqner=seqner) is False # Anchor the seal in delegator's KEL, approving the delegation seal = eventing.SealEvent(prefixer.qb64, "0", prefixer.qb64) delegator.interact(data=[seal._asdict()]) - while sealer.complete(prefixer=prefixer, seqner=seqner) is False: + while anchorer.complete(prefixer=prefixer, seqner=seqner) is False: doist.recur(deeds=deeds) # Will raise with a bad digest with pytest.raises(kering.ValidationError): # Create saider for the wrong event saider = coring.Saider(qb64=delegator.kever.serder.said) - sealer.complete(prefixer=prefixer, seqner=seqner, saider=saider) + anchorer.complete(prefixer=prefixer, seqner=seqner, saider=saider) - assert sealer.complete(prefixer=prefixer, seqner=seqner) is True + assert anchorer.complete(prefixer=prefixer, seqner=seqner) is True diff --git a/tests/app/test_ipexing.py b/tests/app/test_ipexing.py index 2a1cede8..4182b491 100644 --- a/tests/app/test_ipexing.py +++ b/tests/app/test_ipexing.py @@ -11,6 +11,7 @@ from falcon import testing from hio.base import doing from hio.help import decking +from keri import core from keri.app import habbing, signing from keri.core import eventing, coring, serdering from keri.help import helping @@ -312,7 +313,7 @@ def test_ipex_grant(helpers, mockHelpingNowIso8601, seeder): assert len(agent.exchanges) == 1 assert len(agent.grants) == 1 - ims = eventing.messagize(serder=exn, sigers=[coring.Siger(qb64=sigs[0])]) + ims = eventing.messagize(serder=exn, sigers=[core.Siger(qb64=sigs[0])]) # Test sending embedded admit in multisig/exn message exn, end = exchanging.exchange(route="/multisig/exn", payload=dict(), @@ -977,7 +978,7 @@ def test_ipex_apply(helpers, mockHelpingNowIso8601): data = json.dumps(body).encode("utf-8") res = client.simulate_post(path="/identifiers/test/ipex/apply", body=data) - + assert res.status_code == 400 assert res.json == {'description': 'attempt to send to unknown ' 'AID=EZ-i0d8JZAoTNZH3ULaU6JR2nmwyvYAfSVPzhzS6b5CM', @@ -1073,7 +1074,7 @@ def test_ipex_offer(helpers, mockHelpingNowIso8601): data = json.dumps(body).encode("utf-8") res = client.simulate_post(path="/identifiers/test/ipex/offer", body=data) - + assert res.status_code == 400 assert res.json == {'description': 'attempt to send to unknown ' 'AID=EZ-i0d8JZAoTNZH3ULaU6JR2nmwyvYAfSVPzhzS6b5CM', @@ -1104,7 +1105,7 @@ def test_ipex_offer(helpers, mockHelpingNowIso8601): assert res.status_code == 200 assert len(agent.exchanges) == 1 - # Now an offer in response to an agree + # Now an offer in response to an agree dig = "EB_Lr3fHezn1ygn-wbBT5JjzaCMxTmhUoegXeZzWC2eT" offer1Serder, end1 = exchanging.exchange(route="/ipex/offer", payload={'m': 'How about this'}, @@ -1134,7 +1135,7 @@ def test_ipex_offer(helpers, mockHelpingNowIso8601): 'v': 'KERI10JSON000323_'} assert end1 == b'' sigs = ["AAAa70b4QnTOtGOsMqcezMtVzCFuRJHGeIMkWYHZ5ZxGIXM0XDVAzkYdCeadfPfzlKC6dkfiwuJ0IzLOElaanUgH"] - + body = dict( exn=offer1Serder.ked, sigs=sigs, @@ -1206,7 +1207,7 @@ def test_ipex_agree(helpers, mockHelpingNowIso8601): data = json.dumps(body).encode("utf-8") res = client.simulate_post(path="/identifiers/test/ipex/agree", body=data) - + assert res.status_code == 400 assert res.json == {'description': 'attempt to send to unknown ' 'AID=EZ-i0d8JZAoTNZH3ULaU6JR2nmwyvYAfSVPzhzS6b5CM',