Set of methods to operate eitri-app data storage

Notes:

Storage data is not shared between different eitri-apps. Data is transmitted as a string and handled with JSON encoding/decoding. Pay attention to the size of the data to avoid affecting the experience.

Hierarchy

  • Storage

Methods

  • Stores a string in the eitri-app storage

    Example:

    await Eitri.storage.setItem('myDataKey', "myData")
    await Eitri.storage.setItem('mySecureDataKey', "mySecureData", {secure: true})
    await Eitri.storage.setItem('mySharedDataKey', "mySharedData", {shared: true})
    await Eitri.storage.setItem('mySharedSecureDataKey', "mySharedSecureData", {shared: true, secure: true})

    Parameters

    • key: string

      Key for registration

    • value: string

      Value to be saved

    • Optional options: StorageOptions

      Options for storage operation

      Compatibility Control

      • API LEVEL 1 - Functionality added
      • API LEVEL 33 - secure storage support added

    Returns Promise<void>

  • Stores an Object in the eitri-app storage

    Example:

    let myObject = {myData: 'valueOfMyData'}
    await Eitri.storage.setItemJson('myData', myObject)

    let mySecureObject = {mySecureData: 'valueOfMySecureData'}
    await Eitri.storage.setItemJson('mySecureData', mySecureObject, {secure: true})

    let mySharedObject = {mySharedData: 'valueOfMySharedData'}
    await Eitri.storage.setItemJson('mySharedData', mySharedObject, {shared: true})

    Parameters

    • key: string

      Key for registration

    • value: any

      JSON object to be saved

    • Optional options: StorageOptions

      Options for storage operation

      Compatibility Control

      • API LEVEL 1 - Functionality added
      • API LEVEL 33 - secure storage support added

    Returns Promise<void>

  • Retrieves a stored string from the eitri-app storage

    Example:

    const storedValue = await Eitri.storage.getItem('myData')
    const secureStoredValue = await Eitri.storage.getItem('mySecureData', {secure: true})
    const sharedStoredValue = await Eitri.storage.getItem('mySharedData', {shared: true})
    const sharedSecureStoredValue = await Eitri.storage.getItem('mySharedSecureData', {shared: true, secure: true})

    Compatibility Control

    • API LEVEL 1 - Functionality added
    • API LEVEL 33 - secure storage support added

    Parameters

    • key: string

      Registration key

    • Optional options: StorageOptions

      Options for storage operation

    Returns Promise<string>

  • Retrieves a stored Object from the eitri-app storage

    Example:

    const myObject = await Eitri.storage.getItemJson('myData')
    const mySecureObject = await Eitri.storage.getItemJson('mySecureData', {secure: true})
    const mySharedObject = await Eitri.storage.getItemJson('mySharedData', {shared: true})
    const mySharedSecureObject = await Eitri.storage.getItemJson('mySharedSecureData', {shared: true, secure: true})

    Parameters

    • key: string

      Registration key

    • Optional options: StorageOptions

      Options for storage operation

      Compatibility Control

      • API LEVEL 1 - Functionality added
      • API LEVEL 33 - secure storage support added

    Returns Promise<any>

  • Deletes the data associated with the specified key from the eitri-app storage

    Example:

    await Eitri.storage.removeItem('myData')
    await Eitri.storage.removeItem('mySecureData', {secure: true})
    await Eitri.storage.removeItem('mySharedData', {shared: true})
    await Eitri.storage.removeItem('mySharedSecureData', {shared: true, secure: true})

    Compatibility Control

    • API LEVEL 1 - Functionality added
    • API LEVEL 33 - secure storage support added

    Parameters

    • key: string

      Registration key

    • Optional options: StorageOptions

      Options for storage operation

    Returns Promise<void>

  • Clears all data created by the respective eitri-app from storage

    Note:

    This method does not clear other data saved by other eitri-apps

    Example:

    await Eitri.storage.clear()
    

    Compatibility Control

    • API LEVEL 1 - Functionality added
    • API LEVEL 33 - secure storage support added

    Parameters

    Returns Promise<void>

  • Clears all data created by the respective eitri-app from all storage namespaces (normal, shared, secure, and secure+shared)

    Note:

    This method does not clear other data saved by other eitri-apps

    Example:

    await Eitri.storage.clearAll()
    

    Compatibility Control

    • API LEVEL 33 - Functionality added

    Returns Promise<void>

  • Retrieves all registration keys stored by the respective eitri-app from storage

    Example:

    const myKeys = await Eitri.storage.keys()
    const mySharedDataKeys = await Eitri.storage.keys({shared: true})
    const mySecureDataKeys = await Eitri.storage.keys({secure: true})

    Compatibility Control

    • API LEVEL 1 - Functionality added
    • API LEVEL 33 - secure storage support added

    Parameters

    • Optional options: StorageOptions

      type of data whose associated keys are to be retrieved (keys for shared data, secure data, etc.).

    Returns Promise<string[]>

  • Retrieves all registration keys stored by the respective eitri-app from all storage namespaces (normal, shared, secure, and secure+shared)

    Each entry includes the key name and its namespace flags (secure, shared).

    Example:

    const allKeys = await Eitri.storage.keysAll()
    // [{ key: "token", secure: false, shared: false }, { key: "secret", secure: true, shared: false }, ...]

    Compatibility Control

    • API LEVEL 33 - Functionality added

    Returns Promise<StorageKeyEntry[]>

Generated using TypeDoc