# dweb-derive-key

> Derive a named key from a master key

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

## Install

```sh
npm install dweb-derive-key
pnpm add dweb-derive-key
yarn add dweb-derive-key
bun add dweb-derive-key
```

## 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.0 |
| Published | 2021-03-05 |
| First published | 2021-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | PeepsLabs |
| Maintainers | dwebprotocol |

## Links

- npm: https://www.npmjs.com/package/dweb-derive-key
- Repository: https://github.com/dwebprotocol/dweb-derive-key
- Homepage: https://dwebx.org
- Issues: https://github.com/dwebprotocol/dweb-derive-key/issues
- npm.io page: https://npm.io/package/dweb-derive-key

## Dependencies (1)

- [blake2b-universal](https://npm.io/package/blake2b-universal.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2021-03-05

## README

# dweb-derive-key

Derive a named key from a high-entropy master key

```
npm install dweb-derive-key
```

## Usage

``` js
const derive = require('dweb-derive-key')
const masterKey = crypto.randomBytes(32) // make sure this is high-entropy master key, eg. from a CSPRNG

const key = derive('a namespace', masterKey, 'my-named-key')

console.log('the derived key is:', key)
```

## API

#### `outputKey = derive(namespace, masterKey, name, [outputKey])`

Derive a named key from a 32 byte high-entropy master key. This can be 32-bytes of
cryptographically secure randomness, eg from a CSPRNG. Do **NOT** use low entropy
soruces such a passwords, passphrases or randomness from a predictable RNG.

The namespace should be an ascii string (fx your application name) and name can be a buffer
or string reflecting the name of the key you want to derive.

Optionally you can pass in the output key parameter and the result will be written into this
buffer instead of a new buffer being allocated internally.

## License

MIT

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