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.
npm install --save @tkey/web-storage
import WebStorageModule from "@tkey/web-storage";
const webStorageModule = new WebStorageModule(params);
params
-
canUseFileStorage?
:boolean
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>;
}
With the WebStorageModule
, you've access to the following functions:
-
deviceShareStore
: TheShareStore
object to store. -
customDeviceInfo?
: Information about the device to store.
class ShareStore implements ISerializable {
share: Share;
polynomialID: PolynomialID;
constructor(share: Share, polynomialID: PolynomialID);
static fromJSON(value: StringifiedType): ShareStore;
toJSON(): StringifiedType;
}
interface ISerializable {
toJSON(): StringifiedType;
}
-
shareIndex
: The index of the share to store.
-
Promise<ShareStore>
: TheShareStore
object.