Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(did-comm): add trust ping protocol #1080

Merged
merged 15 commits into from
Dec 6, 2022
Merged

Conversation

nickreynolds
Copy link
Contributor

@nickreynolds nickreynolds commented Nov 30, 2022

What issue is this PR fixing

closes #1079

What is being changed

A clear description of what this PR brings.

Quality

Check all that apply:

  • I want these changes to be integrated
  • I successfully ran yarn, yarn build, yarn test, yarn test:browser locally.
  • I allow my PR to be updated by the reviewers (to speed up the review process).
  • I added unit tests.
  • I added integration tests.
  • I did not add automated tests because _________, and I am aware that a PR without tests will likely get rejected.

Details

If applicable, add screen captures, error messages or stack traces to help explain your problem.

@nickreynolds nickreynolds force-pushed the nickreynolds/trust-ping branch from b9c63a5 to b90359e Compare December 5, 2022 18:56
@nickreynolds nickreynolds marked this pull request as ready for review December 5, 2022 18:57
@nickreynolds nickreynolds requested review from mirceanis and simonas-notcat and removed request for mirceanis December 5, 2022 20:50
@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Merging #1080 (69ca244) into next (125bf42) will decrease coverage by 0.50%.
The diff coverage is 77.27%.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #1080      +/-   ##
==========================================
- Coverage   80.25%   79.74%   -0.51%     
==========================================
  Files         118      132      +14     
  Lines        4056     4739     +683     
  Branches      875     1016     +141     
==========================================
+ Hits         3255     3779     +524     
- Misses        798      960     +162     
+ Partials        3        0       -3     

Copy link
Member

@mirceanis mirceanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, kudos for the thorough testing!

It's a straight forward approach, using the message handler chain for this, and consistent with the existing codebase.
I'm not sure if this is a problem for this protocol, but this can be triggered by any message that looks like a trust ping, even if it doesn't come through didcomm.

Another possible approach for protocol implementations would be to create protocol handlers as agent plugins that react based on event listeners.
Maybe for future protocols we can also explore this option but we need to figure out how to forward events for agents that use @veramo/remote-client

That being said, now with a new message handler supported, we should also update our default CLI config file.

packages/message-handler/src/abstract-message-handler.ts Outdated Show resolved Hide resolved
packages/did-comm/src/__tests__/message-handler.test.ts Outdated Show resolved Hide resolved
__tests__/shared/didCommPacking.ts Outdated Show resolved Hide resolved
@nickreynolds
Copy link
Contributor Author

It's a straight forward approach, using the message handler chain for this, and consistent with the existing codebase. I'm not sure if this is a problem for this protocol, but this can be triggered by any message that looks like a trust ping, even if it doesn't come through didcomm.

Another possible approach for protocol implementations would be to create protocol handlers as agent plugins that react based on event listeners.

@mirceanis

Yeah, it being able to be triggered by "non didcomm messages" was intentional. It at least makes testing a bit easier since it can be separated from didcomm's own message handler. I don't feel strongly though, but it seems fine to do it this way?

I was considering using the event listener system as well, but it seemed to work well with the message handler flow. If we decide that other "didcomm protocols" should use the event system, I can refactor this one at that time.

Made the small changes you requested

Copy link
Member

@mirceanis mirceanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Yeah, we can refactor to event system later, if needed.

Please also consider adding this new handler to the default CLI config

@nickreynolds nickreynolds merged commit fb22e63 into next Dec 6, 2022
@nickreynolds nickreynolds deleted the nickreynolds/trust-ping branch December 6, 2022 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[proposal] Add Trust Ping Protocol
2 participants