didx.aries-cloudapi-dotnet-aspcore 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package didx.aries-cloudapi-dotnet-aspcore --version 1.0.1                
NuGet\Install-Package didx.aries-cloudapi-dotnet-aspcore -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="didx.aries-cloudapi-dotnet-aspcore" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add didx.aries-cloudapi-dotnet-aspcore --version 1.0.1                
#r "nuget: didx.aries-cloudapi-dotnet-aspcore, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install didx.aries-cloudapi-dotnet-aspcore as a Cake Addin
#addin nuget:?package=didx.aries-cloudapi-dotnet-aspcore&version=1.0.1

// Install didx.aries-cloudapi-dotnet-aspcore as a Cake Tool
#tool nuget:?package=didx.aries-cloudapi-dotnet-aspcore&version=1.0.1                

didx-aries-cloudapi-dotnet

This repository contains the core functionality needed to implement Self-Sovereign Identity (SSI) flows in .NET applications using the DIDx Aries Cloud API.

SSI Flows

See the DIDx Aries Cloud API Documentation for more information on the SSI flows.

The following SSI flows are supported by the .NET SDK:

Connection Invitations (CI)

alt text

Out-of-band (OOB)

alt text

Install

Package source

nuget.org (https://api.nuget.org/v3/index.json)

Install package

Install-Package didx.aries-cloudapi-dotnet-aspcore

Configuration

Add the following configuration to your appsettings.json

This is the minimal configuration for a localhost installation:

{
  ...
  "AriesCloudAPI": {
    "BaseUri": "http://localhost:8000",
    "GroupId": "your assigned aries cloud group id",
  }
}

For production/remote installations, the OAuth settings are required for either the Customer or GovernanceAdmin roles (see clients below).

"AriesCloudAPI": {
    "BaseUri": "http://localhost:8000",
    "GroupId": "your assigned aries cloud group id",
    "GovernanceAdmin": {
      "ClientId": "{OAuthClientId}",
      "ClientSecret": "{OAuthClientSecret}"
    },
    "Customer": {
      "ClientId": "{OAuthClientId}",
      "ClientSecret": "{OAuthClientSecret}"
    }
  }

Here are the available options:

  • BaseUri is the url of the Aries Cloud API. This can be localhost or a remote installation. Required.

  • GroupId is your assigned groupId in Aries Cloud API and is used for multi-tenancy segregation. This would be supplied to you for remote installations. Required.

  • Customer and/or GovernanceAdmin - the OAuth settings for the Customer and/or GovernanceAdmin roles as defined in Aries Cloud API. Optional for localhost. Required for production/remote urls.

  • {OAuthClientId} & {OAuthClientSecret} are the OAuth configuration. This would be supplied to you for remote installation.

  • ProtocolVersion the hand-shake protocol to use i.e. v1 or v2. Default is v1.

  • SSETimeoutInSeconds SSE connection timeout in seconds. Default is 120.

  • DebugOutput is a boolean value that determines whether the SDK will output debug information to the console. This is useful for debugging purposes. Optional. Not recommended for production environments.

Startup

Add the following to your application startup (Startup.cs):


        public void ConfigureServices(IServiceCollection services)
        {
            ...

            services.AddAriesCloudAPI();
        }


        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            ...

            app.ApplicationServices.UseAriesCloudAPI();
        }

Usage

To use the Aries Cloud API, a client-proxy must first be created via the ClientFactory class.

