/wallet-framework-dotnet

Primary LanguageC#Apache License 2.0Apache-2.0

Wallet Framework for .NET

Wallet Framework for .NET is an open framework for building digital identity wallets. The framework was initiated as Aries Framework .NET in the Hyperledger Foundation and was forked to express the goal to broaden the supported identity protocols, especially with regard to OID4VC and SD-JWT.

Table of Contents

Roadmap

  • OpenID4VC Support
  • SD-JWT VC Support
  • Replacing the indy-sdk

Protocols

OpenID for Verifiable Credentials (OID4VC)

Protocol Link State
OpenID for Verifiable Credential Issuance OID4VCI 🚧
- Pre-Authorized Code Flow Pre-Auth-Flow ✅
- Authorization Code Flow Auth-Flow 🚧
- Holder Binding / Key Binding KB-JWT ✅
- Wallet Attestation Wallet Attestation 🚧
- Issuer Authentication Issuer Authentication 🚧
- Demonstrating Proof of Possession DPoP 🚧
OpenID for Verifiable Presentations OID4VP 🚧
- Same-Device Flow Same-Device ✅
- Cross-Device Flow Cross-Device ✅
- Verifier Authentication Verifier Authentication 🚧
Self-Issued OpenID Provider v2 SIOPv2 🚧

Hyperledger Aries

AIP 1.0

Protocol State
0019-encryption-envelope ✅
0160-connection-protocol ✅
0036-issue-credential ✅
0037-present-proof ✅
0056-service-decorator ✅
0025-didcomm-transports Http supported
0015-acks Partially supported
0035-report-problem Partially supported

AIP 2.0

Protocol State
0023-did-exchange ✅
0048-trust-ping ✅
0095-basic-message ✅

Credential Formats

Credential Format Link State
AnonCreds 1.0 Anonymous Credential Protocol ✅
SD-JWT-based Verifiable Credentials SD-JWT VC 🚧

Quickstart Guide

The framework fully leverages the .NET Core hosting model with full integration of dependency injection, configuration and hosting services.

Prerequisites

Create new web application

Using your favorite editor, create new web project. You can also create a project from the console.

dotnet new web -o AriesAgent

To setup your agent use the Startup.cs file to configure the framework.

Add the framework dependencies

Use the IServiceCollection extensions to add the dependent services to your application in the ConfigureServices(IServiceCollection services) method. Upon startup, the framework will create and configure your agent.

services.AddAriesFramework(builder =>
{
    builder.RegisterAgent(options =>
    {
        options.EndpointUri = "http://localhost:5000/";
    });
});

Note: If you'd like your agent to be accessible publically, use Ngrok to setup a public host and use that as the EndpointUri. When changing the endpoints, make sure you clear any previous wallets with the old configuration. Wallet data files are located in ~/.indy_client/wallet

For a list of all configuration options, check the AgentOptions.cs file.

Register the agent middleware

When running web applications, register the agent middleware in the Configure(IApplicationBuilder app, IWebHostEnvironment env) method. This will setup a middleware in the AspNetCore pipeline that will respond to incoming agent messages.

app.UseAriesFramework();

That's it. Run your project.

Demo

With Docker installed, run

docker-compose up

This will create an agent network with a pool of 4 indy nodes and 2 agents able to communicate with each other in the network. Navigate to http://localhost:7000 and http://localhost:8000 to create and accept connection invitations between the different agents.

Testing

To run the unit tests, the following dependencies also must be installed:

  • Docker

Install libindy library

Follow the build instructions for your OS on the Hyperledger Indy SDK Readme.

For macOS, if you get a 'indy' DLL not found exception, move the built libindy.dylib file to the test/Hyperledger.Aries.Tests/bin/Debug/netcoreapp3.1/ directory to explicitly add it to the path.

Run an indy node pool on localhost

docker build --build-arg pool_ip=127.0.0.1 -f docker/indy-pool.dockerfile -t indy_pool docker/
docker run -itd -p 9701-9709:9701-9709 indy_pool

Run an indy node pool on server

# replace <ip_address> with server IP address
docker build --build-arg pool_ip=<ip_address> -f docker/indy-pool.dockerfile -t indy_pool docker/
docker run -itd -p <ip_address>:9701-9709:9701-9709 indy_pool

Run the tests

First, edit the keyword in the scripts/tester.sh file to select the tests you want to run. Then, run the script

scripts/tester.sh 

Releases / Versioning

This Repository includes a github actions pipeline which builds and releases 2 versions of the wallet framework whenever a Pull Request is submitted or a merge to the main branch happens. When the build and release process is triggered by a pull request the two build versions have a "pr" suffix. If it is triggered by a merge towards the main branch the two build versions have a "rc" suffix.

  1. Version one uses the Indy SDK (targets netstandard2.0) without xamarin dependencies. (e.g. 2.0.0-pr.x.x or 2.0.0-rc.x)
  2. Version two uses the Indy SDK with xamarin dependencies which is indicated by a "-xam" tag within its version (e.g. 2.0.0-xam-pr.x.x or 2.0.0-xam-rc.x)

Both builds are accessible through the Open Wallet Foundation nuget feed.

License

Apache License Version 2.0