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(core): add support for multi use invitations #460

Merged

Conversation

TimoGlastra
Copy link
Contributor

Signed-off-by: Timo Glastra [email protected]

@TimoGlastra TimoGlastra requested a review from a team as a code owner September 19, 2021 18:00
@TimoGlastra TimoGlastra force-pushed the feat/multi-use-invitations branch from 592d94e to 956af3e Compare September 19, 2021 18:03
@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2021

Codecov Report

Merging #460 (956af3e) into main (52c7897) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
+ Coverage   85.65%   85.76%   +0.10%     
==========================================
  Files         253      253              
  Lines        5467     5480      +13     
  Branches      878      884       +6     
==========================================
+ Hits         4683     4700      +17     
+ Misses        783      779       -4     
  Partials        1        1              
Impacted Files Coverage Δ
.../core/src/modules/connections/ConnectionsModule.ts 73.17% <100.00%> (+2.80%) ⬆️
...s/connections/handlers/ConnectionRequestHandler.ts 94.73% <100.00%> (+1.40%) ⬆️
...modules/connections/repository/ConnectionRecord.ts 98.38% <100.00%> (+0.02%) ⬆️
.../modules/connections/services/ConnectionService.ts 97.28% <100.00%> (+0.10%) ⬆️
packages/core/src/storage/BaseRecord.ts 75.00% <0.00%> (+10.00%) ⬆️

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 52c7897...956af3e. Read the comment docs.

@TimoGlastra
Copy link
Contributor Author

Could someone review please?

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.

Not too knowledgeale with the multi use specifications, but code-wise it looks good!

@@ -194,6 +199,25 @@ export class ConnectionService {
throw new AriesFrameworkError('Invalid message')
}

// Create new connection if using a multi use invitation
if (connectionRecord.multiUseInvitation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be combined with the if statement below.

@genaris
Copy link
Contributor

genaris commented Sep 30, 2021

Nice and long-awaited feature!

Copy link
Contributor

@jakubkoci jakubkoci left a comment

Choose a reason for hiding this comment

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

Nice improvement. Good job, Timo 👍 I lack domain knowledge here, so I added a few notes more from a curiosity perspective :)

const faberConnection = await faberAgent.connections.getById(faberConnectionId)
// Expect initial connection to still be in state invited
return expect(faberConnection.state).toBe(ConnectionState.Invited)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Do I understand correctly that faberAgent will have 3 connection records at the end of the process?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! The first record will always stay in state Invited and we create new records when people send requests for the invitation. This is how both ACA-Py and .NET have also implemented it

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting 🤔

if (messageContext.connection.multiUseInvitation) {
const mediationRecord = await this.mediationRecipientService.discoverMediation()
routing = await this.mediationRecipientService.getRouting(mediationRecord)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is routing really necessary for multi-use invitations in general? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe not. But I would rather take all edge cases into account for these things. Otherwise we need good documentation on what features do and don't work together :)

@TimoGlastra TimoGlastra merged commit 540ad7b into openwallet-foundation:main Sep 30, 2021
@TimoGlastra TimoGlastra deleted the feat/multi-use-invitations branch October 28, 2021 10:11
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.

5 participants