Skip to content
DocsTry Aspire
DocsTry

IUserSecretsManager

Interface
📦 Aspire.Hosting v13.4.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
resourceBuilderIResource
namestring
valuestring
Saves state to user secrets from a JSON string.
saveStateJson(
json: string,
cancellationToken?: cancellationToken): void
jsonstring
cancellationTokencancellationTokenoptional
Attempts to delete a user secret value synchronously.
tryDeleteSecret(name: string): boolean
namestring
boolean
Attempts to set a user secret value synchronously.
trySetSecret(
name: string,
value: string): boolean
namestring
valuestring
boolean