Storage implementation based on StorageMock Provides a unified storage interface that works in both browser and non-browser environments In browser environments, data is persisted to localStorage as a backup

Constructors

  • Initializes storage and loads any existing keypair from localStorage if available

    Returns ShogunStorage

Properties

isTestMode: boolean
store: Map<string, any>
useLocalStorage: boolean

Methods

  • Clears all stored data from both memory and localStorage

    Returns void

  • Gets an item from storage

    Parameters

    • key: string

      The key to retrieve

    Returns null | string

    The stored value as a string, or null if not found

  • Gets the stored keypair asynchronously

    Returns Promise<any>

    Promise resolving to the keypair or null if not found

  • Gets the stored keypair synchronously

    Returns any

    The keypair or null if not found

  • Removes an item from both memory and localStorage if available

    Parameters

    • key: string

      The key to remove

    Returns void

  • Stores an item in both memory and localStorage if available

    Parameters

    • key: string

      The key to store under

    • value: string

      The value to store (must be JSON stringifiable)

    Returns void

  • Stores a keypair both in memory and localStorage if available

    Parameters

    • pair: any

      The keypair to store

    Returns Promise<void>