From fdaff37099e7db7e39d4f5676f18b99dd3a5c740 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Wed, 30 Oct 2024 15:19:24 -0700 Subject: [PATCH] Add Secret Storage call out to extension author docs (#7730) ref https://github.com/microsoft/vscode/issues/213903 --- api/extension-capabilities/common-capabilities.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/extension-capabilities/common-capabilities.md b/api/extension-capabilities/common-capabilities.md index 1ae6bbfac..7e161c61c 100644 --- a/api/extension-capabilities/common-capabilities.md +++ b/api/extension-capabilities/common-capabilities.md @@ -36,12 +36,13 @@ An extension can register custom Context Menu items that will be displayed in di ## Data Storage -There are four options for storing data: +There are five options for storing data: - [`ExtensionContext.workspaceState`](/api/references/vscode-api#ExtensionContext.workspaceState): A workspace storage where you can write key/value pairs. VS Code manages the storage and will restore it when the same workspace is opened again. - [`ExtensionContext.globalState`](/api/references/vscode-api#ExtensionContext.globalState): A global storage where you can write key/value pairs. VS Code manages the storage and will restore it for each extension activation. You can selectively synchronize key/value pairs in global storage by setting the keys for sync using `setKeysForSync` method on `globalState`. - [`ExtensionContext.storageUri`](/api/references/vscode-api#ExtensionContext.storageUri): A workspace specific storage URI pointing to a local directory where your extension has read/write access. This is a good option if you need to store large files that are accessible only from the current workspace. - [`ExtensionContext.globalStorageUri`](/api/references/vscode-api#ExtensionContext.globalStorageUri): A global storage URI pointing to a local directory where your extension has read/write access. This is a good option if you need to store large files that are accessible from all workspaces. +- [`ExtensionContext.secrets`](/api/references/vscode-api#ExtensionContext.secrets): A global storage for secrets (or any information that is sensitive) that will be encrypted. These are not synced across machines. For VS Code desktop, this leverages Electron's [safeStorage API](https://www.electronjs.org/docs/latest/api/safe-storage). For VS Code for the Web, this uses a Double Key Encryption (DKE) implementation. The extension context is available to the `activate` function in the [Extension Entry File](/api/get-started/extension-anatomy#extension-entry-file).