This is supplied by the Dependency Injection in .NET and provides the following methods to create clients for the respective contexts:

  • CreatePublicClient()

    Creates a client for anonymous or public access to the Trust Registry. See IPublicClient.cs for available operations.

  • CreateGovernanceClient()

    Creates a client under the context of the 'governance' role as defined in Aries Cloud API. See IGovernanceClient.cs for available operations.

  • CreateCustomerClient()

    Creates a client under the context of the 'tenant-admin' role as defined in Aries Cloud API. See ICustomerClient.cs for available operations.

  • CreateTenantClient(string tenantId)

    Creates a client under the context of the 'tenant' role as defined in Aries Cloud API. An access-token will automatically be obtained for the specified tenantId. See ITenantClient.cs for available operations.

  • CreateTenantClientWithAccessToken(string access_token)

    Creates a client under the context of the 'tenant' role as defined in Aries Cloud API. The specified access-token will be used to authenticate the client. See ITenantClient.cs for available operations.

  • CreateCustomerWebSocketClient(Topic[] topics, string? tenantId, CancellationToken cancellationToken)

    Creates an open websocket client under the context of the 'tenant-admin' role as defined in Aries Cloud API. It automatically issues the subscribe request and returns a connected client ready for use. See ClientWebSocket for more info.

  • CreateCustomerSSEClientSingleEvent(string tenantId, Topic topic, string desiredState, string? fieldName = null, string? fieldValue = null)

    Returns an open Stream to receive Server-Side Events (SSE). The stream will close after the first event is received.

  • CreateCustomerSSEClientStream(string tenantId, Topic? topic = null, string? fieldName = null, string? fieldValue = null)

    Returns an open Stream to receive Server-Side Events (SSE). The stream will remain open for the duration of the connection.

Example:


    public class ValuesController : ControllerBase
    {
        private ClientFactory _clientFactory;

        public ValuesController(ClientFactory clientFactory)
        {
            _clientFactory = clientFactory;
        }

        [HttpGet]
        public async Task<IEnumerable<string>> GetAsync()
        {
            // create client
            var client = _clientFactory.CreateGovernanceClient();

            // example usage
            var credentials = await client.GetCredentialsAsync();

            return credentials?.Select(x => x.ToString());
        }
    }

Blazor Sample

The Blazor Sample project is an example implementation of the above SSI flows.

It supports OAuth PKCE Authorization Code Flow (with Cookies) and was created from the following template: https://github.com/damienbod/Blazor.BFF.OpenIDConnect.Template

High-level architecture

alt text

Storage

To implement an end-to-end example, the client application needs to persist some state. For example, a Connection Invitation which needs to "delivered" to the recipient. For the purposes of this sample, SQLLite is used as a database provider. The following state is stored for caching & delivery purposes:

  • Tenant info & access tokens
  • Invitations
  • Webhook events
  • Governance Schemas

Webhook Events

There are two options available to receive the webhook events i.e. Websockets & Server-Side Events (SSE). This can be configured in the Blazor Sample App Settings.

For example:

"BlazorSample": {
  "WebhookEventStreamType": "SSE" // or "WebSockets"
},

Server-Side Events (SSE) is recommended for production systems.

SignalR

SignalR is used to delivery webhook events to the client in real-time. These SignalR connections are cached in-memory and is not persisted in the database. This is not recommended for production systems.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 107 11/12/2024
1.2.9 74 11/11/2024
1.2.8 572 9/5/2024
1.2.7 240 8/27/2024
1.2.6 187 8/22/2024
1.2.5 581 7/17/2024
1.2.4 469 6/25/2024
1.2.3 104 6/25/2024
1.2.2 2,017 3/24/2024
1.2.1 102 3/24/2024
1.2.0 112 3/24/2024
1.1.9 293 3/19/2024
1.1.8 308 3/12/2024
1.1.7 868 2/12/2024
1.1.6 119 2/8/2024
1.1.5 145 2/8/2024
1.1.4 106 2/8/2024
1.1.3 187 2/7/2024
1.1.2 1,167 11/13/2023
1.1.1 156 11/13/2023
1.1.0 318 11/7/2023
1.0.9 217 11/2/2023
1.0.8 201 10/16/2023
1.0.7 160 10/16/2023
1.0.6 160 10/11/2023
1.0.5 143 10/11/2023
1.0.4 380 9/28/2023
1.0.3 127 9/21/2023
1.0.2 117 9/21/2023
1.0.1 235 9/20/2023
1.0.0 131 9/20/2023

Aries Cloud API Intial Release