All files / omnium-gatherum/src/controllers/storage types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39                                                                             
import type { Json } from '@metamask/utils';
 
/**
 * Low-level storage adapter interface.
 * Wraps platform-specific storage APIs (e.g., chrome.storage.local).
 */
export type StorageAdapter = {
  /**
   * Get a value from storage.
   *
   * @param key - The storage key.
   * @returns The stored value, or undefined if not found.
   */
  get: <Value extends Json>(key: string) => Promise<Value | undefined>;
 
  /**
   * Set a value in storage.
   *
   * @param key - The storage key.
   * @param value - The value to store.
   */
  set: (key: string, value: Json) => Promise<void>;
 
  /**
   * Delete a value from storage.
   *
   * @param key - The storage key.
   */
  delete: (key: string) => Promise<void>;
 
  /**
   * Get all keys matching a prefix.
   *
   * @param prefix - Optional prefix to filter keys.
   * @returns Array of matching keys.
   */
  keys: (prefix?: string) => Promise<string[]>;
};