LeverowLIbs.Vault 1.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package LeverowLIbs.Vault --version 1.0.0
                    
NuGet\Install-Package LeverowLIbs.Vault -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="LeverowLIbs.Vault" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LeverowLIbs.Vault" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LeverowLIbs.Vault" />
                    
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 LeverowLIbs.Vault --version 1.0.0
                    
#r "nuget: LeverowLIbs.Vault, 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 LeverowLIbs.Vault@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=LeverowLIbs.Vault&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LeverowLIbs.Vault&version=1.0.0
                    
Install as a Cake Tool

LL.HashiCorp.Vault

Lightweight HashiCorp Vault client abstraction built on VaultSharp. Supports KV v1/v2 engines and multiple authentication methods (Token, AppRole, Kubernetes).

Installation

<PackageReference Include="LeverowLIbs.Vault" Version="1.0.0" />

Setup

appsettings.json:

{
  "Vault": {
    "Address": "https://vault.example.com:8200",
    "AuthMethod": "Token",
    "Token": "s.xxxxxxxxxxxxxxxx",
    "KvMountPath": "secret",
    "KvVersion": 2
  }
}

Program.cs:

builder.Services.AddVaultService(builder.Configuration);

Or configure in code:

builder.Services.AddVaultService(options =>
{
    options.Address = "https://vault.example.com:8200";
    options.AuthMethod = VaultAuthMethod.AppRole;
    options.RoleId = "my-role-id";
    options.SecretId = "my-secret-id";
    options.KvMountPath = "secret";
    options.KvVersion = 2;
});

Usage examples

Read a single value
public class MyService(IVaultService vault)
{
    public async Task<string?> GetConnectionStringAsync(CancellationToken ct = default)
    {
        return await vault.ReadSecretValueAsync("myapp/database", "ConnectionString", ct);
    }
}
Read all key-value pairs
IDictionary<string, object?> data = await vault.ReadSecretAsync("myapp/database", ct);

foreach (var (key, value) in data)
    Console.WriteLine($"{key} = {value}");
Write a secret
await vault.WriteSecretAsync("myapp/database", new Dictionary<string, object>
{
    ["ConnectionString"] = "Server=db;Database=app;",
    ["Password"] = "s3cr3t"
}, ct);
Delete a secret
await vault.DeleteSecretAsync("myapp/database", ct);
List secrets under a path
IList<string> keys = await vault.ListSecretsAsync("myapp/", ct);

foreach (var key in keys)
    Console.WriteLine(key);

Authentication methods

Method Required fields
Token Token
AppRole RoleId, SecretId
Kubernetes KubernetesRole, KubernetesJwtPath (optional, default: /var/run/secrets/kubernetes.io/serviceaccount/token), KubernetesMountPoint (optional, default: kubernetes)

Configuration reference

Property Default Description
Address (required) Vault server URL, e.g. https://vault.example.com:8200
AuthMethod Token Authentication method: Token, AppRole, Kubernetes
Token (required for Token) Vault token
RoleId (required for AppRole) AppRole role ID
SecretId (required for AppRole) AppRole secret ID
KubernetesRole (required for Kubernetes) Kubernetes auth role name
KubernetesJwtPath /var/run/secrets/kubernetes.io/serviceaccount/token Path to Kubernetes service account JWT
KubernetesMountPoint kubernetes Vault Kubernetes auth mount point
KvMountPath secret KV engine mount path
KvVersion 2 KV engine version: 1 or 2
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.  net10.0 was computed.  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