Udostępnij za pośrednictwem


IVsProjectSecrets Interface

Definition

An interface implemented by a project system to store secrets that the application this project builds can access at runtime.

public interface class IVsProjectSecrets
[System.Runtime.InteropServices.Guid("d94ae402-a4e1-4bc1-a436-a1a27768cabc")]
public interface IVsProjectSecrets
[<System.Runtime.InteropServices.Guid("d94ae402-a4e1-4bc1-a436-a1a27768cabc")>]
type IVsProjectSecrets = interface
Public Interface IVsProjectSecrets
Attributes

Remarks

An implementation of this interface may be obtained by calling IVsProject.GetItemContext(VSConstants.VSITEMID_Root, out IServiceProvider sp) and querying the resulting IServiceProvider for the service that implements this interface. Multiple services that implement this interface may be defined, each representing a different persistent store of secrets (e.g. secrets.json, appsettings.json, Key Vault). This interface itself should not be proffered as a the service type/ID to avoid confusion between the different sources. If a particular storage system may apply to multiple files in the project, this service may be found by calling IVsProject.GetItemContext passing in the ITEMID for one of those represented files.

Implementations are expected to be free-threaded and thread-safe.

Methods

AddSecretAsync(String, String, CancellationToken)

Adds a secret with the given name so the application built by this project can access it at runtime.

GetInvalidCharactersFrom(String)

Gets the set of distinct characters from the proposed secret name that would be disallowed.

GetSecretAsync(String, CancellationToken)

Gets the secret with the given name.

GetSecretNamesAsync(CancellationToken)

Gets the names of the stored secrets.

GetSecretsAsync(CancellationToken)

Gets a complete map of stored secret names and values.

RemoveSecretAsync(String, CancellationToken)

Deletes a previously stored secret.

SanitizeName(String)

Replaces any disallowed characters from the proposed secret name with an allowed substitution character. For example, if : is not an allowed secret name character, this method might replace use of that character with an underscore (‘_’).

SetSecretAsync(String, String, CancellationToken)

Adds or updates a secret with the given name so the application built by this project can access it at runtime.

Applies to