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
                    
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="RepletoryLib.Security.Secrets" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RepletoryLib.Security.Secrets" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RepletoryLib.Security.Secrets" />
                    
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 RepletoryLib.Security.Secrets --version 1.0.0
                    
#r "nuget: RepletoryLib.Security.Secrets, 1.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.
#:package RepletoryLib.Security.Secrets@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RepletoryLib.Security.Secrets&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RepletoryLib.Security.Secrets&version=1.0.0
                    
Install as a Cake Tool

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.

NuGet .NET 10 License: MIT


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 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. 
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
1.0.0 83 3/2/2026