Class OsKeyringBackend
- Namespace
- Kuestenlogik.Bowire.Keyring
- Assembly
- Kuestenlogik.Bowire.Keyring.dll
The one shipped IKeyringBackend — reads the running OS's native credential store with zero NuGet dependencies:
- Windows —
CredReadWP/Invoke againstadvapi32.dll, target nameservice(generic credential). The password blob is decoded UTF-16LE, matching the convention used by PowerShell'sCredentialManagermodule, node-keytar, and Python'skeyring. - macOS —
security find-generic-password -s service [-a account] -w, the value printed on stdout. - Linux —
secret-tool lookup service <service> [account <account>](libsecret), the value printed on stdout with no trailing newline.
The Backend override forces one of these
ids; the default auto selects by OperatingSystem.
The two OS-integration surfaces — the CLI shell-out and the Windows
P/Invoke — sit behind injectable seams (ProcessRunner and
WindowsCredReader) so the dispatch + result-mapping logic is
unit-testable on any host with a fake; the public constructor wires the
real OS implementations.
public sealed class OsKeyringBackend : IKeyringBackend
- Inheritance
-
OsKeyringBackend
- Implements
- Inherited Members
Constructors
OsKeyringBackend(string)
Build a backend, honouring an explicit Backend override and otherwise auto-selecting by OS.
public OsKeyringBackend(string backendOverride = "auto")
Parameters
backendOverridestring
Properties
BackendId
The backend id actually in effect (wincred, keychain,
secret-tool, or none when no store is available on the
running OS). Surfaced by the status endpoint so the UI can explain
why a lookup returned nothing.
public string BackendId { get; }
Property Value
Methods
Read(KeyringReference)
Read one secret. Returns a KeyringReadResult that distinguishes "found" from "not found" from "the store errored", so the caller can leave the placeholder intact on a miss without masking a genuine backend failure in the logs.
public KeyringReadResult Read(KeyringReference reference)
Parameters
referenceKeyringReference