diff --git a/src/keria/app/agenting.py b/src/keria/app/agenting.py index 7a3b2e6..bc03a99 100644 --- a/src/keria/app/agenting.py +++ b/src/keria/app/agenting.py @@ -22,7 +22,7 @@ forwarding, querying, connecting, grouping from keri.app.grouping import Counselor from keri.app.keeping import Algos -from keri.core import coring, parsing, eventing, routing +from keri.core import coring, parsing, eventing, routing, serdering from keri.core.coring import Ilks, randomNonce from keri.db import dbing from keri.db.basing import OobiRecord @@ -803,7 +803,7 @@ def on_post(self, req, rep): if "icp" not in body: raise falcon.HTTPBadRequest(title="invalid inception", description=f'required field "icp" missing from body') - icp = eventing.Serder(ked=body["icp"]) + icp = serdering.SerderKERI(sad=body["icp"]) if "sig" not in body: raise falcon.HTTPBadRequest(title="invalid inception", @@ -962,7 +962,7 @@ def on_get(req, rep): if not (raw := agent.hby.db.getEvt(key=dgkey)): raise falcon.HTTPInternalServerError(f"Missing event for dig={dig}.") - serder = coring.Serder(raw=bytes(raw)) + serder = serdering.SerderKERI(raw=bytes(raw)) events.append(serder.ked) rep.status = falcon.HTTP_200 diff --git a/src/keria/app/aiding.py b/src/keria/app/aiding.py index 71b36fd..9e44a1a 100644 --- a/src/keria/app/aiding.py +++ b/src/keria/app/aiding.py @@ -12,7 +12,7 @@ from keri import kering from keri.app import habbing from keri.app.keeping import Algos -from keri.core import coring, eventing +from keri.core import coring, serdering from keri.core.coring import Ilks from keri.db import dbing from keri.help import ogler @@ -100,7 +100,7 @@ def on_get(self, _, rep, caid): state = asdict(agent.hby.kevers[agent.caid].state()) key = dbing.dgKey(state['i'], state['ee']['d']) # digest key msg = agent.hby.db.getEvt(key) - eserder = coring.Serder(raw=bytes(msg)) + eserder = serdering.SerderKERI(raw=bytes(msg)) body = dict( agent=asdict(agent.hby.kevers[agent.pre].state()), @@ -151,7 +151,7 @@ def on_put(self, req, rep, caid): if "keys" not in body: raise falcon.HTTPBadRequest(description="required field 'keys' missing from body") - rot = coring.Serder(ked=body["rot"]) + rot = serdering.SerderKERI(sad=body["rot"]) sigs = body["sigs"] ctrlHab = agent.hby.habByName(caid, ns="agent") @@ -209,7 +209,7 @@ def interact(req, rep, agent, caid): ked = body['ixn'] sigs = body['sigs'] - ixn = coring.Serder(ked=ked) + ixn = serdering.SerderKERI(sad=ked) sigers = [coring.Siger(qb64=sig) for sig in sigs] ctrlHab = agent.hby.habByName(caid, ns="agent") @@ -308,7 +308,7 @@ def on_post(req, rep): name = httping.getRequiredParam(body, "name") sigs = httping.getRequiredParam(body, "sigs") - serder = coring.Serder(ked=icp) + serder = serdering.SerderKERI(sad=icp) sigers = [coring.Siger(qb64=sig) for sig in sigs] @@ -500,7 +500,7 @@ def rotate(agent, name, body): raise falcon.HTTPBadRequest(title="invalid rotation", description=f"required field 'sigs' missing from request") - serder = coring.Serder(ked=rot) + serder = serdering.SerderKERI(sad=rot) sigers = [coring.Siger(qb64=sig) for sig in sigs] hab.rotate(serder=serder, sigers=sigers) @@ -566,7 +566,7 @@ def interact(agent, name, body): raise falcon.HTTPBadRequest(title="invalid interaction", description=f"required field 'sigs' missing from request") - serder = coring.Serder(ked=ixn) + serder = serdering.SerderKERI(sad=ixn) sigers = [coring.Siger(qb64=sig) for sig in sigs] hab.interact(serder=serder, sigers=sigers) @@ -772,7 +772,7 @@ def on_post(req, rep, name, aid=None, role=None): rpy = httping.getRequiredParam(body, "rpy") rsigs = httping.getRequiredParam(body, "sigs") - rserder = coring.Serder(ked=rpy) + rserder = serdering.SerderKERI(sad=rpy) data = rserder.ked['a'] pre = data['cid'] role = data['role'] @@ -787,7 +787,7 @@ def on_post(req, rep, name, aid=None, role=None): description=f"error trying to create end role for unknown local AID {pre}") rsigers = [coring.Siger(qb64=rsig) for rsig in rsigs] - tsg = (hab.kever.prefixer, coring.Seqner(sn=hab.kever.sn), hab.kever.serder.saider, rsigers) + 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]) except kering.UnverifiedReplyError: @@ -932,7 +932,7 @@ def on_post(req, rep, name): exn = body["exn"] sig = body["sig"] recpt = body["recipient"] - serder = coring.Serder(ked=exn) + serder = serdering.SerderKERI(sad=exn) ims = bytearray(serder.raw) ims.extend(sig.encode("utf-8")) diff --git a/src/keria/app/credentialing.py b/src/keria/app/credentialing.py index db7d7c4..780d39a 100644 --- a/src/keria/app/credentialing.py +++ b/src/keria/app/credentialing.py @@ -6,15 +6,15 @@ services and endpoint for ACDC credential managements """ import json +from dataclasses import asdict import falcon from keri import kering from keri.app import signing from keri.app.habbing import SignifyGroupHab -from keri.core import coring, scheming +from keri.core import coring, scheming, serdering from keri.core.eventing import SealEvent from keri.db import dbing -from keri.vc import proving from keria.core import httping, longrunning @@ -88,7 +88,7 @@ def on_get(req, rep, name): name=registry.name, regk=registry.regk, pre=registry.hab.pre, - state=registry.tever.state().ked + state=asdict(registry.tever.state()) ) res.append(rd) @@ -152,10 +152,10 @@ def on_post(self, req, rep, name): rname = httping.getRequiredParam(body, "name") ked = httping.getRequiredParam(body, "vcp") - vcp = coring.Serder(ked=ked) + vcp = serdering.SerderKERI(sad=ked) ked = httping.getRequiredParam(body, "ixn") - ixn = coring.Serder(ked=ked) + ixn = serdering.SerderKERI(sad=ked) hab = agent.hby.habByName(name) if hab is None: @@ -173,7 +173,7 @@ def on_post(self, req, rep, name): seqner = coring.Seqner(sn=ixn.sn) prefixer = coring.Prefixer(qb64=ixn.pre) - agent.registrar.incept(hab, registry, prefixer=prefixer, seqner=seqner, saider=ixn.saider) + agent.registrar.incept(hab, registry, prefixer=prefixer, seqner=seqner, saider=coring.Saider(qb64=ixn.said)) op = agent.monitor.submit(hab.kever.prefixer.qb64, longrunning.OpTypes.registry, metadata=dict(anchor=anchor, depends=op)) @@ -474,12 +474,12 @@ def on_post(self, req, rep, name): if hab is None: raise falcon.HTTPNotFound(description="name is not a valid reference to an identifier") - creder = proving.Creder(ked=httping.getRequiredParam(body, "acdc")) - iserder = coring.Serder(ked=httping.getRequiredParam(body, "iss")) + creder = serdering.SerderACDC(sad=httping.getRequiredParam(body, "acdc")) + iserder = serdering.SerderKERI(sad=httping.getRequiredParam(body, "iss")) if "ixn" in body: - anc = coring.Serder(ked=httping.getRequiredParam(body, "ixn")) + anc = serdering.SerderKERI(sad=httping.getRequiredParam(body, "ixn")) else: - anc = coring.Serder(ked=httping.getRequiredParam(body, "rot")) + anc = serdering.SerderKERI(sad=httping.getRequiredParam(body, "rot")) regk = iserder.ked['ri'] if regk not in agent.rgy.tevers: @@ -495,7 +495,7 @@ def on_post(self, req, rep, name): agent.registrar.issue(regk, iserder, anc) agent.credentialer.issue(creder=creder, serder=iserder) op = agent.monitor.submit(hab.kever.prefixer.qb64, longrunning.OpTypes.credential, - metadata=dict(ced=creder.ked, depends=op)) + metadata=dict(ced=creder.sad, depends=op)) except kering.ConfigurationError as e: rep.status = falcon.HTTP_400 @@ -579,7 +579,7 @@ def on_get(req, rep, name, said): def outputCred(hby, rgy, said): out = bytearray() creder, prefixer, seqner, saider = rgy.reger.cloneCred(said=said) - chains = creder.chains + chains = creder.edge saids = [] for key, source in chains.items(): if key == 'd': @@ -595,28 +595,28 @@ def outputCred(hby, rgy, said): issr = creder.issuer for msg in hby.db.clonePreIter(pre=issr): - serder = coring.Serder(raw=msg) + serder = serdering.SerderKERI(raw=msg) atc = msg[serder.size:] out.extend(serder.raw) out.extend(atc) - if "i" in creder.subject: - subj = creder.subject["i"] + if "i" in creder.attrib: + subj = creder.attrib["i"] for msg in hby.db.clonePreIter(pre=subj): - serder = coring.Serder(raw=msg) + serder = serdering.SerderKERI(raw=msg) atc = msg[serder.size:] out.extend(serder.raw) out.extend(atc) - if creder.status is not None: - for msg in rgy.reger.clonePreIter(pre=creder.status): - serder = coring.Serder(raw=msg) + if creder.regi is not None: + for msg in rgy.reger.clonePreIter(pre=creder.regi): + serder = serdering.SerderKERI(raw=msg) atc = msg[serder.size:] out.extend(serder.raw) out.extend(atc) for msg in rgy.reger.clonePreIter(pre=creder.said): - serder = coring.Serder(raw=msg) + serder = serdering.SerderKERI(raw=msg) atc = msg[serder.size:] out.extend(serder.raw) out.extend(atc) @@ -651,7 +651,7 @@ def on_delete(self, req, rep, name, said): if hab is None: raise falcon.HTTPNotFound(description="name is not a valid reference to an identifier") - rserder = coring.Serder(ked=httping.getRequiredParam(body, "rev")) + rserder = serdering.SerderKERI(sad=httping.getRequiredParam(body, "rev")) regk = rserder.ked['ri'] if regk not in agent.rgy.tevers: @@ -672,7 +672,6 @@ def on_delete(self, req, rep, name, said): try: agent.registrar.revoke(regk, rserder, anc) except Exception as e: - print(e) raise falcon.HTTPBadRequest(description=f"invalid revocation event.") rep.status = falcon.HTTP_200 @@ -731,7 +730,7 @@ def incept(self, hab, registry, prefixer=None, seqner=None, saider=None): if not isinstance(hab, SignifyGroupHab): seqner = coring.Seqner(sn=hab.kever.sner.num) - saider = hab.kever.serder.saider + saider = coring.Saider(qb64=hab.kever.serder.said) registry.anchorMsg(pre=registry.regk, regd=registry.regd, seqner=seqner, saider=saider) self.witDoer.msgs.append(dict(pre=hab.pre, sn=seqner.sn)) self.rgy.reger.tpwe.add(keys=(registry.regk, rseq.qb64), val=(hab.kever.prefixer, seqner, saider)) @@ -761,7 +760,7 @@ def issue(self, regk, iserder, anc): if not isinstance(hab, SignifyGroupHab): # not a multisig group seqner = coring.Seqner(sn=hab.kever.sner.num) - saider = hab.kever.serder.saider + saider = coring.Saider(qb64=hab.kever.serder.said) registry.anchorMsg(pre=vcid, regd=iserder.said, seqner=seqner, saider=saider) print("Waiting for TEL event witness receipts") @@ -800,7 +799,7 @@ def revoke(self, regk, rserder, anc): if not isinstance(hab, SignifyGroupHab): seqner = coring.Seqner(sn=hab.kever.sner.num) - saider = hab.kever.serder.saider + saider = coring.Saider(qb64=hab.kever.serder.said) registry.anchorMsg(pre=vcid, regd=rserder.said, seqner=seqner, saider=saider) print("Waiting for TEL event witness receipts") @@ -932,7 +931,7 @@ def validate(self, creder): bool: true if credential is valid against a known schema """ - schema = creder.crd['s'] + schema = creder.sad['s'] scraw = self.verifier.resolver.resolve(schema) if not scraw: raise kering.ConfigurationError("Credential schema {} not found. It must be loaded with data oobi before " @@ -960,7 +959,8 @@ def issue(self, creder, serder): self.rgy.reger.cmse.put(keys=(creder.said, seqner.qb64), val=creder) try: - self.verifier.processCredential(creder=creder, prefixer=prefixer, seqner=seqner, saider=serder.saider) + self.verifier.processCredential(creder=creder, prefixer=prefixer, seqner=seqner, + saider=coring.Saider(qb64=serder.said)) except kering.MissingRegistryError: pass @@ -977,7 +977,6 @@ def processCredentialMissingSigEscrow(self): # Remove from this escrow self.rgy.reger.cmse.rem(keys=(said, snq)) - hab = self.hby.habs[creder.issuer] # place in escrow to diseminate to other if witnesser and if there is an issuee self.rgy.reger.ccrd.put(keys=(creder.said,), val=creder) diff --git a/src/keria/app/grouping.py b/src/keria/app/grouping.py index 45cfdf3..896ee97 100644 --- a/src/keria/app/grouping.py +++ b/src/keria/app/grouping.py @@ -8,7 +8,8 @@ import falcon from keri.app import habbing -from keri.core import coring, eventing +from keri.core import coring, eventing, serdering +from keri.kering import SerializeError from keria.core import httping, longrunning @@ -50,7 +51,7 @@ def on_post(req, rep, name): # grab all of the required parameters ked = httping.getRequiredParam(body, "exn") - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) sigs = httping.getRequiredParam(body, "sigs") atc = httping.getRequiredParam(body, "atc") @@ -131,13 +132,13 @@ def on_post(req, rep, name): hab = agent.hby.joinSignifyGroupHab(gid, name=name, mhab=mhab, smids=smids, rmids=rmids) try: - hab.make(serder=coring.Serder(ked=rot), sigers=sigers) + hab.make(serder=serdering.SerderKERI(sad=rot), sigers=sigers) agent.inceptGroup(pre=gid, mpre=mhab.pre, verfers=verfers, digers=digers) - except ValueError as e: + except (ValueError, SerializeError) as e: agent.hby.deleteHab(name=name) raise falcon.HTTPBadRequest(description=f"{e.args[0]}") - serder = coring.Serder(ked=rot) + serder = serdering.SerderKERI(sad=rot) agent.groups.append(dict(pre=hab.pre, serder=serder, sigers=sigers, smids=smids, rmids=rmids)) op = agent.monitor.submit(serder.pre, longrunning.OpTypes.group, metadata=dict(sn=0)) @@ -184,7 +185,7 @@ def on_get(req, rep, said): for d in exns: exn = d['exn'] - serder = coring.Serder(ked=exn) + serder = serdering.SerderKERI(sad=exn) route = serder.ked['r'] payload = serder.ked['a'] diff --git a/src/keria/app/ipexing.py b/src/keria/app/ipexing.py index aff11d5..7d01645 100644 --- a/src/keria/app/ipexing.py +++ b/src/keria/app/ipexing.py @@ -8,7 +8,7 @@ import json import falcon -from keri.core import coring, eventing +from keri.core import coring, eventing, serdering from keria.core import httping @@ -72,7 +72,7 @@ def sendAdmit(agent, hab, ked, sigs, rec): raise falcon.HTTPBadRequest(description=f"attempt to send to unknown AID={recp}") # use that data to create th Serder and Sigers for the exn - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) sigers = [coring.Siger(qb64=sig) for sig in sigs] # Now create the stream to send, need the signer seal @@ -106,14 +106,14 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec): raise falcon.HTTPBadRequest(description=f"attachment missing for ACDC, unable to process request.") holder = admit['a']['i'] - serder = coring.Serder(ked=admit) + serder = serdering.SerderKERI(sad=admit) ims = bytearray(serder.raw) + atc['exn'].encode("utf-8") agent.hby.psr.parseOne(ims=ims) agent.exchanges.append(dict(said=serder.said, pre=hab.pre, rec=holder, topic="credential")) agent.admits.append(dict(said=admit['d'], pre=hab.pre)) # use that data to create th Serder and Sigers for the exn - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) sigers = [coring.Siger(qb64=sig) for sig in sigs] # Now create the stream to send, need the signer seal @@ -181,7 +181,7 @@ def sendGrant(agent, hab, ked, sigs, rec): raise falcon.HTTPBadRequest(description=f"attempt to send to unknown AID={recp}") # use that data to create th Serder and Sigers for the exn - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) sigers = [coring.Siger(qb64=sig) for sig in sigs] # Now create the stream to send, need the signer seal @@ -215,14 +215,14 @@ def sendMultisigExn(agent, hab, ked, sigs, atc, rec): raise falcon.HTTPBadRequest(description=f"attachment missing for ACDC, unable to process request.") holder = grant['a']['i'] - serder = coring.Serder(ked=grant) + serder = serdering.SerderKERI(sad=grant) ims = bytearray(serder.raw) + atc['exn'].encode("utf-8") agent.hby.psr.parseOne(ims=ims) agent.exchanges.append(dict(said=serder.said, pre=hab.pre, rec=holder, topic="credential")) agent.grants.append(dict(said=grant['d'], pre=hab.pre)) # use that data to create th Serder and Sigers for the exn - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) sigers = [coring.Siger(qb64=sig) for sig in sigs] # Now create the stream to send, need the signer seal diff --git a/src/keria/core/longrunning.py b/src/keria/core/longrunning.py index daff631..fec1a67 100644 --- a/src/keria/core/longrunning.py +++ b/src/keria/core/longrunning.py @@ -12,7 +12,7 @@ from dataclasses_json import dataclass_json from keri import kering from keri.app.oobiing import Result -from keri.core import eventing, coring +from keri.core import eventing, coring, serdering from keri.db import dbing, koming from keri.help import helping @@ -178,7 +178,7 @@ def status(self, op): if len(wigs) >= kever.toader.num: evt = self.hby.db.getEvt(dbing.dgKey(pre=kever.prefixer.qb64, dig=bytes(sdig))) - serder = coring.Serder(raw=bytes(evt)) + serder = serdering.SerderKERI(raw=bytes(evt)) operation.done = True operation.response = serder.ked @@ -230,7 +230,7 @@ def status(self, op): if self.swain.complete(kever.prefixer, seqner): evt = self.hby.db.getEvt(dbing.dgKey(pre=kever.prefixer.qb64, dig=bytes(sdig))) - serder = coring.Serder(raw=bytes(evt)) + serder = serdering.SerderKERI(raw=bytes(evt)) operation.done = True operation.response = serder.ked @@ -247,7 +247,7 @@ def status(self, op): if self.counselor.complete(prefixer, seqner): sdig = self.hby.db.getKeLast(key=dbing.snKey(pre=op.oid, sn=seqner.sn)) evt = self.hby.db.getEvt(dbing.dgKey(pre=prefixer.qb64, dig=bytes(sdig))) - serder = coring.Serder(raw=bytes(evt)) + serder = serdering.SerderKERI(raw=bytes(evt)) operation.done = True operation.response = serder.ked diff --git a/src/keria/db/basing.py b/src/keria/db/basing.py index 3aabf94..ba3d6f9 100644 --- a/src/keria/db/basing.py +++ b/src/keria/db/basing.py @@ -181,7 +181,7 @@ def table(self): def value(self, said): saider = self.reger.saved.get(keys=(said,)) creder = self.reger.creds.get(keys=(saider.qb64,)) - return creder.crd + return creder.sad def saidIter(self): return self.reger.saved.getItemIter() @@ -209,7 +209,7 @@ def index(self, said): values = [] for path in idx.paths: pather = coring.Pather(qb64=path) - values.append(pather.resolve(creder.crd)) + values.append(pather.resolve(creder.sad)) value = "".join(values) db.add(keys=(value,), val=saider) diff --git a/src/keria/peer/exchanging.py b/src/keria/peer/exchanging.py index 42d1402..17f4660 100644 --- a/src/keria/peer/exchanging.py +++ b/src/keria/peer/exchanging.py @@ -7,7 +7,7 @@ import json import falcon -from keri.core import coring, eventing +from keri.core import coring, eventing, serdering from keri.peer import exchanging from keria.core import httping @@ -57,7 +57,7 @@ def on_post(req, rep, name): raise falcon.HTTPBadRequest(f"attempt to send to unknown AID={recp}") # use that data to create th Serder and Sigers for the exn - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) sigers = [coring.Siger(qb64=sig) for sig in sigs] # Now create the stream to send, need the signer seal diff --git a/src/keria/testing/testing_helper.py b/src/keria/testing/testing_helper.py index c80c8d5..e6cece6 100644 --- a/src/keria/testing/testing_helper.py +++ b/src/keria/testing/testing_helper.py @@ -12,7 +12,7 @@ from hio.core import http from keri import kering from keri.app import keeping, habbing, configing, signing -from keri.core import coring, eventing, parsing, routing, scheming +from keri.core import coring, eventing, parsing, routing, scheming, serdering from keri.core.coring import MtrDex from keri.core.eventing import SealEvent from keri.help import helping @@ -458,7 +458,7 @@ def createEndRole(client, agent, recp, name, salt): res = client.simulate_post(path=f"/identifiers/{name}/endroles", json=body) op = res.json ked = op["response"] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.raw == rpy.raw @staticmethod @@ -587,7 +587,7 @@ def createRegistry(self, pre, name): rseal = dict(i=rseal.i, s=rseal.s, d=rseal.d) anc = hab.interact(data=[rseal]) - aserder = coring.Serder(raw=bytes(anc)) + aserder = serdering.SerderKERI(raw=bytes(anc)) self.registrar.incept(iserder=registry.vcp, anc=aserder) # Process escrows to clear event @@ -620,7 +620,7 @@ def issueLegalEntityvLEI(self, reg, issuer, issuee, LEI): rseal = dict(i=rseal.i, s=rseal.s, d=rseal.d) anc = issuer.interact(data=[rseal]) - aserder = coring.Serder(raw=anc) + aserder = serdering.SerderKERI(raw=anc) self.registrar.issue(creder=creder, iserder=iserder, anc=aserder) prefixer = coring.Prefixer(qb64=iserder.pre) @@ -661,7 +661,7 @@ def issueQVIvLEI(self, reg, issuer, issuee, LEI): rseal = dict(i=rseal.i, s=rseal.s, d=rseal.d) anc = issuer.interact(data=[rseal]) - aserder = coring.Serder(raw=anc) + aserder = serdering.SerderKERI(raw=anc) self.registrar.issue(creder=creder, iserder=iserder, anc=aserder) prefixer = coring.Prefixer(qb64=iserder.pre) diff --git a/tests/app/test_agenting.py b/tests/app/test_agenting.py index b76846f..7a40f3e 100644 --- a/tests/app/test_agenting.py +++ b/tests/app/test_agenting.py @@ -18,7 +18,7 @@ from keri import kering from keri.app import habbing, configing, oobiing, querying from keri.app.agenting import Receiptor -from keri.core import coring +from keri.core import coring, serdering from keri.core.coring import MtrDex from keri.db import basing from keri.vc import proving @@ -423,7 +423,7 @@ def test_seeker_doer(helpers): cues = decking.Deck() seeker = agenting.SeekerDoer(agent.seeker, cues) - creder = proving.Creder(ked={ + creder = serdering.SerderACDC(sad={ "v": "ACDC10JSON000197_", "d": "EG7ZlUq0Z6a1EUPTM_Qg1LGEg1BWiypHLAekxo8crGzK", "i": "EPbOCiPM7IItIMzMwslKWfPM4tqNIKUCyVVuYJNQHwMB", diff --git a/tests/app/test_aiding.py b/tests/app/test_aiding.py index cbe107f..ac5870f 100644 --- a/tests/app/test_aiding.py +++ b/tests/app/test_aiding.py @@ -14,7 +14,7 @@ from falcon import testing from keri.app import habbing, keeping, configing from keri.app.keeping import Algos -from keri.core import coring, eventing, parsing +from keri.core import coring, eventing, parsing, serdering from keri.core.coring import MtrDex from keri.db.basing import LocationRecord from keri.peer import exchanging @@ -86,7 +86,7 @@ def test_endrole_ends(helpers): res = client.simulate_post(path=f"/identifiers/user1/endroles", json=body) op = res.json ked = op["response"] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.raw == rpy.raw keys = (recp, 'agent', agent.agentHab.pre) @@ -795,7 +795,7 @@ def test_identifier_collection_end(helpers): assert op['name'] == "delegation.EFt8G8gkCJ71e4amQaRUYss0BDK4pUpzKelEIr3yZ1D0" # try unknown delegator - delpre = "EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHUNKN" + delpre = "EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHUNKNx" serder, signers = helpers.incept(salt, "signify:aid", pidx=0, delpre=delpre) salter = coring.Salter(raw=salt) @@ -815,7 +815,7 @@ def test_identifier_collection_end(helpers): res = client.simulate_post(path="/identifiers", body=json.dumps(body)) assert res.status_code == 400 assert res.json == {'title': '400 Bad Request', - 'description': "unknown delegator EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHUNKN"} + 'description': "unknown delegator EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHUNKNx"} # Test extern keys for HSM integration, only initial tests, work still needed with helpers.openKeria() as (agency, agent, app, client): @@ -934,7 +934,7 @@ def test_challenge_ends(helpers): assert op["done"] is False # Set the signed result to True so it verifies - agent.hby.db.reps.add(keys=(aid['i'],), val=exn.saider) + agent.hby.db.reps.add(keys=(aid['i'],), val=coring.Saider(qb64=exn.said)) agent.hby.db.exns.pin(keys=(exn.said,), val=exn) result = client.simulate_post(path=f"/challenges/pal/verify/{aid['i']}", body=b) @@ -1225,7 +1225,7 @@ def test_oobi_ends(helpers): # Create an AID to test against salt = b'0123456789abcdef' op = helpers.createAid(client, "pal", salt) - iserder = coring.Serder(ked=op["response"]) + iserder = serdering.SerderKERI(sad=op["response"]) assert iserder.pre == "EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY" # Test before endroles are added @@ -1240,7 +1240,7 @@ def test_oobi_ends(helpers): res = client.simulate_post(path=f"/identifiers/pal/endroles", json=body) op = res.json ked = op["response"] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.raw == rpy.raw # not valid calls @@ -1309,7 +1309,7 @@ def test_oobi_ends(helpers): res = client.simulate_post(path=f"/identifiers/pal/endroles", json=body) op = res.json ked = op["response"] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.raw == rpy.raw res = client.simulate_get("/identifiers/pal/oobis?role=mailbox") @@ -1330,19 +1330,19 @@ def test_rpy_escow_end(helpers): rpy1 = helpers.endrole("EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY", "ECL8abFVW_0RTZXFhiiA4rkRobNvjTfJ6t-T8UdBRV1e") - agent.hby.db.rpes.add(keys=("/end/role",), val=rpy1.saider) + agent.hby.db.rpes.add(keys=("/end/role",), val=coring.Saider(qb64=rpy1.said)) agent.hby.db.rpys.put(keys=(rpy1.said,), val=rpy1) rpy2 = helpers.endrole("EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY", "ECL8abFVW_0RTZXFhiiA4rkRobNvjTfJ6t-T8UdBRV1e", role=kering.Roles.controller) - agent.hby.db.rpes.add(keys=("/end/role",), val=rpy2.saider) + agent.hby.db.rpes.add(keys=("/end/role",), val=coring.Saider(qb64=rpy2.said)) agent.hby.db.rpys.put(keys=(rpy2.said,), val=rpy2) rpy3 = helpers.endrole("EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY", "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", role=kering.Roles.witness) - agent.hby.db.rpes.add(keys=("/end/role",), val=rpy3.saider) + agent.hby.db.rpes.add(keys=("/end/role",), val=coring.Saider(qb64=rpy3.said)) agent.hby.db.rpys.put(keys=(rpy3.said,), val=rpy3) res = client.simulate_get(path="/escrows/rpy?route=/end/role") diff --git a/tests/app/test_credentialing.py b/tests/app/test_credentialing.py index c1a250c..2cadc4f 100644 --- a/tests/app/test_credentialing.py +++ b/tests/app/test_credentialing.py @@ -11,7 +11,7 @@ from falcon import testing from hio.base import doing from keri.app import habbing -from keri.core import scheming, coring, parsing +from keri.core import scheming, coring, parsing, serdering from keri.core.eventing import TraitCodex, SealEvent from keri.vc import proving from keri.vdr import eventing @@ -238,7 +238,7 @@ def test_issue_credential(helpers, seeder): iss=regser.ked, ixn=serder.ked, sigs=sigers, - acdc=creder.ked, + acdc=creder.sad, csigs=csigers, path=pather.qb64) @@ -251,7 +251,7 @@ def test_issue_credential(helpers, seeder): op = result.json assert 'ced' in op['metadata'] - assert op['metadata']['ced'] == creder.ked + assert op['metadata']['ced'] == creder.sad while not agent.credentialer.complete(creder.said): doist.recur(deeds=deeds) @@ -297,7 +297,7 @@ def test_credentialing_ends(helpers, seeder): rseal = dict(i=rseal.i, s=rseal.s, d=rseal.d) anc = hab.interact(data=[rseal]) - aserder = coring.Serder(raw=bytes(anc)) + aserder = serdering.SerderKERI(raw=bytes(anc)) registrar.incept(iserder=registry.vcp, anc=aserder) assert registry.regk == "EACehJRd0wfteUAJgaTTJjMSaQqWvzeeHqAMMqxuqxU4" @@ -459,7 +459,7 @@ def test_revoke_credential(helpers, seeder): iss=regser.ked, ixn=serder.ked, sigs=sigers, - acdc=creder.ked, + acdc=creder.sad, csigs=csigers, path=pather.qb64) @@ -472,7 +472,7 @@ def test_revoke_credential(helpers, seeder): op = result.json assert 'ced' in op['metadata'] - assert op['metadata']['ced'] == creder.ked + assert op['metadata']['ced'] == creder.sad while not agent.credentialer.complete(creder.said): doist.recur(deeds=deeds) @@ -491,7 +491,7 @@ def test_revoke_credential(helpers, seeder): assert res.json[0]['sad']['d'] == creder.said assert res.json[0]['status']['s'] == "0" - regser = eventing.revoke(vcdig=creder.said, regk=registry["regk"], dig = regser.said, dt=dt) + regser = eventing.revoke(vcdig=creder.said, regk=registry["regk"], dig=regser.said, dt=dt) anchor = dict(i=regser.ked['i'], s=regser.ked["s"], d=regser.said) serder, sigers = helpers.interact(pre=iaid, bran=isalt, pidx=0, ridx=0, dig=serder.said, sn='3', data=[anchor]) @@ -508,22 +508,29 @@ def test_revoke_credential(helpers, seeder): assert res.status_code == 404 assert res.json == {'description': f"credential for said {regser.said} not found.", 'title': '404 Not Found'} - + + badrev = regser.ked.copy() + badrev["ri"] = "EIVtei3pGKGUw8H2Ri0h1uOevtSA6QGAq5wifbtHIaNI" + _, sad = coring.Saider.saidify(badrev) + badbody = dict( - rev=regser.ked.copy(), + rev=sad, ixn=serder.ked, sigs=sigers) - badbody["rev"]["ri"] = "badregk" res = client.simulate_delete(path=f"/identifiers/issuer/credentials/{creder.said}", body=json.dumps(badbody).encode("utf-8")) assert res.status_code == 404 - assert res.json == {'description': f"revocation against invalid registry SAID badregk", + assert res.json == {'description': 'revocation against invalid registry SAID ' + 'EIVtei3pGKGUw8H2Ri0h1uOevtSA6QGAq5wifbtHIaNI', 'title': '404 Not Found'} - + + badrev = regser.ked.copy() + badrev["i"] = "EMgdjM1qALk3jlh4P2YyLRSTcjSOjLXD3e_uYpxbdbg6" + _, sad = coring.Saider.saidify(badrev) + badbody = dict( - rev=regser.ked.copy(), + rev=sad, ixn=serder.ked, sigs=sigers) - badbody["rev"]["i"] = "EMgdjM1qALk3jlh4P2YyLRSTcjSOjLXD3e_uYpxbdbg6" res = client.simulate_delete(path=f"/identifiers/issuer/credentials/{creder.said}", body=json.dumps(badbody).encode("utf-8")) assert res.status_code == 400 assert res.json == {'description': "invalid revocation event.", diff --git a/tests/app/test_grouping.py b/tests/app/test_grouping.py index 0e48be9..4d02e96 100644 --- a/tests/app/test_grouping.py +++ b/tests/app/test_grouping.py @@ -138,7 +138,7 @@ def test_multisig_request_ends(helpers): # Fudge this because we won't be able to save a message from someone else: esaid = exn.ked['e']['d'] - agent.hby.db.meids.add(keys=(esaid,), val=exn.saider) + agent.hby.db.meids.add(keys=(esaid,), val=coring.Saider(qb64=exn.said)) res = client.simulate_get(path=f"/multisig/request/BADSAID") assert res.status_code == 404 @@ -230,7 +230,7 @@ def test_join(helpers, monkeypatch): res = client.simulate_post("/identifiers/mms/multisig/join", json=body) assert res.status_code == 400 - assert res.json == {'description': "Missing or empty version string in key event dict = {'k': " + assert res.json == {'description': "Missing version string field in {'k': " "['DNp1NUbUEgei6KOlIfT5evXueOi3TDFZkUXgJQWNvegf', " "'DLsXs0-dxqrM4hugX7NkfZUzET13ngfRhWC9GgXvX9my', " "'DE2W_yGSF-m44vXPuQ5_wHJ9EK59N-OIT3hABgdAcCKs', " @@ -242,7 +242,7 @@ def test_join(helpers, monkeypatch): "'EBFg-5SGDCv5YfwpkArWRBdTxNRUXU8uVcDKNzizOQZc', " "'EBmW2bXbgsP3HITwW3FmITzAb3wVmHlxCusZ46vgGgP5', " "'EL4RpdS2Atb2Syu5xLdpz9CcNNYoFUUDlLHxHD09vcgh', " - "'EAiBVuuhCZrgckeHc9KzROVGJpmGbk2-e1B25GaeRrJs']}", + "'EAiBVuuhCZrgckeHc9KzROVGJpmGbk2-e1B25GaeRrJs']}.", 'title': '400 Bad Request'} body['rot'] = { diff --git a/tests/app/test_indirecting.py b/tests/app/test_indirecting.py index e516941..cf4dce8 100644 --- a/tests/app/test_indirecting.py +++ b/tests/app/test_indirecting.py @@ -8,7 +8,7 @@ import falcon.testing from hio.help import Hict from keri.app import habbing, httping -from keri.core import coring +from keri.core import coring, serdering from keri.core.coring import randomNonce, MtrDex from keri.vdr import eventing from keria.end import ending @@ -34,7 +34,7 @@ def test_indirecting(helpers): hab = hby.makeHab("test") icp = hab.makeOwnInception() - serder = coring.Serder(raw=icp) + serder = serdering.SerderKERI(raw=icp) atc = icp[:serder.size] client = falcon.testing.TestClient(app) @@ -69,7 +69,7 @@ def test_indirecting(helpers): # Regular (non-mbx) query messages accepted msg = hab.query(pre=hab.pre, src=hab.pre, route="ksn") - serder = coring.Serder(raw=msg) + serder = serdering.SerderKERI(raw=msg) atc = msg[:serder.size] headers = Hict([ @@ -85,7 +85,7 @@ def test_indirecting(helpers): # Mailbox query not found msg = hab.query(pre=hab.pre, src=hab.pre, route="mbx") - serder = coring.Serder(raw=msg) + serder = serdering.SerderKERI(raw=msg) atc = msg[:serder.size] headers = Hict([ @@ -160,8 +160,3 @@ def test_indirecting(helpers): result = client.simulate_get(path="/oobi/EIaGMMWJFPmtXznY1IIiKDIrg-vIyge6mBl2QV8dDjI3") assert result.status == falcon.HTTP_404 - - - - - diff --git a/tests/end/test_ending.py b/tests/end/test_ending.py index 7548fcb..e97320a 100644 --- a/tests/end/test_ending.py +++ b/tests/end/test_ending.py @@ -6,7 +6,7 @@ Testing the Mark II Agent Grouping endpoints """ -from keri.core import coring +from keri.core import serdering from keria.app import aiding from keria.end import ending @@ -54,7 +54,7 @@ def test_oobi_end(helpers): res = client.simulate_post(path=f"/identifiers/aid1/endroles", json=body) op = res.json ked = op["response"] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.raw == rpy.raw res = client.simulate_get(path=f"/oobi") diff --git a/tests/peer/test_exchanging.py b/tests/peer/test_exchanging.py index 4e64d9d..47badb6 100644 --- a/tests/peer/test_exchanging.py +++ b/tests/peer/test_exchanging.py @@ -9,7 +9,7 @@ import json from hio.base import doing -from keri.core import coring, eventing +from keri.core import eventing, serdering from keri.peer.exchanging import exchange from keria.app import aiding @@ -125,11 +125,11 @@ def test_exchange_end(helpers): assert len(res.json) == 2 ked = res.json[0]['exn'] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.said == cexn.said ked = res.json[1]['exn'] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.said == exn.said body = json.dumps({'filter': {'-i': pre}, 'sort': ['-dt'], 'skip': 1, "limit": 1}).encode("utf-8") @@ -138,12 +138,12 @@ def test_exchange_end(helpers): assert len(res.json) == 1 ked = res.json[0]['exn'] - serder = coring.Serder(ked=ked) + serder = serdering.SerderKERI(sad=ked) assert serder.said == exn.said res = client.simulate_get(f"/exchanges/{exn.said}") assert res.status_code == 200 - serder = coring.Serder(ked=res.json['exn']) + serder = serdering.SerderKERI(sad=res.json['exn']) assert serder.said == exn.said payload = dict(