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

fix(oob): support oob with connection and messages #1558

Conversation

TimoGlastra
Copy link
Contributor

Fixes #1129

We now correctly check whether an oob exchange is associated with an exchange if there's no connectionId, and assign the connection if this is the case.

I think we now really support al flows and combinations of messages / handhsake / connectionless from the oob protocol.

Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Timo Glastra <timo@animo.id>
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2023

Codecov Report

Merging #1558 (c015708) into main (11050af) will decrease coverage by 23.14%.
The diff coverage is 71.42%.

@@             Coverage Diff             @@
##             main    #1558       +/-   ##
===========================================
- Coverage   85.73%   62.59%   -23.14%     
===========================================
  Files         950      774      -176     
  Lines       22761    17843     -4918     
  Branches     3982     3069      -913     
===========================================
- Hits        19514    11169     -8345     
- Misses       3062     6136     +3074     
- Partials      185      538      +353     
Files Changed Coverage Δ
...oncreds/src/protocols/proofs/v1/V1ProofProtocol.ts 2.42% <0.00%> (-86.27%) ⬇️
...ges/core/src/modules/credentials/CredentialsApi.ts 85.56% <ø> (-1.04%) ⬇️
packages/core/src/types.ts 100.00% <ø> (ø)
...c/protocols/credentials/v1/V1CredentialProtocol.ts 30.21% <45.45%> (-62.76%) ⬇️
.../src/modules/proofs/protocol/v2/V2ProofProtocol.ts 76.78% <60.00%> (-16.91%) ⬇️
.../modules/connections/services/ConnectionService.ts 85.16% <66.66%> (-3.18%) ⬇️
...es/credentials/protocol/v2/V2CredentialProtocol.ts 76.98% <66.66%> (-13.48%) ⬇️
packages/core/src/utils/parseInvitation.ts 46.15% <66.66%> (-31.63%) ⬇️
...entials/protocol/v2/CredentialFormatCoordinator.ts 89.05% <83.33%> (-0.73%) ⬇️
packages/core/src/modules/oob/OutOfBandApi.ts 83.80% <89.65%> (-5.38%) ⬇️
... and 6 more

... and 467 files with indirect coverage changes

Copy link
Contributor

@berendsliedrecht berendsliedrecht left a comment

Choose a reason for hiding this comment

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

Couple of very minor points, otherwise LGTM.

