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

Add anoncreds issuance and presentation format #3331

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

Conversation

jamshale
Copy link
Contributor

@jamshale jamshale commented Nov 6, 2024

This adds issuance and presentation anoncreds formats which use the anoncreds registry.

Any anoncreds issuer must use this format as the anoncreds objects the format uses are saved in the wallet in the anoncreds way.

There is some backwards compatibility for a holder which isn't anoncreds capable. It will fall back to the indy handlers. Any holder that needs to use anoncreds objects which are not indy will need to use the askar-anoncreds profile. Any holder that uses the anoncreds format will need to be updated to a version of acapy which includes this PR.

There is a lot of duplication because I copied the Indy objects and added them to the anoncreds module and removed any indy references. I think this is better than trying to rename them and share them amongst indy and anoncreds modules. The indy module should be able to be pulled out as a plugin once depreciated.

The object examples have anoncreds examples now. They have there own validation, but it's not actually validating anoncreds objects. I'm not sure if there is validation patterns we can use for anoncreds schemas, cred defs and revocation objects or not.

There is a scenario test for anoncreds issuer doing issuance and presentation with a anoncreds and a non-anoncreds holder.

These will need to get interop OWL-ATH tests.

@jamshale jamshale changed the title Feat/3316 Add anoncreds issuance and presentation format Nov 6, 2024
@jamshale jamshale marked this pull request as ready for review November 6, 2024 20:57
@swcurran swcurran requested review from a team November 12, 2024 14:30
dbluhm
dbluhm previously approved these changes Nov 12, 2024
Copy link
Contributor

@dbluhm dbluhm left a comment

Choose a reason for hiding this comment

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

LGTM. The duplication is indeed a bit of a bummer but I agree that it's probably better than trying to get everything to line up cleanly and makes popping the indy implementation out of ACA-Py into a plugin in the future easier.

@dbluhm
Copy link
Contributor

dbluhm commented Nov 12, 2024

I approved but we have test failures that should be resolved before merging.

@jamshale
Copy link
Contributor Author

Added support for the demo but still need to fix the integration tests. Not sure why the scenario test is failing with github actions and the BDD tests need to be updated.

The OATH tests should be updated with an askar-anoncreds wallet. These should be testable against a credo holder, and should work with a credo issuer and acapy holder as well if the objects are consistent with the indy format.

@jamshale
Copy link
Contributor Author

jamshale commented Nov 18, 2024

I removed the BDD tests for issuance and presentation after the anoncreds upgrade because the anoncreds check uses the agent context object which hasn't been updated. I'm going to try and figure out how to do that and add them back.

The classes I moved and renamed from the indy module to the anoncreds module aren't unit tested. I don't think this is much of an issue because they are pretty much the same as the ones in the indy module that are unit tested. I might try and copy some tests as well as they would be good to have if they indy module gets pulled out. Don't think this should be required to get this merged though.

@jamshale jamshale requested a review from ianco November 18, 2024 19:33
@jamshale jamshale linked an issue Nov 18, 2024 that may be closed by this pull request
Copy link

sonarcloud bot commented Nov 18, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
9.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@jamshale jamshale requested a review from dbluhm November 19, 2024 16:14
@ianco
Copy link
Contributor

ianco commented Nov 19, 2024

Question regarding interoperability - should an agent using an "askar" wallet be able to send/receive a presentation request/presentation from a holder that has received an anoncreds credential? (And the other way - an "askar-anoncreds" agent asking an agent with an "askar" wallet for a proof?)

Also what should happen if an "askar-anoncreds" agent issues to an "askar" holder and the other way around?

@jamshale
Copy link
Contributor Author

jamshale commented Nov 19, 2024

Question regarding interoperability - should an agent using an "askar" wallet be able to send/receive a presentation request/presentation from a holder that has received an anoncreds credential? (And the other way - an "askar-anoncreds" agent asking an agent with an "askar" wallet for a proof?)

Also what should happen if an "askar-anoncreds" agent issues to an "askar" holder and the other way around?

Issuer (askar) --> Holder (askar-anoncreds): This issuer won't be able to issue or request a presentation using the anoncreds format because of the wrong wallet type (schema and cred def tables are different). However, the agent can use the indy format still and the credential will work. I think this is still tested but I should make sure.

Issuer (askar-anoncreds) --> Holder (askar): This works and is tested. The holder falls back to the indy handler in specific areas where it needs to, for both issuance and presentation flows.

Both issuer and holder need to be on the lastest version (have this code) for the anoncreds format to work regardless of wallet type.

@jamshale
Copy link
Contributor Author

@ianco

I just looked at Issuer (askar) --> Holder (askar-anoncreds) and it looks like there's a problem here with issuance. There was a test but it was only running on release. I'll try and fix this scenario.

@ianco
Copy link
Contributor

ianco commented Nov 19, 2024

FYI @jamshale the "1a" was added to the demo to support this kind of interoperability testing. (Available to an askar-anoncreds issuer only - this toggles between Anoncreds/Indy credentials and presentation requests. So as Faber I can issue an Anoncreds credential, select "1a" to switch to Indy, then issue an Indy presentation request. And vice versa.)

I did a quick test and when I sent the Indy presentation request I got an error: Problem report message: This issuer is anoncreds capable. Please use the anonreds format..

We should probably setup a table with the various options to define what is supported or not (and also we need to confirm that other Aries wallets support the same scenarios.)

  • issuer wallet type
  • holder wallet type
  • credential type (Indy or Anoncreds)
  • verifier wallet type
  • presentation type (Indy or Anoncreds)

Maybe this is already defined somewhere? @swcurran ?

Also I recall that we also assume that all Indy credentials are updated to Anoncreds format when the wallet is upgraded? (At least I think the Javascript framework does this, I don't recall if we implemented this for Aca-Py or not.)

PS Regarding the 1a description above, I also recall adding this to a couple of integration tests ...

@jamshale
Copy link
Contributor Author

jamshale commented Nov 19, 2024

That error was expected. I don't think it's possible for an askar-anoncreds agent to use the indy format handler after it's been upgraded to anoncreds. Before the indy format was just re-routing it to the anoncreds handler. I thought forcing the anoncreds issuer to use the explicit format would be better than keeping the indy format switching over to the anoncreds handler.

The original plan was to completely remove the indy format according to the comments. I wanted to keep both for backwards compatibility. But having both and trying to force indy format to re-route to anoncreds handler caused problems.

Also, I don't believe the credentials need to be changed for an anoncreds upgrade. I'll take a closer look at the wallets, but I'm pretty sure they are consistent.

@jamshale
Copy link
Contributor Author

I'll create a table with the compatibility matrix after I fix this issue of issuer (askar) --> holder (askar-anoncreds)

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.

Implement/Fix anoncreds issuance and presentation formats
3 participants