-
Notifications
You must be signed in to change notification settings - Fork 64
Adds .NET Wrapper #363
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
base: main
Are you sure you want to change the base?
Adds .NET Wrapper #363
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements a comprehensive C# wrapper for the AnonCreds library, mirroring the functionality provided by the Python wrapper. The implementation includes a complete .NET binding with FFI interop, model classes, and extensive test coverage for AnonCreds credential issuance, presentation, and verification workflows.
- Implements C# FFI bindings with native library interop for all AnonCreds operations
- Provides model-centric API design with classes for credentials, schemas, presentations, and revocation
- Includes comprehensive test suite covering W3C credentials, revocation scenarios, and presentation verification
Reviewed Changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| wrappers/dotnet/lib/ | Core library implementation with models, interop, and exception handling |
| wrappers/dotnet/tests/ | Comprehensive test suite covering all AnonCreds workflows and edge cases |
| src/services/verifier.rs | Debug logging additions for presentation verification troubleshooting |
| src/ffi/presentation.rs | Debug logging additions for FFI presentation operations |
| README.md | Documentation update acknowledging .NET wrapper availability |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| namespace AnonCredsNet.Models; | ||
|
|
||
| public class RevocationState : AnonCredsObject |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename contains a spelling error: 'RevokationState.cs' should be 'RevocationState.cs' to match the class name and maintain consistency with the rest of the codebase.
src/services/verifier.rs
Outdated
| eprintln!("=== VERIFY_PRESENTATION FUNCTION START ==="); | ||
| eprintln!("Schemas received ({} total):", schemas.len()); | ||
| for (id, schema) in schemas { | ||
| eprintln!(" Schema ID: '{}', Name: '{}'", id, schema.name); | ||
| } |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements (eprintln!) should be removed from production code or replaced with proper logging using the trace! macro that's already available in this module.
src/ffi/presentation.rs
Outdated
| presentation_p: *mut ObjectHandle, | ||
| ) -> ErrorCode { | ||
| catch_error(|| { | ||
| eprintln!("=== CREATE_PRESENTATION FFI START ==="); |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements (eprintln!) should be removed from production code or replaced with proper logging using trace! or debug! macros for consistency with the existing codebase.
src/ffi/presentation.rs
Outdated
|
|
||
| eprintln!("Loading link_secret..."); | ||
| let link_secret = _link_secret(link_secret)?; | ||
| eprintln!("Link secret loaded successfully"); |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug print statements (eprintln!) should be removed from production code or replaced with proper logging using trace! or debug! macros for consistency with the existing codebase.
| try | ||
| { | ||
| var count = (int)credentialsList.Count.ToUInt32(); | ||
| Console.WriteLine($"[DEBUG] CredentialsList count: {count}"); |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.WriteLine debug statements should be removed from production code or replaced with proper logging framework usage for better control over log levels and output destinations.
| try | ||
| { | ||
| var count = (int)credentialsList.Count.ToUInt32(); | ||
| Console.WriteLine($"[DEBUG] (W3C) CredentialsList count: {count}"); |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.WriteLine debug statements should be removed from production code or replaced with proper logging framework usage for better control over log levels and output destinations.
|
@JohnGalt1717 -- please correct the DCO (DCO - Developer Certificate of Origin - https://github.com/apps/dco. To fix, see: https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md) on the PR -- that is a requirement for merging. That said, the typical model we've taken for wrappers is to have them in separate repos such as this JaveScript one -- https://github.com/hyperledger/anoncreds-wrapper-javascript. The Python one stays here because we need it for testing. So a better approach to this would be to create a new repo (anoncreds-wrapper-dotnet), make sure all commits have DCO signoff, and then we can look at moving the repo into this GitHub organization. Reasonable? I'd also be interested in your use case and deployment. What are you working on (if you can share)? |
|
Sorry for the delay. I'm happy to move it to a new wrapper if someone can create the repository under here? Also any tips on automating getting the rust artifacts for all platforms for this would be helpful. We're doing Claims verification without disclosure. Think standard JWT OpenIdConnect style claims. |
This pull request implements a C# wrapper against the library similar to how the Python wrapper works and implements the same tests as the Python wrapper.
Once the suitable libraries for the various platforms are built, this should be able to be built using Github Actions or similar and pull in the Windows, Linux and MacOS dependencies for build, packaging and deploy to Nuget.