OutWit.Shared.Secrets.Providers
1.0.0
dotnet add package OutWit.Shared.Secrets.Providers --version 1.0.0
NuGet\Install-Package OutWit.Shared.Secrets.Providers -Version 1.0.0
<PackageReference Include="OutWit.Shared.Secrets.Providers" Version="1.0.0" />
<PackageVersion Include="OutWit.Shared.Secrets.Providers" Version="1.0.0" />
<PackageReference Include="OutWit.Shared.Secrets.Providers" />
paket add OutWit.Shared.Secrets.Providers --version 1.0.0
#r "nuget: OutWit.Shared.Secrets.Providers, 1.0.0"
#:package OutWit.Shared.Secrets.Providers@1.0.0
#addin nuget:?package=OutWit.Shared.Secrets.Providers&version=1.0.0
#tool nuget:?package=OutWit.Shared.Secrets.Providers&version=1.0.0
OutWit.Shared.Secrets.Providers
Secret-storage abstractions for OutWit hosts: ISecretStore over the operating
system's credential store, for the one or two long-lived credentials a product
holds — tokens, keys, passphrases. Not certificates, key files or blobs: secrets
above 1024 bytes are refused with a named failure.
This is the contract package — install a provider to get an actual store:
OutWit.Shared.Secrets.Provider.Windows— Windows Credential ManagerOutWit.Shared.Secrets.Provider.File— the explicitly-labelled file fallback- (planned)
OutWit.Shared.Secrets.Provider.Linux(libsecret),OutWit.Shared.Secrets.Provider.MacOS(Keychain)
The status model — the whole point
A store that answers null for "no such secret", for "the keyring is locked",
and for "there is no D-Bus session here" produces a product that reports "this
agent is not provisioned" when the truth is "the credential is there and I
cannot open the box". That is an unfixable support call, and it is the default
outcome of the obvious API. So nothing here returns null and nothing throws for
an expected condition:
SecretStatus |
Meaning |
|---|---|
Found |
The secret is here (and: a store succeeded) |
NotFound |
The store works and holds no such secret — the only "not provisioned" (and: a delete succeeded) |
Unavailable |
The store will not open — locked keyring, no session bus, no vault for this account |
Denied |
The store opened and refused this caller |
Failed |
Something else, named in Message |
Unknown |
Default value; never a valid answer |
Exceptions are reserved for programming errors — a null key, a key that breaks the rules below.
Use
ISecretStore store = /* register a provider at the composition root */;
// Log once at startup what you actually got, and that it opens at all —
// don't discover a missing vault at the first credential read, hours later:
logger.LogInformation("Secret store: {Description}", store.Description);
var check = await store.CheckAsync();
if (!check.IsSuccess())
logger.LogError("Secret store unreachable: {Status} {Message}", check.Status, check.Message);
var result = await store.ReadAsync("MyProduct/ApiKey");
switch (result.Status)
{
case SecretStatus.Found: /* use result.Secret, clear it when done */ break;
case SecretStatus.NotFound: /* genuinely not provisioned */ break;
default: /* do NOT treat as "not provisioned"! */ break;
}
Keys are {Product}/{Purpose} — case-sensitive ASCII [A-Za-z0-9._/-], 1–128
characters. Secrets are byte[], not string: a .NET string cannot be reliably
erased. StoreStringAsync / GetString extensions exist for convenience and
say what they cost.
What this defends against — and what it does not
It defends against: another user of the same machine reading the credential; a credential sitting in a settings file, and therefore in a support bundle, a backup, a screenshot, or a version-control checkout; casual disclosure through ordinary tooling.
It does not defend against: an administrator on the machine; an attacker running as the owning account; an offline attack on a stolen disk or image; cloning. It raises reading a credential from "open the config file" to "obtain administrative control of the machine or its disk" — design everything downstream of the credential on the assumption that the second is possible: keep stored credentials centrally revocable.
Migrating a credential out of settings
For a product that already keeps a credential in a settings file, the move is five lines and a decision:
string? legacy = settings.ApiKey; // the plaintext settings value
if (!string.IsNullOrEmpty(legacy))
{
await store.StoreStringAsync("MyProduct/ApiKey", legacy);
settings.ApiKey = ""; // overwrite, then save
settings.Save();
}
The caveat that matters: the old value survives in backups, in the file's free space, in support bundles already collected, and in any version-controlled copy. Migration therefore ends with rotating the credential, not with moving it. A secret that has been in a plaintext settings file is a secret that has been disclosed.
Uninstall
An uninstaller must DeleteAsync the keys it provisioned. There is nothing the
library can do to enforce that, which is why it is written here: a credential
that survives uninstallation sits in the vault indefinitely, and is still valid.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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 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 is compatible. 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
- OutWit.Common (>= 1.4.0)
-
net6.0
- OutWit.Common (>= 1.4.0)
-
net7.0
- OutWit.Common (>= 1.4.0)
-
net8.0
- OutWit.Common (>= 1.4.0)
-
net9.0
- OutWit.Common (>= 1.4.0)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on OutWit.Shared.Secrets.Providers:
| Package | Downloads |
|---|---|
|
OutWit.Shared.Secrets.Provider.Windows
Windows Credential Manager provider for OutWit.Shared.Secrets. Generic credentials via advapi32 (LibraryImport, NativeAOT-clean), in the vault of the account the process runs as: an interactive user cannot read a service's credential, and vice versa. Register at the composition root; entries appear in Credential Manager → Windows Credentials → Generic Credentials under "{key}#{hash}". |
|
|
OutWit.Shared.Secrets.Provider.Linux
Linux Secret Service (libsecret) provider for OutWit.Shared.Secrets, for interactive desktop sessions with an unlocked keyring. The Secret Service is a session service: a systemd unit with no session, or a container, has no session bus — the honest answer there is SecretStatus.Unavailable, and the File provider is the deliberate choice. Payloads are stored base64-encoded (the libsecret password API is string-based); find entries with secret-tool lookup key {key}. |
|
|
OutWit.Shared.Secrets.Provider.MacOS
macOS Keychain provider for OutWit.Shared.Secrets: generic passwords in the login keychain via the Security framework, replaced in place (no delete-then-add window). For user-facing applications; a daemon belongs in the System keychain, which this provider does not manage. An item added by one binary and read by another prompts — and a prompt in a service is a hang. |
|
|
OutWit.Shared.Secrets.Provider.File
File-based fallback provider for OutWit.Shared.Secrets — for deployments with no reachable OS credential store (containers, session-less services). Never selected automatically: configuration names it. One file per key with owner-only permissions verified at creation, atomic replace via temp-file-and-rename, DPAPI machine-scope protection on Windows (Protection=FileWithPlatformKey) and honest FileOnly elsewhere. Read the package README for what this does not defend against. |
|
|
OutWit.Shared.Secrets.Desktop
The composite desktop package for OutWit.Shared.Secrets: references the Windows, macOS and Linux providers and exposes SecretStoreDesktop.ForCurrentPlatform(), so a cross-platform desktop application takes one reference and writes one line. Selecting among the operating-system providers by runtime platform is not silent degradation — on each desktop platform exactly one OS store is right, and all three protect the same way. Falling back to the File provider stays a deliberate, configured choice. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 450 | 8/31/2026 |