Skip to content

Commit

Permalink
Revert "Remove proposed credentials API (#31131)"
Browse files Browse the repository at this point in the history
This reverts commit abea60d.
  • Loading branch information
chrmarti committed Sep 1, 2017
1 parent 58be5e8 commit c738bbd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
34 changes: 34 additions & 0 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string | undefined>;

/**
* 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<void>;

/**
* 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<boolean>;
}

/**
* Represents a color in RGBA space.
*/
Expand Down
7 changes: 4 additions & 3 deletions src/vs/workbench/api/node/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export function createApiFactory(
};

// namespace: credentials
const credentials = {
const credentials: typeof vscode.credentials = {
readSecret(service: string, account: string): Thenable<string | undefined> {
return extHostCredentials.readSecret(service, account);
},
Expand All @@ -544,6 +544,7 @@ export function createApiFactory(
workspace,
scm,
debug,
credentials,
// types
CancellationTokenSource: CancellationTokenSource,
CodeLens: extHostTypes.CodeLens,
Expand Down Expand Up @@ -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;
};
Expand Down

0 comments on commit c738bbd

Please sign in to comment.