/**
 * Shared types for the secureStorage subsystem. Reconstructed from
 * consumer usages (plainTextStorage, macOsKeychainStorage,
 * fallbackStorage, index) after the original file was lost.
 */

/**
 * Arbitrary key/value blob persisted by a SecureStorage impl.
 * Consumers stringify + parse this themselves; the storage layer
 * treats it as opaque JSON.
 */
export type SecureStorageData = Record<string, unknown>

/**
 * A pluggable credential store. Implementations provide sync + async
 * read paths (for boot-time vs runtime access), plus update/delete.
 * The `name` field is used in logs and the fallback composition name.
 */
export interface SecureStorage {
  name: string
  read(): SecureStorageData | null
  readAsync(): Promise<SecureStorageData | null>
  update(data: SecureStorageData): { success: boolean; warning?: string }
  delete(): boolean
}
