# @oraichain/private-keys

> TKey Private Keys Module

Latest version **2.0.2-beta.0** (published 2023-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @oraichain/private-keys
pnpm add @oraichain/private-keys
yarn add @oraichain/private-keys
bun add @oraichain/private-keys
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2-beta.0 |
| Published | 2023-12-12 |
| First published | 2023-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 2.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Torus Labs |
| Maintainers | oraichain_official |

## Links

- npm: https://www.npmjs.com/package/@oraichain/private-keys
- Repository: https://github.com/@oraichain/web3-login
- Homepage: https://github.com/@oraichain/web3-login#readme
- Issues: https://github.com/@oraichain/web3-login/issues
- npm.io page: https://npm.io/package/@oraichain/private-keys

## Dependencies (4)

- [bn.js](https://npm.io/package/bn.js.md) ^5.2.1
- [randombytes](https://npm.io/package/randombytes.md) ^2.1.0
- [@oraichain/common-types](https://npm.io/package/@oraichain/common-types.md) ^2.0.2-beta.0
- [@toruslabs/tweetnacl-js](https://npm.io/package/@toruslabs/tweetnacl-js.md) ^1.0.3

## Recent versions

- 2.0.2-beta.0 (latest) — 2023-12-12
- 2.2.2 (next) — 2024-11-11
- 2.0.1-beta.2 (beta) — 2023-12-08
- 2.2.1 — 2024-10-24
- 2.2.0 — 2024-10-24
- 2.1.6 — 2024-10-24
- 2.1.5 — 2024-10-24
- 2.1.4 — 2024-10-23
- 2.1.3 — 2024-10-23
- 2.1.2 — 2024-09-26
- 2.1.1 — 2024-09-26
- 2.1.0 — 2024-09-16
- 2.0.5 — 2024-08-06
- 2.0.4 — 2024-05-23
- 2.0.1 — 2023-12-12
- … 39 more at https://npm.io/package/@oraichain/private-keys/versions

## README

# tKey Private Key Module

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

The oKey Private Key Module helps you add or remove the and password as a share for tkey. This module is the part of the [tKey SDK](https://github.com/@oraichain/web3-login/).

## Installation

```shell
npm install --save @oraichain/private-keys
```

## Initialization

#### Import the `PrivateKeyModule` class from `@oraichain/private-keys`

```javascript
import PrivateKeyModule from "@oraichain/private-keys";
```

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

```javascript
const privateKeyModule = new PrivateKeyModule();
```

### Returns

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

```ts
declare class PrivateKeyModule implements IModule {
  moduleName: string;
  tbSDK: ITKeyApi;
  privateKeyFormats: IPrivateKeyFormat[];
  constructor(formats: IPrivateKeyFormat[]);
  setModuleReferences(tbSDK: ITKeyApi): void;
  initialize(): Promise<void>;
  setPrivateKey(privateKeyType: string, privateKey?: BN): Promise<void>;
  getPrivateKeys(): Promise<IPrivateKeyStore[]>;
  getAccounts(): Promise<BN[]>;
}
```

## Usage

With the `PrivateKeyModule`, you've access to the following functions:

### Set Private Key

#### `setPrivateKey(privateKeyType: string, privateKey?: BN)`

- `privateKeyType`: The type of private key to set.
- `privateKey`: The private key to set.

### Get Private Keys

#### `getPrivateKeys()`

#### Return

- `Promise<IPrivateKeyStore[]>`- The private keys stored.

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