secrets.ts ×6

Frontier kind: Code frontier

unlabeled · c_d1af004f33f9

7 tests · 13079 LOC · 52 files · introduces 0 tests · 31 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges31 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1936 ranges13079 lines · 52 files · Browse complete extent
All tests (intent)
7 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 31 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/secrets/common/secrets.ts 31 introduced LOC · 6 ranges

Open complete file

33 * @param logService Optional logger for trace output.
34 */
35 > export async function readEncryptedSecret( secrets.ts
36 > key: string,
37 > storageGet: (fullKey: string) => string | undefined,
38 > decrypt: (value: string) => Promise<string>,
39 > logService?: ILogService,
40 > ): Promise<string | undefined> {
41 > const fullKey = secretStorageKey(key);
42 > logService?.trace('[secrets] getting secret for key:', fullKey);
43 > const encrypted = storageGet(fullKey);
44 > if (!encrypted) {
45 logService?.trace('[secrets] no secret found for key:', fullKey);
46 return undefined;
47 }
48 > logService?.trace('[secrets] decrypting secret for key:', fullKey); secrets.ts
49 > const result = await decrypt(encrypted);
50 > logService?.trace('[secrets] decrypted secret for key:', fullKey);
51 > return result;
52 > }
53
54 /**
138
139 get(key: string): Promise<string | undefined> {
140 > return this._sequencer.queue(key, async () => { secrets.ts
141 > const storageService = await this.resolvedStorageService;
142 >
143 > try {
144 > return await readEncryptedSecret(
145 > key,
146 > (fullKey) => this.getValueFromStorage(key, fullKey, storageService),
147 > // If the storage service is in-memory, we don't need to decrypt
148 > this._type === 'in-memory' ? (v) => Promise.resolve(v) : (v) => this._encryptionService.decrypt(v),
149 > this._logService,
150 > );
151 > } catch (e) {
152 this._logService.error(e);
153 this.delete(key);
154 return undefined;
155 }
156 > }); secrets.ts
157 > }
158
159 set(key: string, value: string): Promise<void> {
200
201 private getValueFromStorage(key: string, fullKey: string, storageService: IStorageService): string | undefined {
202 > if (this.useSharedStorage(key)) { secrets.ts
203 this._logService.trace(`[SecretStorageService] Fetching value for cross-app shared secret: ${fullKey}`);
204 return storageService.get(fullKey, StorageScope.APPLICATION_SHARED);
205 }
206 return storageService.get(fullKey, StorageScope.APPLICATION);
207 > } secrets.ts
208
209 private setValueInStorage(key: string, fullKey: string, value: string, storageService: IStorageService): void {