mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 01:25:37 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user