.NET Dependency injection
VerifiablServiceCollectionExtensions
Section titled “VerifiablServiceCollectionExtensions”Class in Verifiabl.Extensions.DependencyInjection
Registers the Verifiabl issuer client with
Microsoft.Extensions.DependencyInjection.IServiceCollection.
public static class VerifiablServiceCollectionExtensionsInheritance: System.Object
HttpClientName
Section titled “HttpClientName”Field
Name of the System.Net.Http.IHttpClientFactory client the SDK sends on.
Use it to attach your own handlers or policies.
public const string HttpClientName = "Verifiabl"Returns: System.String
AddVerifiablClient(IServiceCollection, Action<VerifiablClientOptions>)
Section titled “AddVerifiablClient(IServiceCollection, Action<VerifiablClientOptions>)”Method
Register Verifiabl.Client.IVerifiablClient as a singleton.
public static IServiceCollection AddVerifiablClient(this IServiceCollection services, Action<VerifiablClientOptions> configureOptions)| Parameter | Type | Description |
|---|---|---|
services |
Microsoft.Extensions.DependencyInjection.IServiceCollection |
The service collection. |
configureOptions |
System.Action{Verifiabl.Client.VerifiablClientOptions} |
Configures the client options. |
Returns: Microsoft.Extensions.DependencyInjection.IServiceCollection
Exceptions
| Type | Condition |
|---|---|
System.ArgumentNullException |
An argument is null. |
AddVerifiablClient(IServiceCollection, Action<IServiceProvider, VerifiablClientOptions>)
Section titled “AddVerifiablClient(IServiceCollection, Action<IServiceProvider, VerifiablClientOptions>)”Method
Register Verifiabl.Client.IVerifiablClient as a singleton, configuring it from
other registered services (for credentials pulled from your own
configuration or secrets abstraction).
The registration is a singleton because the client caches OAuth access
tokens; a scoped or transient lifetime would fetch a token per resolve.
Options are registered with the Microsoft.Extensions.Options pattern and
ValidateOnStart, so hosts that run startup validation fail before serving
traffic when the configured client options are invalid.
Registration uses TryAdd semantics: once Verifiabl.Client.IVerifiablClient
is registered, later AddVerifiablClient calls are no-ops.
public static IServiceCollection AddVerifiablClient(this IServiceCollection services, Action<IServiceProvider, VerifiablClientOptions> configureOptions)| Parameter | Type | Description |
|---|---|---|
services |
Microsoft.Extensions.DependencyInjection.IServiceCollection |
The service collection. |
configureOptions |
System.Action{System.IServiceProvider,Verifiabl.Client.VerifiablClientOptions} |
Configures the client options. |
Returns: Microsoft.Extensions.DependencyInjection.IServiceCollection
Exceptions
| Type | Condition |
|---|---|
System.ArgumentNullException |
An argument is null. |