IUserSecretsManager

Interface
📦 Aspire.Hosting v17.0.0
interface IUserSecretsManager {
readonly filePath: string;
readonly isAvailable: boolean;
getOrSetSecret(
resourceBuilder: IResource,
name: string,
value: string): void;
saveStateJson(
json: string,
cancellationToken?: cancellationToken): void;
tryDeleteSecret(name: string): boolean;
trySetSecret(
name: string,
value: string): boolean;
}

Properties

propertyfilePathstringget
Gets the path to the user secrets file.
propertyisAvailablebooleanget
Gets a value indicating whether user secrets are available.

Methods

Gets a secret value if it exists in configuration, or sets it to the provided value if it does not.
getOrSetSecret(
resourceBuilder: IResource,
name: string,
value: string): void
resourceBuilderIResourceA resource builder from the target application.
namestringThe secret name.
valuestringThe value to persist when the secret is missing.
Saves state to user secrets from a JSON string.
saveStateJson(
json: string,
cancellationToken?: cancellationToken): void
jsonstringThe JSON object payload to persist.
cancellationTokencancellationTokenoptionalThe cancellation token.
Attempts to delete a user secret value synchronously.
tryDeleteSecret(name: string): boolean
namestringThe name of the secret.
boolean
Attempts to set a user secret value synchronously.
trySetSecret(
name: string,
value: string): boolean
namestringThe name of the secret.
valuestringThe value of the secret.
boolean