# dht-storejs

> A simple tool to store and retrieve key/value pair from the BitTorrent DHT

Latest version **1.0.1** (published 2017-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install dht-storejs
pnpm add dht-storejs
yarn add dht-storejs
bun add dht-storejs
```

Provides the command `dht-storejs`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-09 |
| First published | 2017-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | r2d2 |
| Maintainers | 01btc10 |

## Links

- npm: https://www.npmjs.com/package/dht-storejs
- npm.io page: https://npm.io/package/dht-storejs

## Dependencies (3)

- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [bittorrent-dht](https://npm.io/package/bittorrent-dht.md) ^7.6.0
- [bittorrent-dht-store-keypair](https://npm.io/package/bittorrent-dht-store-keypair.md) ^3.0.2

## Recent versions

- 1.0.1 (latest) — 2017-08-09
- 1.0.0 — 2017-08-09

## README

# dht-storejs

A simple tool to store and retrieve key/value pair from the BitTorrent DHT

## Installation

```sh
$ npm install -g dht-storejs
```

### Immutable value

The key is always the hash of the value.

- Put a value

  ```sh
  $ dht-storejs put "Hello dht!" 
  put result: 04e66123a7c9315ead0c1a74c2e4e9ab46c1d621
  ```

### Mutable value

The key is always the hash of the public key used to sign the value even if the value change.

- Generate a new signing key

```sh
$ dht-storejs genkey 
{"publicKey":"458cfbacbe0ed921ee17324633cf1fb6965a4edaa336c016dd7b31871339db49","secretKey":"d03310567e3280f55285deaf1da21761410447f99c60625c23b7855a68f03d75bac657a0fb0a5f6f209922376e65f96ccab6df507d204f71c28ac71a777e2f98"}
```

- Put or update a value using the key in keypair.json:

```sh
$ dht-storejs put keypair.json "Some mutable value..." 
put result: a6f0f9b9523acfc5562409e714d9dcaff156d715`
```

### Search a key

```sh
$ dht-storejs get 04e66123a7c9315ead0c1a74c2e4e9ab46c1d621 
get result: Hello dht!`
$ dht-storejs get a6f0f9b9523acfc5562409e714d9dcaff156d715
get result: Some mutable value...
```

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