diff --git a/setup.py b/setup.py index 9f785855..12fff845 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,7 @@ python_requires='>=3.12.2', install_requires=[ 'hio>=0.6.12', - 'keri @ git+https://git@github.com/weboftrust/keripy.git@development', + 'keri>=1.2.0-dev0', 'mnemonic>=0.20', 'multicommand>=1.0.0', 'falcon>=3.1.3', diff --git a/src/keria/app/aiding.py b/src/keria/app/aiding.py index 83605f1a..581cee8b 100644 --- a/src/keria/app/aiding.py +++ b/src/keria/app/aiding.py @@ -296,7 +296,7 @@ def on_get(req, rep): end = start + (len(res) - 1) if len(res) > 0 else 0 rep.set_header("Accept-Ranges", "aids") - rep.set_header("Content-Range", f"aids {start}-{end}/{count-1}") + rep.set_header("Content-Range", f"aids {start}-{end}/{count - 1}") rep.content_type = "application/json" rep.data = json.dumps(res).encode("utf-8") @@ -483,17 +483,19 @@ def on_put(self, req, rep, name): raise falcon.HTTPNotFound(title=f"No AID with name {name} found") body = req.get_media() newName = body.get("name") - habord = hab.db.habs.get(keys=name) - hab.db.habs.put(keys=newName, - val=habord) - hab.db.habs.rem(keys=name) + habord = hab.db.habs.get(keys=(hab.pre,)) + habord.name = newName + hab.db.habs.pin(keys=(hab.pre,), + val=habord) + hab.db.names.pin(keys=("", newName), val=hab.pre) + hab.db.names.rem(keys=("", name)) hab.name = newName hab = agent.hby.habByName(newName) data = info(hab, agent.mgr, full=True) rep.status = falcon.HTTP_200 rep.content_type = "application/json" rep.data = json.dumps(data).encode("utf-8") - + def on_delete(self, req, rep, name): """ Identifier delete endpoint @@ -509,7 +511,7 @@ def on_delete(self, req, rep, name): hab = agent.hby.habByName(name) if hab is None: raise falcon.HTTPNotFound(title=f"No AID with name {name} found") - hab.db.habs.rem(keys=name) + agent.hby.deleteHab(name) rep.status = falcon.HTTP_200 def on_post(self, req, rep, name): @@ -532,7 +534,7 @@ def on_post(self, req, rep, name): op = self.interact(agent, name, body) else: raise falcon.HTTPBadRequest(title="invalid request", - description=f"required field 'rot' or 'ixn' missing from request") + description=f"required field 'rot' or 'ixn' missing from request") rep.status = falcon.HTTP_200 rep.content_type = "application/json" @@ -709,7 +711,8 @@ def on_get(req, rep, name): if role in (kering.Roles.witness,): # Fetch URL OOBIs for all witnesses oobis = [] for wit in hab.kever.wits: - urls = hab.fetchUrls(eid=wit, scheme=kering.Schemes.http) or hab.fetchUrls(eid=wit, scheme=kering.Schemes.https) + urls = hab.fetchUrls(eid=wit, scheme=kering.Schemes.http) or hab.fetchUrls(eid=wit, + scheme=kering.Schemes.https) if not urls: raise falcon.HTTPNotFound(description=f"unable to query witness {wit}, no http endpoint") @@ -719,7 +722,8 @@ def on_get(req, rep, name): res["oobis"] = oobis elif role in (kering.Roles.controller,): # Fetch any controller URL OOBIs oobis = [] - urls = hab.fetchUrls(eid=hab.pre, scheme=kering.Schemes.http) or hab.fetchUrls(eid=hab.pre, scheme=kering.Schemes.https) + urls = hab.fetchUrls(eid=hab.pre, scheme=kering.Schemes.http) or hab.fetchUrls(eid=hab.pre, + scheme=kering.Schemes.https) if not urls: raise falcon.HTTPNotFound(description=f"unable to query controller {hab.pre}, no http endpoint") @@ -728,7 +732,10 @@ def on_get(req, rep, name): oobis.append(urljoin(up.geturl(), f"/oobi/{hab.pre}/controller")) res["oobis"] = oobis elif role in (kering.Roles.agent,): # Fetch URL OOBIs for all witnesses - roleUrls = hab.fetchRoleUrls(cid=hab.pre, role=kering.Roles.agent, scheme=kering.Schemes.http) or hab.fetchRoleUrls(cid=hab.pre, role=kering.Roles.agent, scheme=kering.Schemes.https) + roleUrls = hab.fetchRoleUrls(cid=hab.pre, role=kering.Roles.agent, + scheme=kering.Schemes.http) or hab.fetchRoleUrls(cid=hab.pre, + role=kering.Roles.agent, + scheme=kering.Schemes.https) if kering.Roles.agent not in roleUrls: res['oobis'] = [] else: diff --git a/tests/app/test_aiding.py b/tests/app/test_aiding.py index a8f5717f..0c5bde34 100644 --- a/tests/app/test_aiding.py +++ b/tests/app/test_aiding.py @@ -376,7 +376,7 @@ def test_identifier_collection_end(helpers): 'salty': {'stem': 'signify:aid', 'pidx': 0, 'tier': 'low', 'sxlt': sxlt, 'icodes': [MtrDex.Ed25519_Seed], 'ncodes': [MtrDex.Ed25519_Seed]} } - res = client.simulate_put(path="/identifiers/aid1", body=json.dumps(body)) + res = client.simulate_post(path="/identifiers/aid1/events", body=json.dumps(body)) assert res.status_code == 500 # Test with witnesses @@ -419,7 +419,6 @@ def test_identifier_collection_end(helpers): assert res.status_code == 200 assert res.json['done'] is False - assert len(agent.witners) == 1 res = client.simulate_get(path="/identifiers") assert res.status_code == 200