Tooark.Secrets.Vault
4.7.0
dotnet add package Tooark.Secrets.Vault --version 4.7.0
NuGet\Install-Package Tooark.Secrets.Vault -Version 4.7.0
<PackageReference Include="Tooark.Secrets.Vault" Version="4.7.0" />
<PackageVersion Include="Tooark.Secrets.Vault" Version="4.7.0" />
<PackageReference Include="Tooark.Secrets.Vault" />
paket add Tooark.Secrets.Vault --version 4.7.0
#r "nuget: Tooark.Secrets.Vault, 4.7.0"
#:package Tooark.Secrets.Vault@4.7.0
#addin nuget:?package=Tooark.Secrets.Vault&version=4.7.0
#tool nuget:?package=Tooark.Secrets.Vault&version=4.7.0
Tooark.Secrets.Vault
Tooark.Secrets provider on HashiCorp Vault
and OpenBao: it loads the KV version 2 secrets into IConfiguration and implements ISecretService on them.
OpenBao keeps the Vault API, so the same package serves both.
The client is the package's own, on the HTTP API, without a third-party library: it covers reading and listing the KV and authentication by token, AppRole or Kubernetes.
The model, the common options and the conversion of names into keys are in the
Tooark.Secrets README. This README covers
what is specific to Vault.
π Languages: πΊπΈ English (this file) Β· π§π· PortuguΓͺs
π Contents
- Installation
- Configuration
- Authentication
- Access policy
- Behavior on Vault
- Dependencies
- Error Codes and Solutions
- Contributing
- Help & Security
- Support
- License
π§ Installation
dotnet add package Tooark.Secrets.Vault
βοΈ Configuration
appsettings.json
{
"Secrets": {
"Address": "https://vault.company.com:8200",
"Path": "arkuest/prod",
"AuthMethod": "Kubernetes",
"Role": "arkuest"
}
}
Program.cs
using Tooark.Secrets.Vault.Injections;
// KV secrets in the configuration, on top of appsettings.json
builder.Configuration.AddTooarkSecretsVault();
// Runtime secret reads, with cache
builder.Services.AddTooarkSecretsVault(builder.Configuration);
The IConfigurationBuilder AddTooarkSecretsVault requires Path. The IServiceCollection one registers
ISecretService, which reads any KV path.
VaultSecretsOptions properties
Besides the common options:
| Property | Type | Default | Description |
|---|---|---|---|
Address |
string? |
VAULT_ADDR/BAO_ADDR |
Store address. Required |
Namespace |
string? |
VAULT_NAMESPACE/BAO_NAMESPACE |
Namespace, in Vault Enterprise or OpenBao |
Mount |
string |
secret |
Mount path of the KV version 2 |
Path |
string? |
β | KV path that becomes configuration, read recursively |
AuthMethod |
string |
Token |
Token, AppRole or Kubernetes |
AuthMount |
string? |
approle/kubernetes |
Mount path of the authentication method |
Token |
string? |
VAULT_TOKEN/BAO_TOKEN |
Token, in the Token method |
RoleId |
string? |
β | Role ID, in the AppRole method |
SecretId |
string? |
β | Secret ID, in the AppRole method |
Role |
string? |
β | Store role, in the Kubernetes method |
KubernetesTokenPath |
string |
pod service account token | Token file read in the Kubernetes method |
A missing address, token and namespace come from the command-line client's environment variables: first VAULT_*,
then BAO_*. A value set in the configuration wins over them.
π Authentication
| Method | When to use | How it works |
|---|---|---|
Kubernetes |
Application in a Kubernetes cluster | The pod's service account token goes into the login; no secret in configuration |
AppRole |
Machine, VM or pipeline | Role ID in configuration and Secret ID delivered by the deployment environment |
Token |
Development and tests | The token goes straight into the requests, without login |
The AppRole and Kubernetes token is obtained on first use. When the store rejects it, because it expired or was
revoked, the client logs in again and repeats the request once. The Token method's token is not renewed.
π Access policy
The identity's policy needs to read the secrets and list the path's folders:
path "secret/data/arkuest/prod/*" {
capabilities = ["read"]
}
path "secret/data/arkuest/prod" {
capabilities = ["read"]
}
path "secret/metadata/arkuest/prod/*" {
capabilities = ["list"]
}
path "secret/metadata/arkuest/prod" {
capabilities = ["list"]
}
π§ Behavior on Vault
- One field, one key β the
SecretKeyfield of the secretarkuest/prod/StoragebecomesStorage:SecretKey; the fields of the secret atPathitself sit at the root. - Recursive read β
Pathis walked folder by folder, up to 10 levels. A path that is both a secret and a folder has both read. - JSON fields β a field's value stays as text, even when it is JSON, unless
ExpandJson. A field that is not text (number, object) arrives in JSON format. - Current version β the current version of each secret applies; a deleted secret is skipped.
ISecretServiceβ the name is the KV path, and the value is the JSON object with the fields;GetFieldAsyncreads one field.
π Dependencies
| Package | Version | Description |
|---|---|---|
Tooark.Secrets |
4.x | Model and configuration source |
Microsoft.Extensions.DependencyInjection.Abstractions |
8.x/10.x | Container registration |
There is no third-party client: the calls to the store use the .NET HttpClient.
β οΈ Error Codes and Solutions
The common errors are in the
Tooark.Secrets README.
A failure to load the source arrives as Secrets.LoadFailed;Vault, with the store error in InnerException.
| Message | Description | Solution |
|---|---|---|
Options.Secrets.Vault.AddressNotConfigured |
No address nor VAULT_ADDR/BAO_ADDR |
Configure Secrets:Address |
Options.Secrets.Vault.AddressInvalid;{value} |
Address is not an absolute http or https URL |
Use the full address, with the port |
Options.Secrets.Vault.AuthMethodInvalid;{value} |
Unknown authentication method | Use Token, AppRole or Kubernetes |
Options.Secrets.Vault.TokenNotConfigured |
Token method without a token nor VAULT_TOKEN |
Provide the token through the environment |
Options.Secrets.Vault.AppRoleNotConfigured |
AppRole method without Role ID or Secret ID |
Provide both |
Options.Secrets.Vault.KubernetesRoleNotConfigured |
Kubernetes method without Role |
Provide the role configured in the store |
Secrets.Vault.LoginFailed |
The store rejected the login | Check the role, the Role ID and the Secret ID |
Secrets.Vault.KubernetesTokenNotFound;{path} |
The service account token does not exist | Check automountServiceAccountToken and the path |
π€ Contributing
Contributions are welcome! Start with CONTRIBUTING.md β it covers the development workflow, the coding and commit conventions and the pull request checklist. Bugs and feature requests go through the issue templates of the Tooark repository.
By participating you agree to the Code of Conduct.
π Help & Security
- β Questions, bugs, feature ideas β see SUPPORT.md for the right channel
- π Security vulnerabilities β do not open a public issue; follow SECURITY.md
π Support
If Tooark helps your projects, consider supporting its development:
- π GitHub Sponsors
- β Ko-fi
Every contribution helps keep the project maintained and improving. Thank you! π
π License
This project is licensed under the BSD 3-Clause License.
| Product | Versions 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 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Options (>= 10.0.12)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.12)
- Tooark.Secrets (>= 4.7.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Tooark.Secrets (>= 4.7.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 |
|---|---|---|
| 4.7.0 | 95 | 9/30/2026 |