MindAttic/MindAttic.Vault
Library

MindAttic.Vault.

Set a key once. Every app on the machine sees it.

MindAttic.Vault gives every .NET app one IConfiguration-backed home for API keys and settings, plus a native desktop app where all of them are edited in one place.

Active development C# .NET 9 .NET 10 Microsoft.Extensions.Configuration WPF NUnit 4

What it is

One home for every key and setting

Every app that talks to an LLM, a broker or an FTP server ends up hand-rolling the same Load(), Save() and environment-variable plumbing, and every user ends up pasting the same API key into five settings screens. Vault replaces all of it with one library and one place on disk: %APPDATA%\MindAttic.

The library plugs into standard IConfiguration. Local files, environment variables and any configuration provider you wire upstream all surface the same MindAttic:Vault shape, so the code that reads llm.GetKey("claude") on your laptop runs unchanged in a container fed by environment variables.

MindAttic.Vault.Desktop is the companion WPF app. Each MindAttic app describes its settings with a few attributes, and Vault.Desktop renders a tab for it: its settings, the keys it uses, and a shared key pool with several keys per provider you can switch between when one stops working. An app's cog opens Vault.Desktop straight at its tab through the mindattic-vault:// link.

It is deliberately small: no server, no network listener, no Azure SDK in the core package. It is a resolution and projection layer over sources you already own.

Who it's for

  • .NET developers juggling API keysInject LlmCredentialResolver and stop writing per-app key loaders, overlays and fallbacks.
  • Teams shipping the same code everywhereLaptop, CI and container read secrets through the same schema with no code change between them.
  • People running many MindAttic appsEnter a key once in Vault.Desktop and every app on the machine picks it up.
  • App authors who want a settings screen for freeAnnotate one settings class and Vault.Desktop builds the editor, defaults and validation for you.

Features

What you get

01

One schema, every source

Local files, environment variables (MindAttic__Vault__LLM__claude__apiKey) and upstream providers all resolve into the same MindAttic:Vault tree. Section names live in VaultConfigurationKeys, never as loose strings.

02

Config first, file fallback

LlmCredentialResolver and BrokerCredentialResolver walk IConfiguration, then the writable file store, then null. The first non-blank value wins and writes always land in the file store.

03

Read-only where it matters

ConfigurationCredentialStore throws on every write, so a deployed app can never mutate its own secrets.

04

Key pools and per-app keys

IRotatingKeyStore keeps several labelled keys per provider in priority order. AppScopedCredentialStore lets one app use its own key without changing what any other app resolves.

05

Writes that survive a crash

Every store writes atomically (temp file plus File.Replace), takes cross-process locks, recovers from malformed files, and copies a corrupt providers.json aside before replacing it.

06

Typed per-app settings

JsonSettingsStore<T> loads, saves and updates roaming or local JSON settings with sync and async APIs, serialized writes, and a strict loader for callers that must never save over unreadable data.

07

A settings editor for every app

[SettingsApp], [Setting], [SettingRange] and [UsesCredential] describe an app once. Vault.Desktop turns that into a tab with grouped fields, shipped defaults and the keys the app needs.

08

DI in one line

AddMindAtticVault() for console and desktop apps, AddMindAtticVault(configuration) for web and worker hosts, AddVaultAppSettings<T>("MyApp") for a roaming settings store.

09

Documented to the last overload

Every public type ships XML doc comments, and an NUnit 4 suite covers each one without ever touching your real %APPDATA%.

How it works

From key to code

  1. Reference the package

    Add MindAttic.Vault (net9.0 and net10.0) to your project.

  2. Wire the configuration

    Call AddMindAtticVaultFiles() on your configuration builder and AddMindAtticVault(builder.Configuration) on your services.

  3. Store the key once

    Enter it in Vault.Desktop, edit %APPDATA%\MindAttic\LLM\providers.json, or set an environment variable on the host.

  4. Inject and read

    Take LlmCredentialResolver in a constructor and call GetKey("claude").

Quick start

Wire it into a host

The same two calls work for a web app, a worker or a desktop host.

The full setup guide lives in the documentation.

csharp
using MindAttic.Vault.Configuration;
using MindAttic.Vault.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

builder.Configuration
    .AddJsonFile("appsettings.json", optional: true)
    .AddMindAtticVaultFiles()      // %APPDATA%\MindAttic\...
    .AddEnvironmentVariables();

builder.Services.AddMindAtticVault(builder.Configuration);

// later, in any service:
// public class MyService(LlmCredentialResolver llm)
// {
//     public string? Claude => llm.GetKey("claude");
// }

Part of MindAttic

One piece of a bigger workshop

Vault is the settings and secrets layer under almost every MindAttic app. Fifteen repos reference the package, among them MindAttic.Legion, MindAttic.Launcher, MindAttic.Psst, MindAttic.Deploy and MindAttic.Authentication.

Apps never ask the user for a key on their own screens any more: their cog opens Vault.Desktop at their tab, and the key they need is already in the shared pool.

Status

Where it stands

Active development

Library at 9.0.0; Vault.Desktop 1.0 nearly there

Every MindAttic app has moved its settings and keys into Vault, and all 24 app manifests open their tab through mindattic-vault://. The remaining work removes the retired Azure profile so the desktop app and the docs describe one local-only system.

Current milestone: Vault Desktop 1.0, local only: one library and one desktop app, with no Azure code left in the solution.

Next step

Stop pasting the same key into every app

Guides, reference and design notes are in the searchable MindAttic documentation. The source, issues and history are on GitHub.