パッケージの詳細

triplesec

keybase782.3k4.0.3

A CommonJS-compliant system for secure encryption of smallish secrets

readme

node-triplesec

A CommonJS module for symmetric key encryption of smallish secrets

How to install

npm install triplesec

How to Use

One-shot Mode

{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:

{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).

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

Full API Documentation

Documentation generated by codo is available here.

更新履歴

4.0.3 (2019-02-01)

  • Bugfix

4.0.2 (2019-02-01)

  • Deprecate (new Buffer) and use Buffer.from or Buffer.alloc instead

4.0.1 (2018-11-27)

Features:

  • Update docs
  • Remove sha3 library dependency

4.0.0 (2018-11-27)

Features:

3.0.27 (2018-09-21)

Bugfix:

  • Kill use asm

3.0.25 (2015-08-27)

Bugfix:

  • unbreak due to bad version of IcedCoffeeScript. Fix with v108.0.8

3.0.24 (2015-08-27)

Bugfix:

  • Don't copy() extra key material, since we're not scrubbing it.

3.0.23 (2015-08-27)

Bugfix:

  • Fix more issues in cloning, and also bugs in scrubbing derived keys

3.0.22 (2015-08-27)

Bugfix:

  • Do the same for Encryptor, so fix a bug

3.0.21 (2015-08-27)

Features:

  • Encryptor / Decryptor clone support

3.0.20 (2015-05-31)

Bugfixes:

  • Bower matches package.json

3.0.19 (2014-08-18)

Bugfixes:

  • Remove errant iced-coffee-script inclusion
    • Address keybase/kbpgp#40

3.0.18 (2014-08-16)

Features:

  • Upgrade more-entropy to make it more polite on energy-constrained devices

3.0.17 (2014-06-17)

Features:

  • RipeMD160 support

3.0.14-3.0.16 (2014-05-26)

Bugfixes:

  • Various small changes to package.json to debug install problems with npm

3.0.13 (2014-05-26)

Features:

  • Expose other hmac features

3.0.12 (2014-05-22)

Features:

  • Expose Salsa20 and CTR to modules

3.0.11 (2014-05-18)

Features:

  • Buffer comparison as an unsigned big-endian number

3.0.10 (2014-04-14)

Bugfixes:

  • SHA224 and SHA384 were reporting incorrect hash lengths

3.0.9 (2014-04-14)

Bugfixes:

  • Fix bug in SHA384 inclusion

3.0.8 (2014-04-13)

Features:

  • SHA384 implementation

3.0.7 (2014-03-11)

Features:

  • MD5 implementation

3.0.6 (2014-2-21)

Bugfixes:

  • Get IE11 working, with window.msCrypto.getRandomValues

Features:

  • Inaugural changelog