# @thresholdkey/chrome-storage

> TKey Chrome Storage Module

Latest version **1.0.12** (published 2023-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @thresholdkey/chrome-storage
pnpm add @thresholdkey/chrome-storage
yarn add @thresholdkey/chrome-storage
bun add @thresholdkey/chrome-storage
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2023-06-28 |
| First published | 2023-04-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 174.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 181 |
| Author | Torus Labs |
| Maintainers | duongyt1998 |

## Links

- npm: https://www.npmjs.com/package/@thresholdkey/chrome-storage
- Repository: https://github.com/tkey/tkey
- Homepage: https://github.com/tkey/tkey#readme
- Issues: https://github.com/tkey/tkey/issues
- npm.io page: https://npm.io/package/@thresholdkey/chrome-storage

## Dependencies (2)

- [webextension-polyfill](https://npm.io/package/webextension-polyfill.md) ^0.10.0
- [@thresholdkey/common-types](https://npm.io/package/@thresholdkey/common-types.md) ^1.0.12

## Recent versions

- 1.0.12 (latest) — 2023-06-28
- 1.0.11 — 2023-06-21
- 1.0.10 — 2023-06-21
- 1.0.9 — 2023-05-11
- 1.0.8 — 2023-05-05
- 1.0.7 — 2023-04-27
- 1.0.6 — 2023-04-19
- 1.0.4 — 2023-04-19
- 1.0.3 — 2023-04-19
- 1.0.2 — 2023-04-18
- 1.0.1 — 2023-04-18
- 1.0.0 — 2023-04-18

## README

# tKey Chrome Storage Module

[![npm version](https://img.shields.io/npm/v/@thresholdkey/chrome-storage?label=%22%22)](https://www.npmjs.com/package/@thresholdkey/chrome-storage/v/latest)                  [![minzip](https://img.shields.io/bundlephobia/minzip/@thresholdkey/chrome-storage?label=%22%22)](https://bundlephobia.com/result?p=@thresholdkey/chrome-storage@latest) 

The tKey Chrome Storage Module helps you store and recall key shares in the chrome extension storage. This module is the part of the [tKey SDK](https://github.com/tkey/tkey/).

## Installation

```shell
npm install --save @thresholdkey/chrome-storage
```

## Initialization

#### Import the `ChromeExtensionStorageModule` class from `@thresholdkey/chrome-storage`

```javascript
import ChromeExtensionStorageModule from "@thresholdkey/chrome-storage";
```

#### Assign the `ChromeExtensionStorageModule` class to a variable

```javascript
const chromeStorageModule = new ChromeExtensionStorageModule();
```

### Returns

The `ChromeExtensionStorageModule` class returns an object with the following properties:

```ts
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`: The `ShareStore` object to store.
- `customDeviceInfo?`: Information about the device to store.

#### `ShareStore`

```ts
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`: The [`ShareStore`](#sharestore) object to store.

### Get a ShareStore from Chrome Extension Storage

##### `getStoreFromChromeExtensionStorage()`

#### Return

- `Promise<ShareStore>`: The [`ShareStore`](#sharestore) object.

---
_Source: https://npm.io/package/@thresholdkey/chrome-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
