didx.aries-cloudapi-dotnet-aspcore 1.2.2

dotnet add package didx.aries-cloudapi-dotnet-aspcore --version 1.2.2
NuGet\Install-Package didx.aries-cloudapi-dotnet-aspcore -Version 1.2.2
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.2.2" />
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.2.2
#r "nuget: didx.aries-cloudapi-dotnet-aspcore, 1.2.2"
#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.2.2

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

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 TenantAdmin or GovernanceAdmin roles (see clients below).

"AriesCloudAPI": {
    "BaseUri": "http://localhost:8000",
    "GroupId": "your assigned aries cloud group id",
    "GovernanceAdmin": {
      "ClientId": "{OAuthClientId}",
      "ClientSecret": "{OAuthClientSecret}"
    },
    "TenantAdmin": {
      "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.

  • TenantAdmin and/or GovernanceAdmin - the OAuth settings for the TenantAdmin 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.

  • EnableTenantTokenCaching indicates whether tenant tokens should be cached. When set to true, tokens obtained for tenants will be stored in cache and automatically rotated based on the specified rotation interval. This option helps in managing the lifecycle of tenant tokens efficiently, reducing the need for frequent token requests.

  • TenantTokenCacheRotationIntervalDays Defines the interval, in days, after which tenant tokens should be rotated (i.e., refreshed). This setting is applicable only if tenant token caching is enabled. It specifies how often the tokens are renewed in the cache, ensuring that tokens remain valid and secure.

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.

  • CreateTenantAdminClient()

    Creates a client under the context of the 'tenant-admin' role as defined in Aries Cloud API. See ITenantAdminClient.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.

  • CreateTenantAdminWebSocketClient(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.

  • CreateTenantAdminSSEClientSingleEvent(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.

  • CreateTenantAdminSSEClientStream(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());
        }
    }

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.2.2 1,169 3/24/2024
1.2.1 77 3/24/2024
1.2.0 87 3/24/2024
1.1.9 267 3/19/2024
1.1.8 265 3/12/2024
1.1.7 755 2/12/2024
1.1.6 90 2/8/2024
1.1.5 122 2/8/2024
1.1.4 84 2/8/2024
1.1.3 161 2/7/2024
1.1.2 1,141 11/13/2023
1.1.1 127 11/13/2023
1.1.0 288 11/7/2023
1.0.9 188 11/2/2023
1.0.8 170 10/16/2023
1.0.7 132 10/16/2023
1.0.6 130 10/11/2023
1.0.5 116 10/11/2023
1.0.4 355 9/28/2023
1.0.3 104 9/21/2023
1.0.2 92 9/21/2023
1.0.1 204 9/20/2023
1.0.0 101 9/20/2023

Aries Cloud API Intial Release