# triplesec

> A CommonJS-compliant system for secure encryption of smallish secrets

Latest version **4.0.3** (published 2019-02-01) · 0 weekly downloads

## Install

```sh
npm install triplesec
pnpm add triplesec
yarn add triplesec
bun add triplesec
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2019-02-01 |
| First published | 2013-09-06 |
| Weekly downloads | 0 |
| TypeScript types | separate (@types/triplesec) |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 676.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 401 |
| Author | keybase |
| Maintainers | maxtaco |

## Links

- npm: https://www.npmjs.com/package/triplesec
- Repository: https://github.com/keybase/triplesec
- Issues: https://github.com/keybase/triplesec/issues
- npm.io page: https://npm.io/package/triplesec

## Dependencies (6)

- [progress](https://npm.io/package/progress.md) ~1.1.2
- [iced-lock](https://npm.io/package/iced-lock.md) ^1.0.1
- [uglify-js](https://npm.io/package/uglify-js.md) ^3.1.9
- [iced-error](https://npm.io/package/iced-error.md) >=0.0.9
- [iced-runtime](https://npm.io/package/iced-runtime.md) ^1.0.2
- [more-entropy](https://npm.io/package/more-entropy.md) >=0.0.7

## Recent versions

- 4.0.3 (latest) — 2019-02-01
- 4.0.2 — 2019-02-01
- 4.0.1 — 2018-12-14
- 3.0.27 — 2018-09-21
- 3.0.26 — 2017-09-20
- 3.0.25 — 2015-08-28
- 3.0.24 — 2015-08-28
- 3.0.23 — 2015-08-27
- 3.0.22 — 2015-08-27
- 3.0.21 — 2015-08-27
- 3.0.20 — 2015-06-01
- 3.0.19 — 2014-08-18
- 3.0.18 — 2014-08-16
- 3.0.17 — 2014-06-17
- 3.0.16 — 2014-06-04
- … 22 more at https://npm.io/package/triplesec/versions

## README

# node-triplesec

A CommonJS module for symmetric key encryption of smallish secrets

## How to install

```sh
npm install triplesec
```

## How to Use

### One-shot Mode

```coffeescript
{encrypt, decrypt} = require 'triplesec'

key = new Buffer 'top-secret-pw'
pt0 = new Buffer 'the secret!'
pt1 = new Buffer pt0
encrypt { key, data : pt1 }, (err, ciphertext) ->
	decrypt { key, data : ciphertext }, (err, pt2) ->
		console.log "Right back the start! #{pt0} is #{pt2}"
```

### Reusable Derived Keys

The most expensive part of TripleSec is to derive keys from your
given passphrase.  This is intentionally so to make it more expensive
to crack your password in the case that your ciphertext is stolen. 
However, you can spread this expense over multiple encryptions
if you plan to be encrypting more than once:

```coffeescript
{Encryptor, Decryptor} = require 'triplesec'

key = new Buffer 'top-secret-pw'
enc = new Encryptor { key }
dec = new Decryptor { key }
pt0 = new Buffer 'the secret!'
pt1 = new Buffer pt0
pt2 = new Buffer pt0
enc.run { data : pt1 }, (err, ct1) ->
	enc.run { data : pt2 }, (err, ct2) ->
		dec.run { data : ct1 }, (err, pt3) ->
			dec.run { data : ct2 }, (err, pt4) ->
				console.log "Right back the start! #{pt0} is #{pt3} is #{pt4}"
```

If you want to resalt derived keys with every encryption, you should explicitly
ask for that. Otherwise, salt will be reused to speed up encryption
(and decryption).

```coffeescript
enc.run { data : pt1 }, (err, ct1) ->
	enc.resalt {}, () ->
		enc.run { data : pt2 }, (err, ct2) ->
```

### Full API Documentation

Documentation generated by [codo](https://github.com/netzpirat/codo)
is available [here](http://keybase.github.io/triplesec/codo/index.html).

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