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) Implement AnoncredsLedgerRead for cheqd #1306 #1308

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

Conversation

gmulhearn
Copy link
Contributor

@gmulhearn gmulhearn commented Dec 4, 2024

Closes #1306

Additions

  • Adds a Cheqd implementation of the AnoncredsLedgerRead trait to the aries_vcx_ledger crate (hidden behind a feature flag) CheqdAnoncredsLedgerRead. This implementation uses cheqd resource resolution, and is largely inspired by credo-ts https://github.com/openwallet-foundation/credo-ts/blob/main/packages/cheqd/src/anoncreds/services/CheqdAnonCredsRegistry.ts
  • Adds a resolve_resource method to the cheqd DID resolver, allowing DLRs to be resolved directly or via a name+type+time? DLR query. The implementation is largely inspired by credo-ts https://github.com/openwallet-foundation/credo-ts/blob/main/packages/cheqd/src/dids/CheqdDidResolver.ts#L69 . Note that the implementation for resolving DLR by name+type+time? query is not very efficient - it involves resolves the full set of DLR metadatas for a DID (collection) and then filtering in memory. This is a current limitation of the cheqd gRPC as pagination is not functioning as expected - this will need to be fixed once the gRPC is updated, however for now we ignore pagination (like credo)
  • Adds a MultiLedgerAnoncredsRead implementation of the AnoncredsLedgerRead trait. This is similar to the DID resolver registry, it allows you to add multiple AnoncredsLedgerRead implementations and automatically switch between them depending on the requested schema/cred-def/rev-reg ID.
  • add new attachment types for anoncreds attachments in issue-cred-v2 & present-proof-v2

Refactors

Testing

Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
…er than generate at build time)

Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
@gmulhearn gmulhearn changed the title [feat] Implement AnoncredsLedgerRead for cheqd #1306 (feat) Implement AnoncredsLedgerRead for cheqd #1306 Dec 10, 2024
@gmulhearn gmulhearn marked this pull request as ready for review December 10, 2024 00:34
impl AnoncredsLedgerRead for Reader {
type RevocationRegistryDefinitionAdditionalMetadata = Value;

fn get_schema<'life0,'life1,'life2,'async_trait>(&'life0 self,schema_id: &'life1 SchemaId,submitter_did:Option< &'life2 Did> ,) -> ::core::pin::Pin<Box<dyn ::core::future::Future<Output = VcxLedgerResult<Schema> > + ::core::marker::Send+'async_trait> >where 'life0:'async_trait,'life1:'async_trait,'life2:'async_trait,Self:'async_trait;
Copy link
Contributor Author

@gmulhearn gmulhearn Dec 10, 2024

Choose a reason for hiding this comment

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

sorry for ugliness in this test code! - sometimes mock! macro has trouble when combined with the async_trait macro, so the easiest fix is to insert the expanded async_trait contents for the methods it struggles with (async fn get_schema, async fn get_cred_def & async fn get_rev_status_list in this case).

@gmulhearn gmulhearn added skip-ci and removed skip-ci labels Dec 10, 2024
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

consumers could write this wrapper themselves (i was about to do it as a consumer @anonyome ), but figured it could go here too. If you think it's overkill for the vcx repo i'm happy to remove.

Signed-off-by: George Mulhearn <[email protected]>
Signed-off-by: George Mulhearn <[email protected]>
@gmulhearn
Copy link
Contributor Author

@JamesKEbert pls forgive me for some rust sins i committed in latest commit: 06f9afd

particularly in aries/aries_vcx/src/protocols/issuance/holder/state_machine.rs, there is a several lack of typing, so everything is JSON strings and passed around in tuples. This needs a good re-evaluation, as it's way behind the rest of the VCX codebase in terms of type safety

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.

[feat] Implement AnoncredsLedgerRead for cheqd
2 participants