Skip to content

fix: unqualified anoncreds revocation notification support #2240

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

genaris
Copy link
Contributor

@genaris genaris commented Mar 27, 2025

This is a fix focused mainly for 0.5.x deployments to address the issue #2206.

The proposed solution here is to search for W3C Credential Records matching the revocation notification only in case we don't find any matching Credential Exchange record. The opposite (search first for W3C Credential records) would work, but force us to get all Credential Exchange records and filter them (i.e. no optimized query using tags), since RevocationNotificationReceivedEvent requires to send the associated CredentialExchangeRecord.

I think for 0.6 we could aim to update this API to focus on W3CCredentialRecord directly, meaning that we will need to do some updates to the data model (e.g. W3CCredentialRecord will need to hold revocation info and connectionId).

@JoLuPuma @jamshale @barnabef @zoblazo I didn't test it deeply yet but, if you have the chance of patching your 0.5.13 with this and test it, please let me know to make sure this does the trick.

@genaris genaris requested a review from a team as a code owner March 27, 2025 20:18
Copy link

changeset-bot bot commented Mar 27, 2025

⚠️ No Changeset found

Latest commit: 6ea4eb4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

fix: data type

Signed-off-by: Ariel Gentile <[email protected]>
@genaris genaris force-pushed the fix/unqualified-anoncreds-revocation-notification branch from 39598b8 to c7bbdd4 Compare March 27, 2025 20:26
Signed-off-by: Ariel Gentile <[email protected]>
@genaris
Copy link
Contributor Author

genaris commented Mar 27, 2025

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

// Find credential exchange record associated with this credential
credentialExchangeRecord =
(await this.credentialRepository.getAll(agentContext)).find((record) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there no way to find the credential exchange record associated with a credential record?

This seems inefficient to run for every query ... :/

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, that's why I tried to avoid running it in cases not affected by this problem (e.g. using qualified identifiers).

Probably we have some other tricks to do, but I don't think in practice it will be so critical, since this code runs on holder side and I don't expect users to hold thousands of credentials using unqualified identifiers.

Something not done in this PR (at the moment) are changes on AnonCredsCredentialFormatService: we can also add the anonCredsUnqualified* tags to CredentialExchangeRecords. This would at least prevent this code from running in 0.5.14 agents.

@jamshale
Copy link
Contributor

@bryce-mcmath Were you able to test this? I was wondering if this could still get merged into the patch as it is the last thing allowing this scenario to work and do our migrations incrementally.

I don't have a good understanding of credo storage, but, I agree that the performance doesn't seem to be much of an issue if it only does this when unqualified id's are present and is only on the holder side.

@bryce-mcmath
Copy link
Contributor

@bryce-mcmath Were you able to test this? I was wondering if this could still get merged into the patch as it is the last thing allowing this scenario to work and do our migrations incrementally.

I don't have a good understanding of credo storage, but, I agree that the performance doesn't seem to be much of an issue if it only does this when unqualified id's are present and is only on the holder side.

It's already in our patches in the Testflight BC Wallet if you want to double check anything in particular. Seems to be working well so far

@jamshale
Copy link
Contributor

OK, great. Thank you.

@genaris
Copy link
Contributor Author

genaris commented May 9, 2025

@TimoGlastra since this fix can be useful for some users and appearently works well for their use case, do you think we can re-target this PR to 0.5.x branch so it can be included in the next patch release for them?

I can create a different one for main, refactoring the revocation notification support to use W3CCredentialRecord directly. Then we'll add a migration script to upgrade everything in 0.6.

Comment on lines +100 to +101
credentialExchangeRecord =
(await this.credentialRepository.getAll(agentContext)).find((record) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should limit the calling of this to:

  • filter by state (credential received and completed)
  • only if the incoming revocation id is unqualified

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.

4 participants