RepletoryLib.Security.Secrets
1.0.0
dotnet add package RepletoryLib.Security.Secrets --version 1.0.0
NuGet\Install-Package RepletoryLib.Security.Secrets -Version 1.0.0
<PackageReference Include="RepletoryLib.Security.Secrets" Version="1.0.0" />
<PackageVersion Include="RepletoryLib.Security.Secrets" Version="1.0.0" />
<PackageReference Include="RepletoryLib.Security.Secrets" />
paket add RepletoryLib.Security.Secrets --version 1.0.0
#r "nuget: RepletoryLib.Security.Secrets, 1.0.0"
#:package RepletoryLib.Security.Secrets@1.0.0
#addin nuget:?package=RepletoryLib.Security.Secrets&version=1.0.0
#tool nuget:?package=RepletoryLib.Security.Secrets&version=1.0.0
RepletoryLib.Security.Secrets
Secret management with Environment, User Secrets, and Azure Key Vault providers.
Part of the RepletoryLib ecosystem -- standalone, reusable .NET 10 libraries with zero business logic.
Overview
RepletoryLib.Security.Secrets provides a unified ISecretProvider interface for retrieving secrets from multiple sources. It ships with three providers -- Environment Variables, .NET User Secrets, and Azure Key Vault -- and automatically selects the right one based on configuration.
Key Features
ISecretProvider-- Unified get/set/delete interface for secrets- Environment provider -- Read/write environment variables
- User Secrets provider -- Read from .NET User Secrets (development)
- Azure Key Vault provider -- Full CRUD via Azure.Identity
- Configurable -- Select provider via
appsettings.json
Installation
dotnet add package RepletoryLib.Security.Secrets
Dependencies
| Package | Type |
|---|---|
RepletoryLib.Common |
RepletoryLib |
Azure.Security.KeyVault.Secrets |
NuGet |
Azure.Identity |
NuGet |
Quick Start
using RepletoryLib.Security.Secrets;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRepletorySecrets(builder.Configuration);
{
"Secrets": {
"Provider": "Environment"
}
}
For Azure Key Vault:
{
"Secrets": {
"Provider": "AzureKeyVault",
"AzureKeyVaultUri": "https://my-vault.vault.azure.net/"
}
}
Configuration
SecretsOptions
| Property | Type | Default | Description |
|---|---|---|---|
Provider |
SecretProviderType |
Environment |
Active provider: Environment, UserSecrets, or AzureKeyVault |
AzureKeyVaultUri |
string? |
null |
Key Vault URI (required for AzureKeyVault provider) |
Usage Examples
Reading and Writing Secrets
using RepletoryLib.Security.Secrets.Interfaces;
public class ConfigService
{
private readonly ISecretProvider _secrets;
public ConfigService(ISecretProvider secrets) => _secrets = secrets;
public async Task<string> GetDatabasePasswordAsync()
{
var password = await _secrets.GetSecretAsync("DatabasePassword");
return password ?? throw new InvalidOperationException("Database password not configured");
}
public async Task RotateApiKeyAsync()
{
var newKey = Guid.NewGuid().ToString("N");
await _secrets.SetSecretAsync("ExternalApiKey", newKey);
}
public async Task CleanupAsync()
{
await _secrets.DeleteSecretAsync("TempSecret");
}
}
Provider Capabilities
| Provider | Get | Set | Delete |
|---|---|---|---|
EnvironmentSecretProvider |
Environment variable | Sets env var (process-scoped) | Removes env var |
UserSecretsProvider |
.NET User Secrets | Not supported (throws) | Not supported (throws) |
AzureKeyVaultProvider |
Key Vault secret | Creates/updates secret | Deletes secret |
Integration with Other RepletoryLib Packages
| Package | Relationship |
|---|---|
RepletoryLib.Common |
Direct dependency |
RepletoryLib.Security.Encryption |
Store encryption keys in a secret provider |
RepletoryLib.Configuration |
Complement configuration with secret management |
License
This project is licensed under the MIT License.
Copyright (c) 2024-2026 Repletory.
For complete documentation, infrastructure setup, and configuration reference, see the RepletoryLib main repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Azure.Extensions.AspNetCore.Configuration.Secrets (>= 1.3.2)
- Azure.Identity (>= 1.13.2)
- Azure.Security.KeyVault.Secrets (>= 4.7.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- RepletoryLib.Common (>= 1.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.0.0 | 83 | 3/2/2026 |