# asymmetric-diffie-hellman

> Asymmetric key echange

Latest version **0.0.10** (published 2020-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install asymmetric-diffie-hellman
pnpm add asymmetric-diffie-hellman
yarn add asymmetric-diffie-hellman
bun add asymmetric-diffie-hellman
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2020-03-22 |
| First published | 2019-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Robin Bron |
| Maintainers | finwo |

## Links

- npm: https://www.npmjs.com/package/asymmetric-diffie-hellman
- Repository: https://github.com/finwo/asymmetric-diffie-hellman-js
- Homepage: https://github.com/finwo/asymmetric-diffie-hellman-js#readme
- Issues: https://github.com/finwo/asymmetric-diffie-hellman-js/issues
- npm.io page: https://npm.io/package/asymmetric-diffie-hellman

## Dependencies (1)

- [big-integer](https://npm.io/package/big-integer.md) ^1.6.48

## Recent versions

- 0.0.10 (latest) — 2020-03-22
- 0.0.9 — 2020-01-13
- 0.0.8 — 2020-01-03
- 0.0.7 — 2020-01-03
- 0.0.6 — 2019-11-01
- 0.0.5 — 2019-11-01
- 0.0.4 — 2019-11-01
- 0.0.3 — 2019-11-01
- 0.0.2 — 2019-10-31
- 0.0.1 — 2019-10-30

## README

# asymmetric diffie hellman

Asymmetric key echange

This package was designed as a placeholder for a future quantum-resistant key
exchange algorithm once that is proven-secure.

## Installation

```sh
npm install 
```

## Usage

First we'll need to import the package

```js
import {KeyPair} from 'asymmetric-diffie-hellman';
```

### Generating a keypair

Let's generate a key pair for the sender (alice) and the receiver (bob)

```js
const Alice = new KeyPair();
const Bob   = new KeyPair();
```

### Getting the public key to share

```js
const AlicePublic = Alice.pubkey;
const BobPublic   = Bob.pubkey;
```

### Generating encryption key seed for transmitting

When transmitting a message from Alice to Bob, Alice will need to include the
new key generated in a non-encrypted manner. Using this new key, Bob can
generate the same secret as Alice had when encrypting the message.

```js
const AliceTx = Alice.keyExchange(BobPublic);

// Include AliceTx.key in the non-encrypted part of your message
// Use AliceTx.secret to generate the encryption key for your symmetric encryption algorithm
```

### Generating encryption key seed for receiving

```js
const BobRx = Bob.keyExchange(AliceTx.key);

// Use BobRx.secret to generate the encryption key for your symmetric encryption algorith
```

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