# diffie-hellman-ts

> Diffie-hellman key exchange implementation in typescript.

Latest version **1.0.0** (published 2021-04-03) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-04-03 |
| First published | 2021-04-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Willyan Antunes |
| Maintainers | willyandan |
| Keywords | diffie, hellman, diffie-hellman, key exchange, typescript |

## Links

- npm: https://www.npmjs.com/package/diffie-hellman-ts
- Repository: https://github.com/willyandan/diffie-hellman-key-exchange
- Homepage: https://github.com/willyandan/diffie-hellman-key-exchange#readme
- Issues: https://github.com/willyandan/diffie-hellman-key-exchange/issues
- npm.io page: https://npm.io/package/diffie-hellman-ts

## Dependencies (1)

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

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-04-03
- 0.0.1 — 2021-04-03

## README

# Diffie Hellman Key Exchange
Simple implementation of DHKE using typescript

the prime and the generator number are from [RFC 3526](https://tools.ietf.org/html/rfc3526)

## Instaling
using NPM:  
```
npm i diffie-hellman-ts
```

using Yarn:
```
yarn add diffie-hellman-ts
```

## How to use
```typescript
import { Client } from 'diffie-hellman-ts'
const alice = new Client()
const bob = new Client()

const alicePublicsNumber = alice.generatePublicNumber()
const bobPublicsNumber = bob.generatePublicNumber()

const aliceBobSharedKey = alice.generateSharedSecret(bobPublicsNumber)
//const aliceBobSharedKey = bob.generateSharedSecret(alicePublicsNumber)
```
The Client class accept a MODP group id ([https://tools.ietf.org/html/rfc3526](https://tools.ietf.org/html/rfc3526)) to use as generator number and prime number.  
The default id is 14.

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