# @seald-io/sdk-plugin-localstorage

This module is a plugin for the Seald SDK : @seald-io/sdk (opens new window).

⚠️ This module is deprecated. You probably want to use a persistent database instead: see https://docs.seald.io/en/sdk/guides/4-identities.html#persistent-local-database (opens new window).

The @seald-io/sdk-plugin-localstorage (opens new window) module allows to store the Seald identity in the browser's localStorage, encrypted by a localStorageKey.

For the localStorageKey, you can either use a user password, or a random string stored by your back-end and given after authentication.

This module exposes a function, that takes prefix as argument, and returns a SDKPlugin which can be passed to the SealdSDK constructor.

When the Seald SDK is passed this plugin, the SealdSDK instance is modified to have a localStorage property, which exposes the PluginLocalStorage interface.

Example:

import SealdSDK from '@seald-io/sdk-web'
import SealdSDKPluginLocalStorage from '@seald-io/sdk-plugin-localstorage'

const seald = SealdSDK({
  appId,
  plugins: [SealdSDKPluginLocalStorage()] // passing the plugin to SealdSDK
})
await seald.initialize()

// Creating a Seald identity
await seald.initiateIdentity({ userId, userLicenseToken })
// The SealdSDK instance now has a `localStorage` property : we can use `saveIdentity`
await seald.localStorage.saveIdentity({ userId, localStorageKey })

# Table of contents

# Interfaces

# Type aliases

# Properties

# Type aliases

# KeyStoreLocalStorage

Ƭ KeyStoreLocalStorage: Object

Internal interface to the LocalStorage.

WARNING: Do not use directly.

# Type declaration

Name Type
push (appId: string, userId: string, localStorageKey: string, data: Buffer) => Promise<void>
search (appId: string, userId: string, localStorageKey: string) => Promise<Buffer>

# Properties

# default

default: (prefix: string) => SDKPlugin

# Type declaration

▸ (prefix?): SDKPlugin

# Parameters
Name Type Default value Description
prefix string 'SealdSDK' Optional. Prefix to add to identities stored in localStorage. Defaults to 'SealdSDK'.
# Returns

SDKPlugin