string Code { get; }
Source
Gets the stable machine-readable diagnostic code.
LocalSecrets store that delegates to the current operating system's user secret facility when available.
macOS uses Security.framework Keychain generic passwords, Windows uses current-user Credential Manager generic credentials, Linux uses Secret Service through secret-tool, and unsupported sessions return display-safe diagnostics.
In-memory LocalSecrets store intended for tests and controlled local examples.
This store is not durable and is not a production or development secret store. It exists as a package-local test seam so apps can verify LocalSecrets provider behavior without touching the platform credential store.
Describes a display-safe local secret diagnostic.
Diagnostics are safe to render in command output, audit reports, and exception messages. They must never carry raw secret values. Use ToTerminalDiagnostic when the diagnostic should stop lower-priority configuration provider resolution.
ConfigProviderTerminalDiagnostic ToTerminalDiagnostic()
Source
Converts this local secret diagnostic into a Config terminal diagnostic.
A terminal diagnostic safe for runtime configuration resolution errors.
string ToDisplayString()
Source
Formats this diagnostic for display without exposing secret values.
A multiline display-safe diagnostic string.
string Code { get; }
Source
Gets the stable machine-readable diagnostic code.
string Problem { get; }
Source
Gets the display-safe problem summary.
string Cause { get; }
Source
Gets the display-safe cause summary.
string Fix { get; }
Source
Gets the suggested recovery action.
string? Docs { get; }
Source
Gets an optional documentation hint or URL.
bool Retryable { get; }
Source
Gets a value indicating whether retrying later may resolve the condition.
Registers the AppSurface LocalSecrets provider and supporting services.
Add this module only when the application wants fail-closed local secret posture. Environment variables keep the highest precedence, LocalSecrets sits above file configuration, and only true missing local secrets fall through.
void ConfigureServices(StartupContext context, IServiceCollection services)
Source
Registers LocalSecrets services.
contextStartup context for the current app.servicesService collection that receives LocalSecrets registrations.File-backed LocalSecrets store for deterministic local workflows and tests.
This store is useful when OS credential tooling is unavailable in CI or examples. It is not the default platform store and should not be used as a production vault. The file contains secret values and must stay outside source control.
string GetDefaultPath()
Source
Gets the default per-user AppSurface local secret file path.
A path under the user's local application data directory.
Normalizes LocalSecrets app, environment, prefix, and key values into a stable storage identity.
The normalizer is the boundary between logical AppSurface config keys and platform-specific local secret names. Application, environment, and prefix segments are trimmed, capped at 128 characters, and limited to ASCII letters, digits, dash, underscore, and dot where documented. Whitespace in segments becomes -. Config keys are trimmed, capped at 256 characters, reject nulls and line breaks, normalize __ to :, and normalize \ to /. When the application name is omitted, the normalizer infers one from the entry assembly, then the current directory, then AppSurfaceApp; pin AppSurfaceLocalSecretsOptions.ApplicationName for published apps so deployment shape or working-directory changes do not move the local secret namespace.
AppSurfaceLocalSecretIdentityResult Normalize(string? applicationName, string environment, string? keyPrefix, string key)
Source
Normalizes a local secret identity.
applicationNameThe optional configured application name.environmentThe AppSurface environment name.keyPrefixThe optional key prefix.keyThe AppSurface config key.A normalized identity result.
A successful result contains normalized display segments and a storage name in the form appsurface:{application}:{environment}:{key}, or appsurface:{application}:{environment}:{prefix}:{key} when a prefix is configured. Invalid input returns a display-safe diagnostic rather than throwing so command and provider paths can render paste-safe guidance.
Defines where LocalSecrets is allowed to participate in configuration resolution.
Numeric values are part of the public AppSurface LocalSecrets contract and must remain stable. The zero value is DevelopmentOnly so CLR default enum initialization matches the documented provider default.
Describes local secret identity normalization.
IdentityThe normalized identity when valid.DiagnosticThe display-safe diagnostic when invalid.AppSurfaceLocalSecretIdentityResult Valid(AppSurfaceLocalSecretIdentity identity)
Source
Creates a successful identity result.
identityThe normalized identity.A successful result.
AppSurfaceLocalSecretIdentityResult Invalid(AppSurfaceLocalSecretDiagnostic diagnostic)
Source
Creates a failed identity result.
diagnosticThe display-safe diagnostic.A failed result.
bool Succeeded { get; }
Source
Gets a value indicating whether normalization succeeded.
AppSurface configuration provider that resolves values from the local secret store.
The provider sits above file configuration and below environment variables. Only true missing secrets fall through; store, posture, identity, and conversion failures are terminal when fail-closed behavior is enabled.
AppSurfaceLocalSecretResolution<T> ResolveValue<T>(string environment, string key)
Source
Resolves a local secret and returns the structured LocalSecrets status before config-provider adaptation.
TThe requested configuration value type.environmentThe AppSurface environment being resolved.keyThe logical AppSurface configuration key.The typed LocalSecrets resolution.
Provides service collection helpers for AppSurface LocalSecrets.
IServiceCollection ConfigureAppSurfaceLocalSecrets(this IServiceCollection services, Action<AppSurfaceLocalSecretsOptions> configure)
Source
Configures LocalSecrets options.
servicesThe service collection to configure.configureThe options callback.The original service collection.
IServiceCollection UseAppSurfaceLocalSecretStore<TStore>(this IServiceCollection services)
Source
Replaces the local secret store implementation.
TStoreThe store implementation type.servicesThe service collection to configure.The original service collection.
IServiceCollection UseAppSurfaceLocalSecretStore(this IServiceCollection services, IAppSurfaceLocalSecretStore store)
Source
Replaces the local secret store with a specific instance.
servicesThe service collection to configure.storeThe store instance.The original service collection.
Identifies the outcome of a local secret lookup or mutation.
Only Missing represents true absence and may fall through to lower-priority configuration providers. All other non-found states are terminal for a LocalSecrets-claimed key. Numeric values are part of the public AppSurface LocalSecrets contract and must remain stable because status values may appear in diagnostics, tests, serialized examples, or package-consumer switch expressions.
Describes a local secret list operation.
StatusThe list status.KeysThe display-safe logical config keys.DiagnosticThe display-safe diagnostic for non-success states.SourceThe display-safe source name.AppSurfaceLocalSecretListResult Found(IEnumerable<string> keys, string source)
Source
Creates a successful list result.
keysThe display-safe logical config keys.sourceThe display-safe source name.A list result.
AppSurfaceLocalSecretListResult Failed(LocalSecretResultStatus status, AppSurfaceLocalSecretDiagnostic diagnostic, string source)
Source
Creates a non-success list result.
statusThe non-success status.diagnosticThe display-safe diagnostic.sourceThe display-safe source name.A list result.
Describes the result of a local secret store operation.
StatusThe operation status.ValueThe raw secret value only when Status is LocalSecretResultStatus.Found.DiagnosticThe display-safe diagnostic for non-success states.SourceThe display-safe source name that handled the operation.AppSurfaceLocalSecretResult Found(string value, string source)
Source
Creates a found result.
valueThe raw secret value.sourceThe display-safe source name.A found result.
AppSurfaceLocalSecretResult Missing(string source)
Source
Creates a missing result that may fall through to lower-priority providers.
sourceThe display-safe source name.A missing result.
AppSurfaceLocalSecretResult NotFound(LocalSecretResultStatus status, AppSurfaceLocalSecretDiagnostic diagnostic, string source)
Source
Creates a non-found result with a display-safe diagnostic.
statusThe non-found status.diagnosticThe display-safe diagnostic.sourceThe display-safe source name.A non-found result.
Describes typed LocalSecrets provider resolution before it is adapted to ForgeTrust.AppSurface.Config.IConfigProvider.
TThe requested configuration value type.StatusThe structured LocalSecrets resolution status.ValueThe converted secret value only when Status is LocalSecretResultStatus.Found.DiagnosticThe display-safe diagnostic for non-success states.SourceThe display-safe source name that handled the lookup.AppSurfaceLocalSecretResolution<T> Found(T? value, string source)
Source
Creates a found resolution.
valueThe converted value.sourceThe display-safe source name.A found resolution.
AppSurfaceLocalSecretResolution<T> NotFound(LocalSecretResultStatus status, AppSurfaceLocalSecretDiagnostic diagnostic, string source)
Source
Creates a non-found resolution with a display-safe diagnostic.
statusThe non-found status.diagnosticThe display-safe diagnostic.sourceThe display-safe source name.A non-found resolution.
Configures the AppSurface LocalSecrets provider.
Defaults are intentionally fail-closed: LocalSecrets is development-only, claims keys once registered, and reports local store failures as terminal diagnostics instead of falling through to lower-priority file configuration.
LocalSecretsPostureMode Posture { get; set; }
Source
Gets or sets the posture mode for local secret resolution.
string? ApplicationName { get; set; }
Source
Gets or sets the application identity used in the platform store namespace.
Leave unset to infer an identity from the entry assembly or current directory. Override this when multiple apps share a binary name or when command-line workflows need a stable package-independent identity.
string? KeyPrefix { get; set; }
Source
Gets or sets an optional namespace prefix applied before the AppSurface config key.
string DocsHint { get; set; }
Source
Gets or sets the documentation hint emitted in local secret diagnostics.
bool FailClosedOnStoreFailure { get; set; }
Source
Gets or sets a value indicating whether local store failures stop lower-priority provider resolution.
Keep the default enabled for secret posture. Disabling this escape hatch makes unavailable stores behave like missing values and can mask secrets from files.
ISet<string> DevelopmentEnvironmentNames { get; }
Source
Gets or sets development-like environment names accepted by LocalSecretsPostureMode.DevelopmentOnly.
Identifies one local secret across application, environment, prefix, and AppSurface config key.
ApplicationNameThe normalized application name.EnvironmentThe normalized environment name.KeyPrefixThe optional normalized key prefix.KeyThe normalized AppSurface config key.StorageNameThe stable cross-platform storage name.Stores AppSurface LocalSecrets values for one machine and user context.
Implementations should use display-safe diagnostics for expected platform failures. Raw secret values may be returned only through Get(AppSurfaceLocalSecretIdentity) when the status is LocalSecretResultStatus.Found.
AppSurfaceLocalSecretResult Get(AppSurfaceLocalSecretIdentity identity)
Source
Reads a local secret.
identityThe normalized local secret identity.The store result.
AppSurfaceLocalSecretResult Set(AppSurfaceLocalSecretIdentity identity, string value)
Source
Writes a local secret.
identityThe normalized local secret identity.valueThe raw secret value.The store result. Successful writes return LocalSecretResultStatus.Found with no value.
AppSurfaceLocalSecretResult Delete(AppSurfaceLocalSecretIdentity identity)
Source
Deletes a local secret.
identityThe normalized local secret identity.The store result.
AppSurfaceLocalSecretListResult List(string applicationName, string environment, string? keyPrefix)
Source
Lists known local secret config keys for an application/environment namespace.
applicationNameThe normalized application name.environmentThe normalized environment name.keyPrefixThe optional normalized key prefix.The list result.
AppSurfaceLocalSecretResult Doctor(string applicationName, string environment, string? keyPrefix)
Source
Diagnoses whether the store is usable for the supplied namespace.
applicationNameThe normalized application name.environmentThe normalized environment name.keyPrefixThe optional normalized key prefix.A display-safe store diagnostic result.
string Name { get; }
Source
Gets the display-safe store name.