|
5 | 5 |
|
6 | 6 | import * as vscode from 'vscode'
|
7 | 7 | import { CodeCatalystClient } from '../shared/clients/codecatalystClient'
|
8 |
| -import { getIdeProperties, isCloud9 } from '../shared/extensionUtilities' |
| 8 | +import { getIdeProperties } from '../shared/extensionUtilities' |
9 | 9 | import {
|
10 | 10 | Auth,
|
11 | 11 | isBuilderIdConnection,
|
@@ -174,41 +174,6 @@ export class CodeCatalystAuthenticationProvider {
|
174 | 174 | private static instance: CodeCatalystAuthenticationProvider
|
175 | 175 |
|
176 | 176 | public static fromContext(ctx: Pick<vscode.ExtensionContext, 'secrets' | 'globalState'>) {
|
177 |
| - const secrets = isCloud9() ? new SecretMemento(ctx.globalState) : ctx.secrets |
178 |
| - |
179 |
| - return (this.instance ??= new this(new CodeCatalystAuthStorage(secrets), ctx.globalState)) |
180 |
| - } |
181 |
| -} |
182 |
| - |
183 |
| -/** |
184 |
| - * `secrets` API polyfill for C9. |
185 |
| - * |
186 |
| - * For development only. Do NOT use this for anything else. |
187 |
| - */ |
188 |
| -class SecretMemento implements vscode.SecretStorage { |
189 |
| - private readonly onDidChangeEmitter = new vscode.EventEmitter<vscode.SecretStorageChangeEvent>() |
190 |
| - public readonly onDidChange = this.onDidChangeEmitter.event |
191 |
| - |
192 |
| - public constructor(private readonly memento: vscode.Memento) {} |
193 |
| - |
194 |
| - public async get(key: string): Promise<string | undefined> { |
195 |
| - return this.getSecrets()[key] |
196 |
| - } |
197 |
| - |
198 |
| - public async store(key: string, value: string): Promise<void> { |
199 |
| - const current = this.getSecrets() |
200 |
| - await this.memento.update('__secrets', { ...current, [key]: value }) |
201 |
| - this.onDidChangeEmitter.fire({ key }) |
202 |
| - } |
203 |
| - |
204 |
| - public async delete(key: string): Promise<void> { |
205 |
| - const current = this.getSecrets() |
206 |
| - delete current[key] |
207 |
| - await this.memento.update('__secrets', current) |
208 |
| - this.onDidChangeEmitter.fire({ key }) |
209 |
| - } |
210 |
| - |
211 |
| - private getSecrets(): Record<string, string | undefined> { |
212 |
| - return this.memento.get('__secrets', {}) |
| 177 | + return (this.instance ??= new this(new CodeCatalystAuthStorage(ctx.secrets), ctx.globalState)) |
213 | 178 | }
|
214 | 179 | }
|
0 commit comments