mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-28 16:39:00 +01:00
Finalize secrets API, closes #112249
This commit is contained in:
Vendored
+47
@@ -5821,6 +5821,11 @@ declare module 'vscode' {
|
||||
setKeysForSync(keys: string[]): void;
|
||||
};
|
||||
|
||||
/**
|
||||
* A storage utility for secrets.
|
||||
*/
|
||||
readonly secrets: SecretStorage;
|
||||
|
||||
/**
|
||||
* The uri of the directory containing the extension.
|
||||
*/
|
||||
@@ -5958,6 +5963,48 @@ declare module 'vscode' {
|
||||
update(key: string, value: any): Thenable<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The event data that is fired when a secret is added or removed.
|
||||
*/
|
||||
export interface SecretStorageChangeEvent {
|
||||
/**
|
||||
* The key of the secret that has changed.
|
||||
*/
|
||||
readonly key: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a storage utility for secrets, information that is
|
||||
* sensitive.
|
||||
*/
|
||||
export interface SecretStorage {
|
||||
/**
|
||||
* Retrieve a secret that was stored with key. Returns undefined if there
|
||||
* is no password matching that key.
|
||||
* @param key The key the secret was stored under.
|
||||
* @returns The stored value or `undefined`.
|
||||
*/
|
||||
get(key: string): Thenable<string | undefined>;
|
||||
|
||||
/**
|
||||
* Store a secret under a given key.
|
||||
* @param key The key to store the secret under.
|
||||
* @param value The secret.
|
||||
*/
|
||||
store(key: string, value: string): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Remove a secret from storage.
|
||||
* @param key The key the secret was stored under.
|
||||
*/
|
||||
delete(key: string): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Fires when a secret is stored or deleted.
|
||||
*/
|
||||
onDidChange: Event<SecretStorageChangeEvent>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a color theme kind.
|
||||
*/
|
||||
|
||||
Vendored
+1
-51
@@ -2507,57 +2507,7 @@ declare module 'vscode' {
|
||||
export function openExternal(target: Uri, options?: OpenExternalOptions): Thenable<boolean>;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region https://github.com/microsoft/vscode/issues/112249
|
||||
|
||||
/**
|
||||
* The event data that is fired when a secret is added or removed.
|
||||
*/
|
||||
export interface SecretStorageChangeEvent {
|
||||
/**
|
||||
* The key of the secret that has changed.
|
||||
*/
|
||||
readonly key: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a storage utility for secrets, information that is
|
||||
* sensitive.
|
||||
*/
|
||||
export interface SecretStorage {
|
||||
/**
|
||||
* Retrieve a secret that was stored with key. Returns undefined if there
|
||||
* is no password matching that key.
|
||||
* @param key The key the password was stored under.
|
||||
* @returns The stored value or `undefined`.
|
||||
*/
|
||||
get(key: string): Thenable<string | undefined>;
|
||||
|
||||
/**
|
||||
* Store a secret under a given key.
|
||||
* @param key The key to store the password under.
|
||||
* @param value The password.
|
||||
*/
|
||||
store(key: string, value: string): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Remove a secret from storage.
|
||||
* @param key The key the password was stored under.
|
||||
*/
|
||||
delete(key: string): Thenable<void>;
|
||||
|
||||
/**
|
||||
* Fires when a secret is set or deleted.
|
||||
*/
|
||||
onDidChange: Event<SecretStorageChangeEvent>;
|
||||
}
|
||||
|
||||
export interface ExtensionContext {
|
||||
readonly secrets: SecretStorage;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#endregionn
|
||||
|
||||
//#region https://github.com/Microsoft/vscode/issues/15178
|
||||
|
||||
|
||||
Reference in New Issue
Block a user