Clean up connect - #405
Conversation
Separate ordinary reconnection from the post-boot path so a newly booted client can reuse its existing Controller while reconnecting clients restore authoritative state from KERIA. Validate the establishment state before allowing Controller reuse. Require KERIA to accept the Agent delegation approval, then verify that the Controller interaction event at sequence 1 anchors the expected Agent seal before exposing authenticated client services. Reject malformed sequence data and remove permissive numeric coercion. Add focused coverage for Controller reuse, existing approvals, rejected approvals, invalid sequence data, and mismatched Agent delegation seals.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
=======================================
Coverage 93.75% 93.75%
=======================================
Files 1 1
Lines 80 80
Branches 28 28
=======================================
Hits 75 75
Misses 3 3
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| }; | ||
| } | ||
|
|
||
| /** Verify the local interaction event anchors this exact Agent. */ |
There was a problem hiding this comment.
Is this implying there is a use case to connect a client to multiple agents? If not, sn > 0 was if anything safer as it avoids accidentally connecting to a different one.
There was a problem hiding this comment.
At least until a point where we have the idea of moving to a new agent.
There was a problem hiding this comment.
No, it doesn't imply multiple agents, it just verifies the actual interaction event rather than making only a sequence number assertion.
There was a problem hiding this comment.
The main value here in my mind comes from being explicit and verifying the delegation approval. It would have helped me learn the library when I was first learning the Signify edge client and agent delegation model.
It isn't as hard to learn that these days by using AI.
I can strip this down to just the ConnectionOptions with AbortSignal if we don't believe the delegation anchor seal validation is worth the increased complexity.
There was a problem hiding this comment.
Sorry, you're right. But still, I'm unsure on the exact value of the check:
clienting.approveDelegation(this.agent!)directly readsagent.pre,agent.sn,agent.saidand creates and signs an event locally (no calls to KERIA).- Then immediately call
_verifyAgentDelegationSealon the result, which compares againstagent.pre,agent.sn,agent.said.
There was a problem hiding this comment.
Yeah, that's true. I'll remove that from this PR and later we can consider whether we want to explicitly validate, post delegation completion, the delegator and delegate KELs.
8d91628 to
1cca7fe
Compare
1cca7fe to
b60cf59
Compare
This PR cleans up some long-standing gaps we've had in SignifyController booting and connecting:
AbortSignalto boot and connect flows./agent/<ctrl Pre>?type=ixndelegation request.