@tkey/web-storage v12.1.0
tKey Web Storage Module
The tKey Web Storage Module helps you store and recall key shares in the from local and file storage. This module is the part of the tKey SDK.
Installation
npm install --save @tkey/web-storage
Initialization
Import the WebStorageModule
class from @tkey/web-storage
import WebStorageModule from "@tkey/web-storage";
Assign the WebStorageModule
class to a variable
const webStorageModule = new WebStorageModule(params);
Parameters
params
canUseFileStorage?
:boolean
Returns
The WebStorageModule
class returns an object with the following properties:
class WebStorageModule implements IModule {
moduleName: string;
tbSDK: ITKeyApi;
canUseFileStorage: boolean;
constructor(canUseFileStorage?: boolean);
setFileStorageAccess(): Promise<void>;
setModuleReferences(tbSDK: ITKeyApi): void;
initialize(): Promise<void>;
storeDeviceShare(deviceShareStore: ShareStore, customDeviceInfo?: StringifiedType): Promise<void>;
storeDeviceShareOnFileStorage(shareIndex: BNString): Promise<void>;
getDeviceShare(): Promise<ShareStore>;
inputShareFromWebStorage(): Promise<void>;
}
Usage
With the WebStorageModule
, you've access to the following functions:
Store Device Share
storeDeviceShare(deviceShareStore: ShareStore, customDeviceInfo?: StringifiedType)
deviceShareStore
: TheShareStore
object to store.customDeviceInfo?
: Information about the device to store.
ShareStore
class ShareStore implements ISerializable {
share: Share;
polynomialID: PolynomialID;
constructor(share: Share, polynomialID: PolynomialID);
static fromJSON(value: StringifiedType): ShareStore;
toJSON(): StringifiedType;
}
interface ISerializable {
toJSON(): StringifiedType;
}
Storing a Share on File Storage
storeDeviceShareOnFileStorage(shareIndex)
shareIndex
: The index of the share to store.
Get a ShareStore from Storage
getDeviceShare()
Return
Promise<ShareStore>
: TheShareStore
object.
1 month ago
10 months ago
7 months ago
9 months ago
8 months ago
9 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago