IUserSecretsManager
Interface
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;}6 members
Properties
property
filePath stringgetGets the path to the user secrets file.
property
isAvailable booleangetGets a value indicating whether user secrets are available.
Methods
method
getOrSetSecret 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): voidParameters
resourceBuilder IResource A resource builder from the target application.namestringThe secret name.valuestringThe value to persist when the secret is missing.method
saveStateJson Saves state to user secrets from a JSON string.
saveStateJson( json: string, cancellationToken?: cancellationToken): voidParameters
jsonstringThe JSON object payload to persist.cancellationToken cancellationToken optionalThe cancellation token.method
tryDeleteSecret Attempts to delete a user secret value synchronously.
tryDeleteSecret(name: string): booleanParameters
namestringThe name of the secret.Returns
booleanmethod
trySetSecret Attempts to set a user secret value synchronously.
trySetSecret( name: string, value: string): booleanParameters
namestringThe name of the secret.valuestringThe value of the secret.Returns
boolean