# noise-curve-ed

> Ed25519 elliptic curve operations for [`noise-handshake`](https://github.com/chm-diederichs/noise-handshake)

Latest version **2.1.0** (published 2025-04-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install noise-curve-ed
pnpm add noise-curve-ed
yarn add noise-curve-ed
bun add noise-curve-ed
```

## Health

**Score 43/100 (D)** — status: stable.

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

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2025-04-12 |
| First published | 2021-07-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/noise-curve-ed) |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 3.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | mafintosh, chm-diederichs |

## Links

- npm: https://www.npmjs.com/package/noise-curve-ed
- Repository: https://github.com/chm-diederichs/noise-curve-ed
- Homepage: https://github.com/chm-diederichs/noise-curve-ed#readme
- Issues: https://github.com/chm-diederichs/noise-curve-ed/issues
- npm.io page: https://npm.io/package/noise-curve-ed

## Dependencies (3)

- [b4a](https://npm.io/package/b4a.md) ^1.1.0
- [nanoassert](https://npm.io/package/nanoassert.md) ^2.0.0
- [sodium-universal](https://npm.io/package/sodium-universal.md) ^5.0.0

## Recent versions

- 2.1.0 (latest) — 2025-04-12
- 2.0.1 — 2023-01-10
- 2.0.0 — 2022-09-21
- 1.0.4 — 2021-11-02
- 1.0.3 — 2021-10-19
- 1.0.2 — 2021-08-19
- 1.0.1 — 2021-07-16
- 1.0.0 — 2021-07-16

## README

# noise-curve-ed

Ed25519 elliptic curve operations for [`noise-handshake`](https://github.com/chm-diederichs/noise-handshake)

## Usage
```js
const curve = require('noise-curve-ed')
const Noise = require('noise-handshake')

const handshake = new Noise(pattern, initiator, staticKeyPair, { curve })
```

## API

#### constants

`DHLEN` = 32
`PKLEN` = 32
`SCALARLEN` = 32
`SKLEN` = 64
`ALG` = 'Ed25519'

#### `generateKeyPair([privKey])`

Generate a new keypair, optionally pass in a preexisting `privKey`. Return value is of the form:

```
{
  publicKey,
  secretKey,
}
```

#### `dh(publicKey, { secretKey, scalar })`

Perform DH between `publicKey` and `secretKey`/`scalar` and return the result.

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