@seald-io/sdk-plugin-localstorage
v0.13.0
Published
This module is a plugin for the [Seald SDK : `@seald-io/sdk`](https://www.npmjs.com/package/@seald-io/sdk).
Downloads
10
Readme
@seald-io/sdk-plugin-localstorage
This module is a plugin for the Seald SDK : @seald-io/sdk
.
⚠️ 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.
The @seald-io/sdk-plugin-localstorage
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 })
For more information, visit our website : https://seald.io
For the full documentation, visit our documentation page : https://docs.seald.io/en/sdk/
© 2021 Seald SAS