/vault-data-protection

Vault Key Repository for ASP.NET Core Data Protection

Primary LanguageC#MIT LicenseMIT

Vault Data Protection

NuGet version (VaultSharpDataProtection)

This package provides an XmlRepository implementation which can be used to store ASP.NET Data Protection keys in Hashcorp Vault using the VaultSharp client.

Usage

In your Startup.cs when configuring data protection use one of the PersistKeysToVault extension methods:

public void ConfigureServices(IServiceCollection services)
{
    var vaultUri = Configuration.GetConnectionString("vault");
    var vaultToken = Environment.GetEnvironmentVariable("VAULT_TOKEN");

    services.AddDataProtection()
        .PersistKeysToVault(vaultUri, vaultToken, "DataProtectionsKeys", "appSecrets");
    // ...
}