diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index ea4fd5b1e492a..ab3d567b7e826 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -70,6 +70,40 @@ declare module 'vscode' { export function registerDiffInformationCommand(command: string, callback: (diff: LineChange[], ...args: any[]) => any, thisArg?: any): Disposable; } + /** + * Namespace for handling credentials. + */ + export namespace credentials { + + /** + * Read a previously stored secret from the credential store. + * + * @param service The service of the credential. + * @param account The account of the credential. + * @return A promise for the secret of the credential. + */ + export function readSecret(service: string, account: string): Thenable; + + /** + * Write a secret to the credential store. + * + * @param service The service of the credential. + * @param account The account of the credential. + * @param secret The secret of the credential to write to the credential store. + * @return A promise indicating completion of the operation. + */ + export function writeSecret(service: string, account: string, secret: string): Thenable; + + /** + * Delete a previously stored secret from the credential store. + * + * @param service The service of the credential. + * @param account The account of the credential. + * @return A promise resolving to true if there was a secret for that service and account. + */ + export function deleteSecret(service: string, account: string): Thenable; + } + /** * Represents a color in RGBA space. */ diff --git a/src/vs/workbench/api/node/extHost.api.impl.ts b/src/vs/workbench/api/node/extHost.api.impl.ts index 0ad36fa49eb5d..cb2ee9b893bc1 100644 --- a/src/vs/workbench/api/node/extHost.api.impl.ts +++ b/src/vs/workbench/api/node/extHost.api.impl.ts @@ -520,7 +520,7 @@ export function createApiFactory( }; // namespace: credentials - const credentials = { + const credentials: typeof vscode.credentials = { readSecret(service: string, account: string): Thenable { return extHostCredentials.readSecret(service, account); }, @@ -544,6 +544,7 @@ export function createApiFactory( workspace, scm, debug, + credentials, // types CancellationTokenSource: CancellationTokenSource, CodeLens: extHostTypes.CodeLens, @@ -598,8 +599,8 @@ export function createApiFactory( Task: extHostTypes.Task, ConfigurationTarget: extHostTypes.ConfigurationTarget }; - if (extension.enableProposedApi && extension.isBuiltin) { - api['credentials'] = credentials; + if (!extension.enableProposedApi) { + delete api.credentials; // Instead of error to avoid #31854 } return api; };