Skip to main content

KeybanLocalStorage

KeybanLocalStorage

This class implements the IKeybanStorage interface using the localStorage Web API. It provides methods to get and save client shares to localStorage.

Remarks

This storage solution is intended for development environments only and should not be used in production due to the limited security of localStorage. LocalStorage provides no encryption or protection against cross-site scripting (XSS) attacks, making it unsuitable for storing sensitive data in a production environment. Ensure to use a more secure storage solution for production deployments.

Implements

Constructors

new KeybanLocalStorage()

new KeybanLocalStorage(): KeybanLocalStorage

The constructor of the KeybanLocalStorage class. Initializes the storage provider and checks for the presence of the localStorage API in the environment.

Returns

KeybanLocalStorage

Throws

Error if the environment does not support the localStorage Web API.

Defined in

packages/sdk-react/src/storages/localStorage.ts:21

Methods

get()

get(key): Promise<null | string>

Retrieves a value from localStorage. This method fetches the stored value using the provided key.

Parameters

key: string

The key used to retrieve the value.

Returns

Promise<null | string>

  • A promise that resolves to the value, or null if not found.

Implementation of

IKeybanStorage.get

Defined in

packages/sdk-react/src/storages/localStorage.ts:35


set()

set(key, value): Promise<void>

Saves a value to localStorage. This method stores the value using the provided key.

Parameters

key: string

The key used to save the value.

value: string

The value to be saved.

Returns

Promise<void>

  • A promise that resolves when the value is successfully saved.

Implementation of

IKeybanStorage.set

Defined in

packages/sdk-react/src/storages/localStorage.ts:48