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(oob): allow to append attachments to invitations #926

Merged

Conversation

genaris
Copy link
Contributor

@genaris genaris commented Jul 3, 2022

Adds an optional appendedAttachments field for OOB invitations (and legacy Connection Invitation messages) that allows to append attachments as per Aries RFC 0017.

Signed-off-by: Ariel Gentile [email protected]

@genaris genaris requested a review from a team as a code owner July 3, 2022 20:34
@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2022

Codecov Report

Merging #926 (7c92b88) into main (7eae144) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #926      +/-   ##
==========================================
+ Coverage   87.70%   87.72%   +0.02%     
==========================================
  Files         475      475              
  Lines       11339    11343       +4     
  Branches     1874     1875       +1     
==========================================
+ Hits         9945     9951       +6     
+ Misses       1327     1325       -2     
  Partials       67       67              
Impacted Files Coverage Δ
...e/src/decorators/attachment/AttachmentExtension.ts 64.28% <ø> (+14.28%) ⬆️
packages/core/src/modules/oob/helpers.ts 100.00% <ø> (ø)
packages/core/src/index.ts 100.00% <100.00%> (ø)
...onnections/messages/ConnectionInvitationMessage.ts 98.11% <100.00%> (+0.03%) ⬆️
packages/core/src/modules/oob/OutOfBandModule.ts 87.50% <100.00%> (+0.04%) ⬆️
...re/src/modules/oob/messages/OutOfBandInvitation.ts 96.25% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7eae144...7c92b88. Read the comment docs.

Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

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

Do you think there's a lot of benefit in doing:

new ConnectionInvitationMessage({
  appendedAttachments: [attachment]
})

over

const invitation = new ConnectionInvitationMessage({
  appendedAttachments: []
})
invitation.appendedAttachments.push(attachment)

Or is there something else this will unlock?

@TimoGlastra
Copy link
Contributor

Can you update the branch?

@genaris
Copy link
Contributor Author

genaris commented Jul 4, 2022

Do you think there's a lot of benefit in doing:

new ConnectionInvitationMessage({
  appendedAttachments: [attachment]
})

over

const invitation = new ConnectionInvitationMessage({
  appendedAttachments: []
})
invitation.appendedAttachments.push(attachment)

Or is there something else this will unlock?

You're right, not so much added value 😄. But in case attachment is undefined, invitation.appendedAttachments will result an empty array instead of undefined, and if I'm not wrong it will be encoded when transforming the invitation to JSON, isn't it?

But besides that, it's true that we can handle in OutOfBandModule like it's currently being done with request messages (i.e. not adding any new field to invitation constructor options, and calling invitation.addAppendedAttachment once the object is constructed). However, we use these attachments for invitations quite a lot and believe that it's a good approach to add some arbitrary information without leaving the standards (as seen with the controversial imageUrl 😛), so making it explicit in constructor options could be convenient.

@TimoGlastra
Copy link
Contributor

But besides that, it's true that we can handle in OutOfBandModule like it's currently being done with request messages (i.e. not adding any new field to invitation constructor options, and calling invitation.addAppendedAttachment once the object is constructed). However, we use these attachments for invitations quite a lot and believe that it's a good approach to add some arbitrary information without leaving the standards (as seen with the controversial imageUrl 😛), so making it explicit in constructor options could be convenient.

Yeah no problem in adding it, just curious :)

@TimoGlastra TimoGlastra merged commit 4800700 into openwallet-foundation:main Jul 4, 2022
@genaris genaris deleted the feat/invitation-attachments branch August 24, 2022 17:41
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.

3 participants