JF91.VaultSharp 0.0.3

dotnet add package JF91.VaultSharp --version 0.0.3                
NuGet\Install-Package JF91.VaultSharp -Version 0.0.3                
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="JF91.VaultSharp" Version="0.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JF91.VaultSharp --version 0.0.3                
#r "nuget: JF91.VaultSharp, 0.0.3"                
#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.
// Install JF91.VaultSharp as a Cake Addin
#addin nuget:?package=JF91.VaultSharp&version=0.0.3

// Install JF91.VaultSharp as a Cake Tool
#tool nuget:?package=JF91.VaultSharp&version=0.0.3                

JF91.VaultSharp

WIP Minimalist Vault Client.

1: Install Nuget Package

dotnet add package JF91.VaultSharp

<br>

Available authentication methods:
  • Token
  • App Role

Available features:

  • Get all secrets from path
  • Get secret name value
  • Get secret name value and update appsettings.json (Currently limited to one nested property)

<br>

How to use:

Add this to your appsettings.json:

"VaultSettings": {
    "AuthenticationMethod": "approle",
    "Host": "http://localhost:8200",
    "RoleId": "",
    "SecretId": "",
    "Token": ""
}

Possible values:

  • AuthenticationMethod: approle, token

<br>

All methods are extensions methods from IConfiguration, which you can inject anywhere in your application and call them like this:

private readonly IConfiguration _configuration;

public MyController
(
    IConfiguration configuration
)
{
    _configuration = configuration;
}

[HttpGet(Name = "MyEndpoint")]
public ActionResult HelloWorld()
{
    var secrets = _configuration.GetVaultSecrets
    (
        "kv",
        "secretPath"
    );

    var secretValue = _configuration.GetVaultSecret
    (
        "kv",
        "secretPath",
        "secretName"
    );
    
    _configuration.InjectSecretToConfiguration
    (
        "kv",
        "test",
        "test2",
        "Secrets:Test",
        "Development" // Application Environment
    );
    
    _configuration.InjectSecretToConfiguration
    (
        "kv",
        "test",
        "test2",
        "Secrets:Nested:Test",
        "Development" // Application Environment
    );

    _configuration.InjectSecretToConfiguration
    (
        "kv",
        "test",
        "test2",
        "Secrets:Child[1]:Test",
        "Development" // Application Environment
    );

    return "Hello World!";
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
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
0.0.3 331 7/22/2023
0.0.2 175 7/22/2023
0.0.1 181 7/21/2023

0.0.3:
# Added ability to update any nested settings including object arrays.

0.0.2:
# Added method to retrieve secret value from Vault and update appsettings.json
# Added Token authentication

0.0.1:
# AppRole Authentication
# Vault settings from appsettings.json
# Added method: Get Vault Secret