diff --git a/src/keria/app/aiding.py b/src/keria/app/aiding.py index 581cee8b..6bbad1fb 100644 --- a/src/keria/app/aiding.py +++ b/src/keria/app/aiding.py @@ -188,7 +188,7 @@ def on_put(self, req, rep, caid): prxs = val["prxs"] for idx, prx in enumerate(prxs): - cipher = coring.Cipher(qb64=prx) + cipher = core.Cipher(qb64=prx) agent.mgr.rb.prxs.put(keys=verfers[idx].qb64b, val=cipher) if "nxts" in val: @@ -197,7 +197,7 @@ def on_put(self, req, rep, caid): raise ValueError("If encrypted private next keys are provided, must match digers") for idx, prx in enumerate(nxts): - cipher = coring.Cipher(qb64=prx) + cipher = core.Cipher(qb64=prx) agent.mgr.rb.nxts.put(keys=digers[idx].qb64b, val=cipher) agent.mgr.delete_sxlt() diff --git a/src/keria/core/keeping.py b/src/keria/core/keeping.py index d95b8a15..00fd5984 100644 --- a/src/keria/core/keeping.py +++ b/src/keria/core/keeping.py @@ -7,6 +7,7 @@ from dataclasses import dataclass, asdict, field from keri.app.keeping import PreSit, Algos, PubLot, PubSet +from keri import core from keri.core import coring from keri.core.coring import Tiers, MtrDex from keri.db import dbing, subing, koming @@ -109,10 +110,10 @@ def reopen(self, **kwa): self.gbls = subing.Suber(db=self, subkey='gbls.') self.prxs = subing.CesrSuber(db=self, subkey='prxs.', - klas=coring.Cipher) + klas=core.Cipher) self.nxts = subing.CesrSuber(db=self, subkey='nxts.', - klas=coring.Cipher) + klas=core.Cipher) self.mhabs = subing.CesrSuber(db=self, subkey='mhabs.', klas=coring.Prefixer) @@ -263,7 +264,7 @@ def incept(self, pre, verfers, digers, prxs, nxts, transferable): raise ValueError("If encrypted private keys are provided, must match verfers") for idx, prx in enumerate(prxs): - cipher = coring.Cipher(qb64=prx) + cipher = core.Cipher(qb64=prx) self.rb.prxs.put(keys=verfers[idx].qb64b, val=cipher) if nxts is not None: @@ -271,7 +272,7 @@ def incept(self, pre, verfers, digers, prxs, nxts, transferable): raise ValueError("If encrypted private next keys are provided, must match digers") for idx, prx in enumerate(nxts): - cipher = coring.Cipher(qb64=prx) + cipher = core.Cipher(qb64=prx) self.rb.nxts.put(keys=digers[idx].qb64b, val=cipher) def rotate(self, pre, verfers, digers, prxs, nxts, transferable): @@ -293,7 +294,7 @@ def rotate(self, pre, verfers, digers, prxs, nxts, transferable): raise ValueError("If encrypted private keys are provided, must match verfers") for idx, prx in enumerate(prxs): - cipher = coring.Cipher(qb64=prx) + cipher = core.Cipher(qb64=prx) self.rb.prxs.put(keys=verfers[idx].qb64b, val=cipher) if nxts is not None: @@ -301,7 +302,7 @@ def rotate(self, pre, verfers, digers, prxs, nxts, transferable): raise ValueError("If encrypted private keys are provided, must match verfers") for idx, prx in enumerate(nxts): - cipher = coring.Cipher(qb64=prx) + cipher = core.Cipher(qb64=prx) self.rb.nxts.put(keys=digers[idx].qb64b, val=cipher) def params(self, pre): @@ -399,4 +400,4 @@ def __init__(self, rb: RemoteKeeper): self.rb = rb def incept(self, **kwargs): - pass \ No newline at end of file + pass diff --git a/src/keria/testing/testing_helper.py b/src/keria/testing/testing_helper.py index 48521464..af702482 100644 --- a/src/keria/testing/testing_helper.py +++ b/src/keria/testing/testing_helper.py @@ -12,6 +12,7 @@ from falcon import testing from hio.core import http from keri import kering +from keri import core from keri.app import keeping, habbing, configing, signing from keri.core import coring, eventing, parsing, routing, scheming, serdering from keri.core.coring import MtrDex @@ -330,7 +331,7 @@ def incept(bran, stem, pidx, count=1, sith="1", wits=None, toad="0", delpre=None if wits is None: wits = [] - salter = coring.Salter(raw=bran) + salter = core.Salter(raw=bran) creator = keeping.SaltyCreator(salt=salter.qb64, stem=stem, tier=coring.Tiers.low) signers = creator.create(pidx=pidx, ridx=0, tier=coring.Tiers.low, temp=False, count=count) @@ -364,10 +365,10 @@ def inceptRandy(bran, count=1, sith="1", wits=None, toad="0"): if wits is None: wits = [] - salter = coring.Salter(raw=bran) + salter = core.Salter(raw=bran) signer = salter.signer(transferable=False) aeid = signer.verfer.qb64 - encrypter = coring.Encrypter(verkey=aeid) + encrypter = core.Encrypter(verkey=aeid) creator = keeping.RandyCreator() signers = creator.create(count=count) @@ -413,7 +414,7 @@ def inceptExtern(count=1, sith="1", wits=None, toad="0"): @staticmethod def interact(pre, bran, pidx, ridx, sn, dig, data): serder = eventing.interact(pre=pre, dig=dig, sn=sn, data=data) - salter = coring.Salter(raw=bran) + salter = core.Salter(raw=bran) creator = keeping.SaltyCreator(salt=salter.qb64, stem="signify:aid", tier=coring.Tiers.low) signers = creator.create(pidx=pidx, ridx=ridx, tier=coring.Tiers.low, temp=False, count=1) @@ -422,7 +423,7 @@ def interact(pre, bran, pidx, ridx, sn, dig, data): @staticmethod def sign(bran, pidx, ridx, ser): - salter = coring.Salter(raw=bran) + salter = core.Salter(raw=bran) creator = keeping.SaltyCreator(salt=salter.qb64, stem="signify:aid", tier=coring.Tiers.low) signers = creator.create(pidx=pidx, ridx=ridx, tier=coring.Tiers.low, temp=False, count=1) @@ -434,8 +435,8 @@ def createAid(client, name, salt, wits=None, toad="0", delpre=None): serder, signers = Helpers.incept(salt, "signify:aid", pidx=0, wits=wits, toad=toad, delpre=delpre) assert len(signers) == 1 - salter = coring.Salter(raw=salt) - encrypter = coring.Encrypter(verkey=signers[0].verfer.qb64) + salter = core.Salter(raw=salt) + encrypter = core.Encrypter(verkey=signers[0].verfer.qb64) sxlt = encrypter.encrypt(salter.qb64).qb64 sigers = [signer.sign(ser=serder.raw, index=0).qb64 for signer in signers] @@ -521,7 +522,7 @@ def openKeria(salter=None, cf=None, temp=True): if salter is None: salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) if cf is None: cf = configing.Configer(name="keria", headDirPath=SCRIPTS_DIR, reopen=True, clear=False) @@ -566,7 +567,7 @@ def mockNowIso8601(): @staticmethod def mockRandomNonce(): return "A9XfpxIl1LcIkMhUSCCC8fgvkuX8gG9xK3SM-S8a8Y_U" - + class Issuer: LE = "ENTAoj2oNBFpaniRswwPcca9W1ElEeH2V7ahw68HV4G5" diff --git a/tests/app/test_agenting.py b/tests/app/test_agenting.py index ce604d93..c93acdb9 100644 --- a/tests/app/test_agenting.py +++ b/tests/app/test_agenting.py @@ -18,6 +18,7 @@ from keri import kering from keri.app import habbing, configing, oobiing, querying from keri.app.agenting import Receiptor +from keri import core from keri.core import coring, serdering from keri.core.coring import MtrDex from keri.db import basing @@ -63,7 +64,7 @@ def test_load_ends(helpers): def test_agency(): salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) cf = configing.Configer(name="keria", headDirPath=SCRIPTS_DIR, temp=True, reopen=True, clear=False) with habbing.openHby(name="keria", salt=salter.qb64, temp=True, cf=cf) as hby: @@ -180,7 +181,7 @@ def test_boot_ends(helpers): def test_witnesser(helpers): salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) with habbing.openHby(name="keria", salt=salter.qb64, temp=True) as hby: witners = decking.Deck() @@ -199,7 +200,7 @@ def test_witnesser(helpers): def test_keystate_ends(helpers): caid = "ELI7pg979AdhmvrjDeam2eAO2SR5niCgnjAJXJHtJose" salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) cf = configing.Configer(name="keria", headDirPath=SCRIPTS_DIR, temp=True, reopen=True, clear=False) with habbing.openHby(name="keria", salt=salter.qb64, temp=True, cf=cf) as hby: @@ -236,7 +237,7 @@ def test_keystate_ends(helpers): def test_oobi_ends(seeder, helpers): with helpers.openKeria() as (agency, agent, app, client), \ - habbing.openHby(name="wes", salt=coring.Salter(raw=b'wess-the-witness').qb64) as wesHby: + habbing.openHby(name="wes", salt=core.Salter(raw=b'wess-the-witness').qb64) as wesHby: wesHab = wesHby.makeHab(name="wes", transferable=False) result = client.simulate_get(path="/oobi/pal?role=witness") diff --git a/tests/app/test_aiding.py b/tests/app/test_aiding.py index b0a16b1c..c8dfad44 100644 --- a/tests/app/test_aiding.py +++ b/tests/app/test_aiding.py @@ -12,6 +12,7 @@ import falcon from falcon import testing +from keri import core from keri.app import habbing, keeping, configing from keri.app.keeping import Algos from keri.core import coring, eventing, parsing, serdering @@ -244,7 +245,7 @@ def test_agent_resource(helpers, mockHelpingNowUTC): def test_identifier_collection_end(helpers): salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) with helpers.openKeria() as (agency, agent, app, client), \ habbing.openHby(name="p1", temp=True, salt=salter.qb64) as p1hby, \ @@ -288,8 +289,8 @@ def test_identifier_collection_end(helpers): assert res.json == {'description': 'invalid request: one of group, rand or salt field required', 'title': '400 Bad Request'} - salter = coring.Salter(raw=salt) - encrypter = coring.Encrypter(verkey=signers[0].verfer.qb64) + salter = core.Salter(raw=salt) + encrypter = core.Encrypter(verkey=signers[0].verfer.qb64) sxlt = encrypter.encrypt(salter.qb64).qb64 body = {'name': 'aid1', @@ -346,7 +347,7 @@ def test_identifier_collection_end(helpers): assert ss["pidx"] == 1 # Rotate aid1 - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) creator = keeping.SaltyCreator(salt=salter.qb64, stem="signify:aid", tier=coring.Tiers.low) signers = creator.create(pidx=0, ridx=1, tier=coring.Tiers.low, temp=False, count=1) @@ -446,7 +447,7 @@ def test_identifier_collection_end(helpers): agent0 = mhab["state"] # rotate aid3 - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) creator = keeping.SaltyCreator(salt=salter.qb64, stem="signify:aid", tier=coring.Tiers.low) signers = creator.create(pidx=3, ridx=1, tier=coring.Tiers.low, temp=False, count=1) @@ -704,14 +705,14 @@ def test_identifier_collection_end(helpers): pre = randy1["prefix"] params = randy1["randy"] - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) signer = salter.signer(transferable=False) - decrypter = coring.Decrypter(seed=signer.qb64) - encrypter = coring.Encrypter(verkey=signer.verfer.qb64) + decrypter = core.Decrypter(seed=signer.qb64) + encrypter = core.Encrypter(verkey=signer.verfer.qb64) # Now rotate, we must decrypt the prxs, nxts, create a new next key and the rotation event nxts = params["nxts"] - signers = [decrypter.decrypt(cipher=coring.Cipher(qb64=nxt), + signers = [decrypter.decrypt(cipher=core.Cipher(qb64=nxt), transferable=True) for nxt in nxts] creator = keeping.RandyCreator() nsigners = creator.create(count=1) @@ -855,8 +856,8 @@ def test_identifier_collection_end(helpers): delpre = "EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHUNKNx" serder, signers = helpers.incept(salt, "signify:aid", pidx=0, delpre=delpre) - salter = coring.Salter(raw=salt) - encrypter = coring.Encrypter(verkey=signers[0].verfer.qb64) + salter = core.Salter(raw=salt) + encrypter = core.Encrypter(verkey=signers[0].verfer.qb64) sxlt = encrypter.encrypt(salter.qb64).qb64 sigers = [signer.sign(ser=serder.raw, index=0).qb64 for signer in signers] @@ -1002,7 +1003,7 @@ def test_challenge_ends(helpers): def test_contact_ends(helpers): with helpers.openKeria() as (agency, agent, app, client), \ - habbing.openHby(name="ken", salt=coring.Salter(raw=b'0123456789ghijkl').qb64) as kenHby: + habbing.openHby(name="ken", salt=core.Salter(raw=b'0123456789ghijkl').qb64) as kenHby: # Register the identifier endpoint so we can create an AID for the test end = aiding.IdentifierCollectionEnd() @@ -1250,8 +1251,8 @@ def test_identifier_resource_end(helpers): salt = b'0123456789abcdef' serder, signers = helpers.incept(salt, "signify:aid", pidx=0) sigers = [signer.sign(ser=serder.raw, index=0).qb64 for signer in signers] - salter = coring.Salter(raw=salt) - encrypter = coring.Encrypter(verkey=signers[0].verfer.qb64) + salter = core.Salter(raw=salt) + encrypter = core.Encrypter(verkey=signers[0].verfer.qb64) sxlt = encrypter.encrypt(salter.qb64).qb64 body = {'name': 'aid1', @@ -1426,7 +1427,7 @@ def test_rpy_escow_end(helpers): def test_approve_delegation(helpers): caid = "ELI7pg979AdhmvrjDeam2eAO2SR5niCgnjAJXJHtJose" salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) cf = configing.Configer(name="keria", headDirPath=SCRIPTS_DIR, temp=True, reopen=True, clear=False) with habbing.openHby(name="keria", salt=salter.qb64, temp=True, cf=cf) as hby: @@ -1506,7 +1507,7 @@ def test_approve_delegation(helpers): def test_rotation(helpers): caid = "ELI7pg979AdhmvrjDeam2eAO2SR5niCgnjAJXJHtJose" salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) cf = configing.Configer(name="keria", headDirPath=SCRIPTS_DIR, temp=True, reopen=True, clear=False) with habbing.openHby(name="keria", salt=salter.qb64, temp=True, cf=cf) as hby: diff --git a/tests/app/test_indirecting.py b/tests/app/test_indirecting.py index cf4dce8b..b1547242 100644 --- a/tests/app/test_indirecting.py +++ b/tests/app/test_indirecting.py @@ -7,6 +7,7 @@ """ import falcon.testing from hio.help import Hict +from keri import core from keri.app import habbing, httping from keri.core import coring, serdering from keri.core.coring import randomNonce, MtrDex @@ -18,7 +19,7 @@ def test_indirecting(helpers): salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) with helpers.openKeria() as (agency, agent, app, client), \ habbing.openHby(name="keria", salt=salter.qb64, temp=True) as hby: @@ -155,8 +156,8 @@ def test_indirecting(helpers): app.add_route("/oobi/{aid}/{role}/{eid}", oobiEnd) result = client.simulate_get(path="/oobi/EHgwVwQT15OJvilVvW57HE4w0-GPs_Stj2OFoAHZSysY/role") - assert result.status == falcon.HTTP_200 + assert result.status == falcon.HTTP_200 result = client.simulate_get(path="/oobi/EIaGMMWJFPmtXznY1IIiKDIrg-vIyge6mBl2QV8dDjI3") - assert result.status == falcon.HTTP_404 + assert result.status == falcon.HTTP_404 diff --git a/tests/app/test_ipexing.py b/tests/app/test_ipexing.py index 4182b491..47cc492b 100644 --- a/tests/app/test_ipexing.py +++ b/tests/app/test_ipexing.py @@ -338,10 +338,10 @@ def test_ipex_grant(helpers, mockHelpingNowIso8601, seeder): def test_multisig_grant_admit(seeder, helpers): - with (helpers.openKeria(salter=coring.Salter(raw=b'0123456789abcM00')) as (agency0, agent0, app0, client0), \ - helpers.openKeria(salter=coring.Salter(raw=b'0123456789abcM01')) as (agency1, agent1, app1, client1), \ - helpers.openKeria(salter=coring.Salter(raw=b'0123456789abcM02')) as (hagency0, hagent0, happ0, hclient0), \ - helpers.openKeria(salter=coring.Salter(raw=b'0123456789abcM03')) as (hagency1, hagent1, happ1, hclient1)): + with (helpers.openKeria(salter=core.Salter(raw=b'0123456789abcM00')) as (agency0, agent0, app0, client0), \ + helpers.openKeria(salter=core.Salter(raw=b'0123456789abcM01')) as (agency1, agent1, app1, client1), \ + helpers.openKeria(salter=core.Salter(raw=b'0123456789abcM02')) as (hagency0, hagent0, happ0, hclient0), \ + helpers.openKeria(salter=core.Salter(raw=b'0123456789abcM03')) as (hagency1, hagent1, happ1, hclient1)): tock = 0.03125 doist = doing.Doist(tock=tock, real=True) diff --git a/tests/core/test_authing.py b/tests/core/test_authing.py index 5aa24692..7885f729 100644 --- a/tests/core/test_authing.py +++ b/tests/core/test_authing.py @@ -11,6 +11,7 @@ from hio.base import doing from hio.help import Hict from keri import kering +from keri import core from keri.app import habbing from keri.core import parsing, eventing, coring from keri.end import ending @@ -21,7 +22,7 @@ def test_authenticater(mockHelpingNowUTC): salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) with habbing.openHab(name="caid", salt=salt, temp=True) as (controllerHby, controller): @@ -205,7 +206,7 @@ def test_signature_validation(mockHelpingNowUTC): assert rep.status == falcon.HTTP_401 salt = b'0123456789abcdef' - salter = coring.Salter(raw=salt) + salter = core.Salter(raw=salt) with habbing.openHab(name="caid", salt=salt, temp=True) as (controllerHby, controller): agency = agenting.Agency(name="agency", base='', bran=None, temp=True)