Stechsoft.KeyVault.SecretsRetrieval 2.0.0

There is a newer version of this package available.
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
                    
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="Stechsoft.KeyVault.SecretsRetrieval" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Stechsoft.KeyVault.SecretsRetrieval" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Stechsoft.KeyVault.SecretsRetrieval" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Stechsoft.KeyVault.SecretsRetrieval --version 2.0.0
                    
#r "nuget: Stechsoft.KeyVault.SecretsRetrieval, 2.0.0"
                    
#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.
#addin nuget:?package=Stechsoft.KeyVault.SecretsRetrieval&version=2.0.0
                    
Install Stechsoft.KeyVault.SecretsRetrieval as a Cake Addin
#tool nuget:?package=Stechsoft.KeyVault.SecretsRetrieval&version=2.0.0
                    
Install Stechsoft.KeyVault.SecretsRetrieval as a Cake Tool

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 and AppId.
  • 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 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. 
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
2.0.1 106 3/14/2025
2.0.0 102 3/14/2025
1.0.0 112 3/14/2025