Stechsoft.KeyVault.SecretsRetrieval
2.0.0
See the version list below for details.
dotnet add package Stechsoft.KeyVault.SecretsRetrieval --version 2.0.0
NuGet\Install-Package Stechsoft.KeyVault.SecretsRetrieval -Version 2.0.0
<PackageReference Include="Stechsoft.KeyVault.SecretsRetrieval" Version="2.0.0" />
<PackageVersion Include="Stechsoft.KeyVault.SecretsRetrieval" Version="2.0.0" />
<PackageReference Include="Stechsoft.KeyVault.SecretsRetrieval" />
paket add Stechsoft.KeyVault.SecretsRetrieval --version 2.0.0
#r "nuget: Stechsoft.KeyVault.SecretsRetrieval, 2.0.0"
#addin nuget:?package=Stechsoft.KeyVault.SecretsRetrieval&version=2.0.0
#tool nuget:?package=Stechsoft.KeyVault.SecretsRetrieval&version=2.0.0
Secrets Retrieval NuGet Package
Overview
This NuGet package provides secure secret retrieval functionalities from a Key Vault using authentication mechanisms. It ensures that applications can securely fetch secrets using a registered SecretKey
and AppId
.
Features
- Securely fetch secrets from a Key Vault.
- Authentication using
SecretKey
andAppId
. - Integration with Entity Framework Core for data retrieval.
- Exception handling and validation.
Installation
Install the package using NuGet Package Manager:
Install-Package Stechsoft.KeyVault.SecretsRetrieval
Configuration
Ensure that the necessary configurations are provided in your application settings.
Usage
Dependency Injection
Register the service in your application:
builder.Services.AddHttpClient<SecretManager>();
builder.Services.AddSingleton<SecretManager>(provider =>
{
var config = provider.GetRequiredService<IConfiguration>();
return new SecretManager(provider.GetRequiredService<HttpClient>(), config, "YourSecretKey", "YourAppId");
});
Fetching Secrets
To retrieve a secret, use the GetKeyVault
method:
public async Task<string> GetKey()
{
var secretService = serviceProvider.GetRequiredService<ISecretRetrievalService>();
string secret = await secretService.GetKeyVault("SecretName", "YourSecretKey", "YourAppId");
return secret;
}
Error Handling
Common errors include:
InvalidSecretKey
- Secret Key is incorrect or unauthorized.InvalidAppId
- Application ID is incorrect.InvalidSecretName
- The requested secret does not exist.InvalidData
- Data validation failed.
License
This package is licensed under the MIT License.
Support
For issues and contributions, please open a ticket in the repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.3)
- System.Net.Http (>= 4.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.