Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)

This commit is contained in:
Cory Rivera
2021-08-25 16:28:29 -07:00
committed by GitHub
parent ab1112bfb3
commit cb7b7da0a4
1752 changed files with 59525 additions and 33878 deletions

View File

@@ -28,13 +28,11 @@ export type Keytar = {
deletePassword: typeof keytarType['deletePassword'];
};
const SERVICE_ID = `github.auth`;
export class Keychain {
constructor(private context: vscode.ExtensionContext) { }
constructor(private context: vscode.ExtensionContext, private serviceId: string) { }
async setToken(token: string): Promise<void> {
try {
return await this.context.secrets.store(SERVICE_ID, token);
return await this.context.secrets.store(this.serviceId, token);
} catch (e) {
// Ignore
Logger.error(`Setting token failed: ${e}`);
@@ -48,7 +46,7 @@ export class Keychain {
async getToken(): Promise<string | null | undefined> {
try {
return await this.context.secrets.get(SERVICE_ID);
return await this.context.secrets.get(this.serviceId);
} catch (e) {
// Ignore
Logger.error(`Getting token failed: ${e}`);
@@ -58,7 +56,7 @@ export class Keychain {
async deleteToken(): Promise<void> {
try {
return await this.context.secrets.delete(SERVICE_ID);
return await this.context.secrets.delete(this.serviceId);
} catch (e) {
// Ignore
Logger.error(`Deleting token failed: ${e}`);