@sudoplatform/sudo-secure-communications
    Preparing search index...

    Class DefaultStorageModule

    The StorageModule is capable of managing multiple user sessions, ensuring data isolation across different handles (sessions).

    It should be storage-backend-agnostic to allow using the SDK in browser, Node.js or other environments with different storage requirements and capabilities.

    Implements

    Index

    Constructors

    Methods

    • closeHandleStorage when called, the associated HandleStorage object is removed from the cache, but data is not purged from storage.

      Parameters

      • handleId: string

        The handleId of the handle to close a storage for.

      Returns Promise<void>

    • deleteHandleStorage when called, the associated HandleStorage object is removed from the cache, and any data is purged from storage.

      Used for clearing data from storage when signing out.

      Parameters

      • handleId: string

        The handleId of the handle to delete a storage for.

      Returns Promise<void>

    • useHandleStorage is responsible for opening (creating new storage or constructing object for existing storage), caching and returning HandleStorage objects for each handleId.

      Each handle gets their dedicated HandleStorage object, which helps segmenting data from different sessions.

      Parameters

      • handleId: string

        The handleId of the handle to get a storage for.

      • OptionalstorePassphrase: string

        (optional) The passphrase to use for the storage.

      Returns Promise<HandleStorage | undefined>

      • The HandleStorage object for the handleId. If the storage provider is not available, undefined is returned.

      ⚠️ WARNING ⚠️

      If storePassphrase is not provided when the storage handle is first created, the local storage will be UNENCRYPTED.

      To enable encryption, storePassphrase must be passed on the very first call to this function — i.e., the first time this handle is initialized on a device.

      ⚠️ Once the storage has been initialized without encryption, it CANNOT be encrypted later by simply providing storePassphrase. Doing so will lead to storage malfunction. If this happens, you must delete the existing storage and recreate it with storePassphrase provided from the start.