didx.aries-cloudapi-dotnet-aspcore
1.3.0
dotnet add package didx.aries-cloudapi-dotnet-aspcore --version 1.3.0
NuGet\Install-Package didx.aries-cloudapi-dotnet-aspcore -Version 1.3.0
<PackageReference Include="didx.aries-cloudapi-dotnet-aspcore" Version="1.3.0" />
paket add didx.aries-cloudapi-dotnet-aspcore --version 1.3.0
#r "nuget: didx.aries-cloudapi-dotnet-aspcore, 1.3.0"
// Install didx.aries-cloudapi-dotnet-aspcore as a Cake Addin #addin nuget:?package=didx.aries-cloudapi-dotnet-aspcore&version=1.3.0 // Install didx.aries-cloudapi-dotnet-aspcore as a Cake Tool #tool nuget:?package=didx.aries-cloudapi-dotnet-aspcore&version=1.3.0
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)
Out-of-band (OOB)
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"
}
}
For production/remote installations, the OAuth settings are required for either the TenantAdmin
or GovernanceAdmin
roles (see clients below).
"AriesCloudAPI": {
"BaseUri": "http://localhost:8000",
"OrganizationId": "your assigned aries cloud organization 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.OrganizationId
is your assigned organizationId in Aries Cloud API and is used for multi-tenancy segregation. This would be supplied to you for remote installations. Optional for localhost.TenantAdmin
and/orGovernanceAdmin
- 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.SSETimeoutInSeconds
SSE connection timeout in seconds. Default is 120.SSELookbackInSeconds
SSE connection lookback 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.TenantTokenCacheType
specifies the type of caching mechanism for tenant tokens. When set to a non-null value, tenant tokens will be cached using the specified caching strategy (MemoryCache
orRedis
). Tokens stored in the cache will be 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. If set tonull
, tenant token caching and rotation are disabled.Important: If you select
MemoryCache
orRedis
as the caching mechanism, you must add and configure the corresponding service in your application during startup:- For
MemoryCache
, ensure thatIMemoryCache
is registered in your service collection. - For
Redis
, ensure thatIConnectionMultiplexer
is configured and registered in your service collection.
The SDK will automatically check for the presence of either
IMemoryCache
or a configuredIConnectionMultiplexer
to manage tenant token caching appropriately.- For
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.TenantTokenCacheEncryptionType
specifies the type of encryption used for tenant tokens stored in theRedis
cache. This setting ensures that sensitive data remains secure while being cached.Options:
- DataProtection: Requires
IDataProtectionProvider
in the service collection. - Custom: Requires
TenantTokenCacheEncryptionKey
to be specified. - Null: No encryption is applied.
Important: This setting applies only to
Redis
. The SDK will gracefully handle encryption configuration changes by discarding any failed decryption tokens, fetching new ones, encrypting them (if enabled), and caching them.- DataProtection: Requires
TenantTokenCacheEncryptionKey
specifies the encryption key used whenTenantTokenCacheEncryptionType
is set toCustom
. This key must be a 32-byte key, Base64 encoded, to ensure secure encryption of tenant tokens.Example: To generate a 32-byte encryption key, you can use the following command:
openssl rand -base64 32
Startup
Add the following to your application startup (Startup.cs):
public IConfiguration Configuration { get; }
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public void ConfigureServices(IServiceCollection services)
{
...
services.AddAriesCloudAPI(Configuration);
}
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.
CreateTenantAdminSSEClientSingleEvent(string tenantId, Topic topic, string fieldName, string fieldValue, string desiredState)
Returns an open Stream to receive Server-Side Events (SSE). The stream will close after the first event is received.
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.GetIndyCredentialsAsync();
return credentials?.Select(x => x.ToString());
}
}
Product | Versions 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. |
-
.NETStandard 2.1
- Flurl.Http (>= 4.0.2)
- Flurl.Http.Newtonsoft (>= 0.9.1)
- Microsoft.AspNetCore.DataProtection.Abstractions (>= 8.0.10)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- StackExchange.Redis (>= 2.8.16)
- System.ComponentModel.Annotations (>= 5.0.0)
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 | 126 | 11/12/2024 |
1.2.9 | 83 | 11/11/2024 |
1.2.8 | 574 | 9/5/2024 |
1.2.7 | 242 | 8/27/2024 |
1.2.6 | 189 | 8/22/2024 |
1.2.5 | 592 | 7/17/2024 |
1.2.4 | 471 | 6/25/2024 |
1.2.3 | 106 | 6/25/2024 |
1.2.2 | 2,018 | 3/24/2024 |
1.2.1 | 103 | 3/24/2024 |
1.2.0 | 113 | 3/24/2024 |
1.1.9 | 294 | 3/19/2024 |
1.1.8 | 311 | 3/12/2024 |
1.1.7 | 871 | 2/12/2024 |
1.1.6 | 120 | 2/8/2024 |
1.1.5 | 146 | 2/8/2024 |
1.1.4 | 107 | 2/8/2024 |
1.1.3 | 188 | 2/7/2024 |
1.1.2 | 1,168 | 11/13/2023 |
1.1.1 | 157 | 11/13/2023 |
1.1.0 | 319 | 11/7/2023 |
1.0.9 | 218 | 11/2/2023 |
1.0.8 | 202 | 10/16/2023 |
1.0.7 | 161 | 10/16/2023 |
1.0.6 | 161 | 10/11/2023 |
1.0.5 | 144 | 10/11/2023 |
1.0.4 | 381 | 9/28/2023 |
1.0.3 | 128 | 9/21/2023 |
1.0.2 | 118 | 9/21/2023 |
1.0.1 | 236 | 9/20/2023 |
1.0.0 | 132 | 9/20/2023 |
Aries Cloud API Intial Release