12.1.0 • Published 1 month ago

@tkey/web-storage v12.1.0

Weekly downloads
60
License
MIT
Repository
github
Last release
1 month ago

tKey Web Storage Module

npm version minzip

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: The ShareStore 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

12.1.0

1 month ago

10.0.0

10 months ago

12.0.0

7 months ago

11.0.2

9 months ago

11.0.3

8 months ago

11.0.0

9 months ago

10.1.0

10 months ago

8.1.0-alpha.0

1 year ago

9.0.0

1 year ago

7.4.0

1 year ago

8.0.2-alpha.0

1 year ago

7.3.0

1 year ago

8.0.5-alpha.0

1 year ago

8.0.3-alpha.0

1 year ago

8.0.7-alpha.0

1 year ago

8.0.4-alpha.0

1 year ago

8.0.6-alpha.0

1 year ago

8.0.0-alpha.0

1 year ago

7.2.0

1 year ago

7.1.0

1 year ago

6.1.0

2 years ago

6.2.0

2 years ago

7.0.0

2 years ago

6.0.0

2 years ago

5.1.4

2 years ago

5.1.3

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

5.0.0

2 years ago

4.4.0-alpha.0

3 years ago

4.4.0-alpha.4

3 years ago

4.4.0-alpha.3

3 years ago

4.4.0-alpha.2

3 years ago

4.4.0-alpha.1

3 years ago

4.4.0

3 years ago

4.4.0-y.0

3 years ago

4.3.0

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.1.1

3 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

3.14.1

3 years ago

3.14.2

3 years ago

4.0.0

3 years ago

3.14.0

3 years ago

3.13.0

3 years ago

3.12.1

3 years ago

3.12.0

3 years ago

3.11.1

3 years ago

3.11.0

3 years ago

3.10.0

3 years ago

3.9.1

3 years ago

3.9.0

3 years ago

3.8.1

3 years ago

3.8.0

3 years ago

3.7.0

3 years ago

3.6.5

3 years ago

3.6.4

3 years ago

3.6.2

3 years ago

3.6.3

3 years ago

3.6.1

3 years ago

3.6.0

3 years ago

3.5.0

3 years ago

3.4.0

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.1.3

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago