import type { KeyValueStore } from '@chat-app/shared/supabase';

// Tauri webview exposes a persistent per-app-identifier localStorage.
// Good enough for session tokens. Private keys go to Stronghold later.
export const localStorageAdapter: KeyValueStore = {
  async getItem(key: string): Promise<string | null> {
    return window.localStorage.getItem(key);
  },
  async setItem(key: string, value: string): Promise<void> {
    window.localStorage.setItem(key, value);
  },
  async removeItem(key: string): Promise<void> {
    window.localStorage.removeItem(key);
  },
};
