Skip to content

Conversation

@JohnGalt1717
Copy link

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.

Copilot AI review requested due to automatic review settings September 8, 2025 17:28
Copy link

Copilot AI left a 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.

Comment on lines 4 to 6
namespace AnonCredsNet.Models;

public class RevocationState : AnonCredsObject
Copy link

Copilot AI Sep 8, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 55 to 59
eprintln!("=== VERIFY_PRESENTATION FUNCTION START ===");
eprintln!("Schemas received ({} total):", schemas.len());
for (id, schema) in schemas {
eprintln!(" Schema ID: '{}', Name: '{}'", id, schema.name);
}
Copy link

Copilot AI Sep 8, 2025

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.

Copilot uses AI. Check for mistakes.
presentation_p: *mut ObjectHandle,
) -> ErrorCode {
catch_error(|| {
eprintln!("=== CREATE_PRESENTATION FFI START ===");
Copy link

Copilot AI Sep 8, 2025

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.

Copilot uses AI. Check for mistakes.

eprintln!("Loading link_secret...");
let link_secret = _link_secret(link_secret)?;
eprintln!("Link secret loaded successfully");
Copy link

Copilot AI Sep 8, 2025

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.

Copilot uses AI. Check for mistakes.
try
{
var count = (int)credentialsList.Count.ToUInt32();
Console.WriteLine($"[DEBUG] CredentialsList count: {count}");
Copy link

Copilot AI Sep 8, 2025

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.

Copilot uses AI. Check for mistakes.
try
{
var count = (int)credentialsList.Count.ToUInt32();
Console.WriteLine($"[DEBUG] (W3C) CredentialsList count: {count}");
Copy link

Copilot AI Sep 8, 2025

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.

Copilot uses AI. Check for mistakes.
@swcurran
Copy link
Member

swcurran commented Sep 8, 2025

@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)?

@JohnGalt1717
Copy link
Author

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.

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.

2 participants