@@ -297,8 +297,11 @@ async function addExchangeDataToMessage(
associatedRecord: BaseRecordAny
}
) {
const legacyInvitationMetadata = outOfBandRecord?.metadata.get(OutOfBandRecordMetadataKeys.LegacyInvitation)
Copy link
Contributor

Choose a reason for hiding this comment

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

this file has an unused import from http which is a mistake, but not from your PR. Can you remove it?

GitHub does not allow me to add a comment there...

// Set the parentThreadId on the message from the oob invitation
if (outOfBandRecord) {
// If connectionless is used, we should not add the parentThreadId
if (outOfBandRecord && legacyInvitationMetadata?.legacyInvitationType !== 'connectionless') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make more sense to have legacyInvitationType be an enum?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah probably :)

Copy link
Contributor

Choose a reason for hiding this comment

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

In ConnectionRecord we have the protocol field where we define the handshake protocol for the DID Exchange, and in the case of DIDComm V2, where no handshake protocol is involved, we set it to None. If this legacyInvitationType refers to the message type, would it make sense to call it 'none'. in the case of a connection-less exchange?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would it make sense to call it 'none'. in the case of a connection-less exchange?

Well in that case we don't know explicitly if it's a connectionless message, and we have custom behaviour for that as you can see here. I'd still call a message with a ~service an invitation to do something.

So invitation type here refers less to connections, and more to an invitation to an exchange that is sent not over didcomm. (connectionless, connection v1, oob v1, etc..)

*/
public async matchIncomingMessageToRequestMessageInOutOfBandExchange(
messageContext: InboundMessageContext,
{ knownConnectionId }: { knownConnectionId?: string }
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it should be

Suggested change
{ knownConnectionId }: { knownConnectionId?: string }
{ expectedConnectionId }: { expectedConnectionId?: string }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense. I was thinking if it is undefined it doesn't make sense. But after thining about it again, if it's undefined we don't really expect a specific connection Id

// Set the parentThreadId on the message from the oob invitation
if (outOfBandRecord) {
// If connectionless is used, we should not add the parentThreadId
if (outOfBandRecord && legacyInvitationMetadata?.legacyInvitationType !== 'connectionless') {
Copy link
Contributor

Choose a reason for hiding this comment

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

In ConnectionRecord we have the protocol field where we define the handshake protocol for the DID Exchange, and in the case of DIDComm V2, where no handshake protocol is involved, we set it to None. If this legacyInvitationType refers to the message type, would it make sense to call it 'none'. in the case of a connection-less exchange?

* If is the case, and the state of the out of band record is still await response, the state will be updated to done
*
*/
public async matchIncomingMessageToRequestMessageInOutOfBandExchange(
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow this is a huge method with a huge name!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, i like explicitness over being brief. But suggestions welcome! :)

TimoGlastra and others added 6 commits September 21, 2023 16:26
Signed-off-by: Tom Lanser <tom@devv.nl>
Signed-off-by: Tom Lanser <tom@devv.nl>
Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Timo Glastra <timo@animo.id>
@TimoGlastra TimoGlastra merged commit 9732ce4 into openwallet-foundation:main Sep 22, 2023
8 checks passed
@TimoGlastra TimoGlastra deleted the fix/oob-connections-and-messages branch September 22, 2023 14:41
genaris pushed a commit to genaris/credo-ts that referenced this pull request Sep 22, 2023
…tion#1558)

Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
auer-martin pushed a commit to auer-martin/aries-framework-javascript that referenced this pull request Nov 15, 2023
…tion#1558)

Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Martin Auer <martin.auer97@gmail.com>
amitpadmani-awts pushed a commit to ayanworks/aries-framework-javascript that referenced this pull request Nov 29, 2023
* fix: listen to incoming messages on agent initialize not constructor (openwallet-foundation#1542)

Signed-off-by: Niall Shaw <niall.shaw@absa.africa>

* fix(cheqd): make cosmos payer seed optional (openwallet-foundation#1547)

Signed-off-by: Timo Glastra <timo@animo.id>

* fix: create message subscription first (openwallet-foundation#1549)

Signed-off-by: Timo Glastra <timo@animo.id>

* fix(transport): Use connection in WebSocket ID (openwallet-foundation#1551)

* fix: priority sorting for didcomm services (openwallet-foundation#1555)

Signed-off-by: Timo Glastra <timo@animo.id>

* fix: bump missing dependencies version (openwallet-foundation#1557)

Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>

* chore(release): v0.4.1 (openwallet-foundation#1548)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: do not send package via outdated session (openwallet-foundation#1559)

Signed-off-by: Niall Shaw <niall.shaw@absa.africa>

* build(deps): bump @types/indy-sdk from 1.16.26 to 1.16.27 (openwallet-foundation#1564)

Signed-off-by: dependabot[bot] <support@github.com>

* fix(cheqd): changed the name formatting to a encoded hex value (openwallet-foundation#1574)

Signed-off-by: Tom Lanser <tom@animo.id>

* build(deps): bump @cheqd/ts-proto from 2.2.0 to 2.2.2 (openwallet-foundation#1568)

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump @cosmjs/proto-signing from 0.31.0 to 0.31.1 (openwallet-foundation#1566)

Signed-off-by: dependabot[bot] <support@github.com>

* fix(core): remove node-fetch dependency (openwallet-foundation#1578)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: log and throw on WebSocket sending errors (openwallet-foundation#1573)

Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>

* fix(oob): support oob with connection and messages (openwallet-foundation#1558)

Signed-off-by: Timo Glastra <timo@animo.id>

* feat: allow connection invitation encoded in oob url param (openwallet-foundation#1583)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: duplicate service ids in connections protocol (openwallet-foundation#1589)

* fix: implicit invitation to specific service (openwallet-foundation#1592)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix(askar): throw error if imported wallet exists (openwallet-foundation#1593)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: service validation in OOB invitation objects (openwallet-foundation#1575)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: update tsyringe for ts 5 support (openwallet-foundation#1588)

Signed-off-by: Timo Glastra <timo@animo.id>

* chore(release): v0.4.2 (openwallet-foundation#1591)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: save AnonCredsCredentialRecord createdAt (openwallet-foundation#1603)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* feat: sped up lookup for revocation registries (openwallet-foundation#1605)

Signed-off-by: wadeking98 <wkingnumber2@gmail.com>

* build(deps): bump @types/express from 4.17.17 to 4.17.18 (openwallet-foundation#1596)

Bumps [@types/express](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express) from 4.17.17 to 4.17.18.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express)

---
updated-dependencies:
- dependency-name: "@types/express"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump actions/checkout from 3 to 4 (openwallet-foundation#1599)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump amannn/action-semantic-pull-request from 5.2.0 to 5.3.0 (openwallet-foundation#1598)

build(deps): bump amannn/action-semantic-pull-request

Bumps [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/amannn/action-semantic-pull-request/releases)
- [Changelog](https://github.com/amannn/action-semantic-pull-request/blob/main/CHANGELOG.md)
- [Commits](amannn/action-semantic-pull-request@v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: amannn/action-semantic-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: abandon proof protocol if presentation fails (openwallet-foundation#1610)

Signed-off-by: Timo Glastra <timo@animo.id>

* feat!: upgrade shared components (openwallet-foundation#1606)

* feat: update dockerfile to node 18 and sample mediator to askar (openwallet-foundation#1622)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* feat(sd-jwt-vc): Module for Issuer, Holder and verifier (openwallet-foundation#1607)

Signed-off-by: Berend Sliedrecht <blu3beri@proton.me>

* feat(indy-vdr): ability to refresh the pool manually (openwallet-foundation#1623)

Signed-off-by: wadeking98 <wkingnumber2@gmail.com>

* build(deps): bump @babel/traverse from 7.21.4 to 7.23.2 (openwallet-foundation#1608)

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump uuid and @types/uuid (openwallet-foundation#1597)

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): use node's built-in fetch (openwallet-foundation#1631)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* build(deps): bump react-devtools-core from 4.27.6 to 4.28.5 (openwallet-foundation#1630)

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump @mattrglobal/bbs-signatures from 1.1.0 to 1.3.1 (openwallet-foundation#1601)

Signed-off-by: dependabot[bot] <support@github.com>

* fix: some log messages (openwallet-foundation#1636)

Signed-off-by: Timo Glastra <timo@animo.id>

* feat: bump indy-vdr version (openwallet-foundation#1637)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix(core): allow string for did document controller (openwallet-foundation#1644)

Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>

* feat(anoncreds): issue revocable credentials (openwallet-foundation#1427)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* refactor(anoncreds)!: move supportRevocation to options (openwallet-foundation#1648)

Signed-off-by: Timo Glastra <timo@animo.id>

* refactor: move message-pickup directory (openwallet-foundation#1650)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

---------

Signed-off-by: Niall Shaw <niall.shaw@absa.africa>
Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Tom Lanser <tom@animo.id>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Signed-off-by: wadeking98 <wkingnumber2@gmail.com>
Signed-off-by: Berend Sliedrecht <blu3beri@proton.me>
Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
Co-authored-by: Niall Shaw <100220424+niall-shaw@users.noreply.github.com>
Co-authored-by: Timo Glastra <timo@animo.id>
Co-authored-by: Alexander Shenshin <93187809+AlexanderShenshin@users.noreply.github.com>
Co-authored-by: ericvergnaud <eric.vergnaud@wanadoo.fr>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Lanser <tommy.lanser@gmail.com>
Co-authored-by: Ariel Gentile <gentilester@gmail.com>
Co-authored-by: Wade King <wkingnumber2@gmail.com>
Co-authored-by: Berend Sliedrecht <61358536+berendsliedrecht@users.noreply.github.com>
amitpadmani-awts pushed a commit to ayanworks/aries-framework-javascript that referenced this pull request Nov 29, 2023
* fix: listen to incoming messages on agent initialize not constructor (openwallet-foundation#1542)

Signed-off-by: Niall Shaw <niall.shaw@absa.africa>

* fix(cheqd): make cosmos payer seed optional (openwallet-foundation#1547)

Signed-off-by: Timo Glastra <timo@animo.id>

* fix: create message subscription first (openwallet-foundation#1549)

Signed-off-by: Timo Glastra <timo@animo.id>

* fix(transport): Use connection in WebSocket ID (openwallet-foundation#1551)

* fix: priority sorting for didcomm services (openwallet-foundation#1555)

Signed-off-by: Timo Glastra <timo@animo.id>

* fix: bump missing dependencies version (openwallet-foundation#1557)

Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>

* chore(release): v0.4.1 (openwallet-foundation#1548)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: do not send package via outdated session (openwallet-foundation#1559)

Signed-off-by: Niall Shaw <niall.shaw@absa.africa>

* build(deps): bump @types/indy-sdk from 1.16.26 to 1.16.27 (openwallet-foundation#1564)

Signed-off-by: dependabot[bot] <support@github.com>

* fix(cheqd): changed the name formatting to a encoded hex value (openwallet-foundation#1574)

Signed-off-by: Tom Lanser <tom@animo.id>

* build(deps): bump @cheqd/ts-proto from 2.2.0 to 2.2.2 (openwallet-foundation#1568)

Signed-off-by: dependabot[bot] <support@github.com>

* build(deps): bump @cosmjs/proto-signing from 0.31.0 to 0.31.1 (openwallet-foundation#1566)

Signed-off-by: dependabot[bot] <support@github.com>

* fix(core): remove node-fetch dependency (openwallet-foundation#1578)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: log and throw on WebSocket sending errors (openwallet-foundation#1573)

Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>

* fix(oob): support oob with connection and messages (openwallet-foundation#1558)

Signed-off-by: Timo Glastra <timo@animo.id>

* feat: allow connection invitation encoded in oob url param (openwallet-foundation#1583)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: duplicate service ids in connections protocol (openwallet-foundation#1589)

* fix: implicit invitation to specific service (openwallet-foundation#1592)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix(askar): throw error if imported wallet exists (openwallet-foundation#1593)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: service validation in OOB invitation objects (openwallet-foundation#1575)

Signed-off-by: Ariel Gentile <gentilester@gmail.com>

* fix: update tsyringe for ts 5 support (openwallet-foundation#1588)

Signed-off-by: Timo Glastra <timo@animo.id>

* chore(release): v0.4.2 (openwallet-foundation#1591)

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* chore: update yarn.lock

Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>

---------

Signed-off-by: Niall Shaw <niall.shaw@absa.africa>
Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Eric Vergnaud <eric.vergnaud@wanadoo.fr>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Tom Lanser <tom@animo.id>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Signed-off-by: Sai Ranjit Tummalapalli <sairanjit.tummalapalli@ayanworks.com>
Co-authored-by: Niall Shaw <100220424+niall-shaw@users.noreply.github.com>
Co-authored-by: Timo Glastra <timo@animo.id>
Co-authored-by: Alexander Shenshin <93187809+AlexanderShenshin@users.noreply.github.com>
Co-authored-by: ericvergnaud <eric.vergnaud@wanadoo.fr>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Lanser <tommy.lanser@gmail.com>
Co-authored-by: Ariel Gentile <gentilester@gmail.com>
auer-martin pushed a commit to auer-martin/aries-framework-javascript that referenced this pull request Dec 4, 2023
…tion#1558)

Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Martin Auer <martin.auer97@gmail.com>
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.

Cannot process RequestCredentialMessage for the OOB attached credential-offer
5 participants