From dd28950edaeda0152ea88f116ba9e5e4e0dcc8bd Mon Sep 17 00:00:00 2001 From: 2byrds <2byrds@gmail.com> Date: Wed, 22 May 2024 20:35:07 -0400 Subject: [PATCH 1/2] added approval endpoint for delegator after they anchor it in their KEL Signed-off-by: 2byrds <2byrds@gmail.com> --- src/keria/app/aiding.py | 34 ++++++++++++++++++++++++++++++++++ src/keria/app/delegating.py | 4 +--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/keria/app/aiding.py b/src/keria/app/aiding.py index fa8ef21a..ef688384 100644 --- a/src/keria/app/aiding.py +++ b/src/keria/app/aiding.py @@ -532,6 +532,8 @@ def on_post(self, req, rep, name): op = self.rotate(agent, name, body) elif body.get("ixn") is not None: op = self.interact(agent, name, body) + elif body.get("approveDelegation") is not None: + op = self.approveDelegation(agent, name, body) else: raise falcon.HTTPBadRequest(title="invalid request", description=f"required field 'rot' or 'ixn' missing from request") @@ -655,7 +657,39 @@ def interact(agent, name, body): op = agent.monitor.submit(hab.kever.prefixer.qb64, longrunning.OpTypes.done, metadata=dict(response=serder.ked)) return op + + @staticmethod + def approveDelegation(agent, name, body): + hab = agent.hby.habByName(name) + if hab is None: + raise falcon.HTTPNotFound(title=f"No AID {name} found") + + ixn = body.get("approveDelegation") + if ixn is None: + raise falcon.HTTPBadRequest(title="invalid interaction", + description=f"required field 'approveDelegation' missing from request") + + sigs = body.get("sigs") + if sigs is None or len(sigs) == 0: + raise falcon.HTTPBadRequest(title="invalid interaction", + description=f"required field 'sigs' missing from approveDelegation request") + + serder = serdering.SerderKERI(sad=ixn) + sigers = [core.Siger(qb64=sig) for sig in sigs] + + kever = hab.kevers[hab.pre] + + gatePre = ixn['a'][0]['i'] + gateSaid = ixn['a'][0]['d'] + + seqner = coring.Seqner(sn=serder.sn) + couple = seqner.qb64b + serder.saidb + dgkey = dbing.dgKey(coring.Saider(qb64=gatePre).qb64b, coring.Saider(qb64=gateSaid).qb64b) + hab.db.setAes(dgkey, couple) # authorizer event seal (delegator/issuer) + op = agent.monitor.submit(hab.kever.prefixer.qb64, longrunning.OpTypes.done, + metadata=dict(response=serder.ked)) + return op def info(hab, rm, full=False): data = dict( diff --git a/src/keria/app/delegating.py b/src/keria/app/delegating.py index 8bd5bf74..9562134a 100644 --- a/src/keria/app/delegating.py +++ b/src/keria/app/delegating.py @@ -109,9 +109,7 @@ def processEscrows(self): def processUnanchoredEscrow(self): """ - Process escrow of partially signed multisig group KEL events. Message - processing will send this local controllers signature to all other participants - then this escrow waits for signatures from all other participants + Process escrow of unacnchored events that have been delegated and are waiting for delegator anchor or approval. """ for (pre, said), serder in self.hby.db.dune.getItemIter(): # group partial witness escrow From f43b4d6b153995671a8dfae8b264e393e22c4525 Mon Sep 17 00:00:00 2001 From: Lance Date: Mon, 27 May 2024 11:25:16 -0400 Subject: [PATCH 2/2] Update src/keria/app/delegating.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Lenksjö <5889538+lenkan@users.noreply.github.com> --- src/keria/app/delegating.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/keria/app/delegating.py b/src/keria/app/delegating.py index 9562134a..97e57b39 100644 --- a/src/keria/app/delegating.py +++ b/src/keria/app/delegating.py @@ -109,7 +109,7 @@ def processEscrows(self): def processUnanchoredEscrow(self): """ - Process escrow of unacnchored events that have been delegated and are waiting for delegator anchor or approval. + Process escrow of unanchored events that have been delegated and are waiting for delegator anchor or approval. """ for (pre, said), serder in self.hby.db.dune.getItemIter(): # group partial witness escrow