How to use the niceware.bytesToPassphrase function in niceware

To help you get started, we’ve selected a few niceware examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brave / browser-laptop / test / lib / userProfiles.js View on Github external
return function * (client) {
    const data = []
    const buffer = new Buffer(2)
    for (let n = 0; n < total; n++) {
      buffer.writeUInt16BE(n)
      const string = niceware.bytesToPassphrase(buffer)[0]
      data.push({
        active: false,
        discarded: true,
        url: `https://www.${string}.com`
      })
    }
    yield client.waitForBrowserWindow()
    for (let datum of data) {
      yield client.newTab(datum, false, true) // isRestore
    }
  }
}
github brave / crypto / index.js View on Github external
fromBytesOrHex: function (bytes/* : Uint8Array | string */, useNiceware/* : boolean */ = false) {
    if (useNiceware) {
      if (typeof bytes === 'string') {
        bytes = module.exports.hexToUint8(bytes)
      }
      return niceware.bytesToPassphrase(Buffer.from(bytes)).join(' ')
    } else {
      if (typeof bytes !== 'string') {
        bytes = module.exports.uint8ToHex(bytes)
      }
      return bip39.entropyToMnemonic(bytes)
    }
  },
github brave / browser-laptop / app / renderer / components / preferences / syncTab.js View on Github external
get passphraseContent () {
    if (!this.isSetup) {
      return null
    }
    const seed = Buffer.from(this.props.syncData.get('seed').toJS())
    const passphrase = niceware.bytesToPassphrase(seed)
    const words = [
      passphrase.slice(0, 4).join(' '),
      passphrase.slice(4, 8).join(' '),
      passphrase.slice(8, 12).join(' '),
      passphrase.slice(12, 16).join(' ')
    ]
    return this.props.syncPassphraseVisible
      ? <ul>
        <li>
          </li></ul>

niceware

Utility for generating memorable passwords and converting random bytes into human-readable phrases

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis