niceware-eff

1.0.0 • Public • Published

niceware-eff

This package is a fork of niceware that uses a wordlist based on the EFF's New Wordlists for Random Passphrases. Because this wordlist is much smaller, it is only useful in scenarios such where brute force attacks are minimized by some other mechanism, such as only giving attackers one chance to guess the password.

Usage in Node

To install:

npm install niceware

To generate an 8-byte passphrase:

const niceware = require('niceware')

// The number of bytes must be even
const passphrase = niceware.generatePassphrase(8)

// Result: [ 'deathtrap', 'stegosaur', 'nilled', 'nonscheduled' ]

Usage in browser

To use Niceware in modern browsers, include browser/niceware.js in a script tag. Niceware is then available in the window.niceware object.

<script src='niceware.js'></script>
<script>
  const passphrase = window.niceware.generatePassphrase(8)
</script>

Niceware uses window.{crypto, msCrypto}.getRandomValues for entropy in the browser.

Docs

NOTE: When used in the browser, Buffer is replaced with window.Uint8Array.

niceware

Kind: Exported constant

niceware.bytesToPassphrase(bytes) ⇒ Array.<string>

Converts a byte array into a passphrase.

Kind: static method of niceware

Param Type Description
bytes Buffer The bytes to convert

niceware.passphraseToBytes(words) ⇒ Buffer

Converts a phrase back into the original byte array.

Kind: static method of niceware

Param Type Description
words Array.<string> The words to convert

niceware.generatePassphrase(size) ⇒ Array.<string>

Generates a random passphrase with the specified number of bytes. NOTE: size must be an even number.

Kind: static method of niceware

Param Type Description
size number The number of random bytes to use

Niceware ports

Credits

Niceware was inspired by Diceware. Its wordlist is derived from the SIL English word list. This project is based on my work on OpenPGP key backup for the Yahoo End-to-End project.

Dependencies (2)

Dev Dependencies (4)

Package Sidebar

Install

npm i niceware-eff

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

246 kB

Total Files

14

Last publish

Collaborators

  • karissa