oKey Chrome Storage Module
The oKey Chrome Storage Module helps you store and recall key shares in the chrome extension storage. This module is the part of the oKey SDK.
Installation
npm install --save @oraichain/chrome-storage
Initialization
ChromeExtensionStorageModule
class from @oraichain/chrome-storage
Import the import ChromeExtensionStorageModule from "@oraichain/chrome-storage";
ChromeExtensionStorageModule
class to a variable
Assign the const chromeStorageModule = new ChromeExtensionStorageModule();
Returns
The ChromeExtensionStorageModule
class returns an object with the following properties:
class ChromeExtensionStorageModule implements IModule {
moduleName: string;
tbSDK: ITKeyApi;
constructor();
setModuleReferences(tbSDK: ITKeyApi): void;
initialize(): Promise<void>;
storeDeviceShare(deviceShareStore: ShareStore, customDeviceInfo?: StringifiedType): Promise<void>;
storeShareOnChromeExtensionStorage(share: ShareStore): Promise<void>;
getStoreFromChromeExtensionStorage(): Promise<ShareStore>;
inputShareFromChromeExtensionStorage(): Promise<void>;
}
Usage
With the ChromeExtensionStorageModule
, you've access to the following functions:
Storing a Device Share
storeDeviceShare(deviceShareStore, customDeviceInfo?)
-
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 Chrome Extension Storage
storeShareOnChromeExtensionStorage(share)
-
share
: TheShareStore
object to store.
Get a ShareStore from Chrome Extension Storage
getStoreFromChromeExtensionStorage()
Return
-
Promise<ShareStore>
: TheShareStore
object.