import { SequencerByKey } from "@codingame/monaco-vscode-api/vscode/vs/base/common/async"; import { IEncryptionService } from "@codingame/monaco-vscode-api/vscode/vs/platform/encryption/common/encryptionService.service"; import { IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service"; import { Emitter, Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service"; import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { ISecretStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service"; /** * The storage key prefix used for all secrets. */ export declare const SECRET_STORAGE_PREFIX = "secret://"; /** * Builds the full storage key for a secret. */ export declare function secretStorageKey(key: string): string; /** * Reads an encrypted secret from storage and decrypts it. * @param key The secret key (without the `secret://` prefix). * @param storageGet A function that reads the encrypted value from storage given a full storage key. * @param decrypt A function that decrypts the encrypted value. * @param logService Optional logger for trace output. */ export declare function readEncryptedSecret(key: string, storageGet: (fullKey: string) => string | undefined, decrypt: (value: string) => Promise, logService?: ILogService): Promise; /** * Encrypts a secret value and writes it to storage. * @param key The secret key (without the `secret://` prefix). * @param value The plaintext secret value. * @param storageSet A function that writes the encrypted value to storage given a full storage key. * @param encrypt A function that encrypts the plaintext value. * @param logService Optional logger for trace output. */ export declare function writeEncryptedSecret(key: string, value: string, storageSet: (fullKey: string, encrypted: string) => void, encrypt: (value: string) => Promise, logService?: ILogService): Promise; /** * Secret keys that should be shared between the VS Code app and the agents app. * When the agents app starts and doesn't have these secrets, it requests them * from VS Code via crossAppIPC. */ export declare const CROSS_APP_SHARED_SECRET_KEYS: readonly string[]; export interface ISecretStorageProvider { type: "in-memory" | "persisted" | "unknown"; get(key: string): Promise; set(key: string, value: string): Promise; delete(key: string): Promise; keys?(): Promise; } export declare class BaseSecretStorageService extends Disposable implements ISecretStorageService { private readonly _useInMemoryStorage; private _storageService; protected _encryptionService: IEncryptionService; protected readonly _logService: ILogService; readonly _serviceBrand: undefined; protected readonly onDidChangeSecretEmitter: Emitter; readonly onDidChangeSecret: Event; protected readonly _sequencer: SequencerByKey; private _type; private readonly _onDidChangeValueDisposable; constructor(_useInMemoryStorage: boolean, _storageService: IStorageService, _encryptionService: IEncryptionService, _logService: ILogService); protected useSharedStorage(key: string): boolean; /** * @Note initialize must be called first so that this can be resolved properly * otherwise it will return 'unknown'. */ get type(): "unknown" | "in-memory" | "persisted"; private _lazyStorageService; protected get resolvedStorageService(): Promise; get(key: string): Promise; set(key: string, value: string): Promise; delete(key: string): Promise; keys(): Promise; private getValueFromStorage; private setValueInStorage; private initialize; protected reinitialize(): void; private onDidChangeValue; }