Skip to content

Creates a random numonic using Bip39 adding: CPU entropy, seed checking using bip39-checker, and a command-line interface.

Notifications You must be signed in to change notification settings

jcalfee/bip39-seeder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

NPM Package

Seeder (bip39)

Create and validate bip39 compatible mnemonic seeds.

Entropy

Combines secure random generator and variations in CPU performance.

Validation

Mnemonic seeds contain a hidden checksum. Suggested spelling corrections are provided.

Command Line Interface

bip39-seeder -?

Create or validate bip39 mnemonic seeds.
> ocean earn race rack swing odor yard manage illegal draw window desk

Suggested spelling corrections are provided.

Options:
  --create, -c    Create a new secure random mnemonic seed             [boolean]
  --seed, -s      Provide mnemonic seed (12 words or so)
                                                        [string] [default: null]
  --bits, -b      Bit strength                           [number] [default: 128]
  --language, -l  language: chinese_simplified, chinese_traditional, english,
                  french, italian, japanese, spanish
                                                   [string] [default: "english"]
  --no-suggest    Do not suggest correction to misspelled words in the mnemonic
                  seed                                [boolean] [default: false]
  --help, -h, -?  Show help                                            [boolean]

Examples:
  bip39-seeder -c  Create a new random mnemonic seed
  bip39-seeder -s  Validate an existing seed

API

const assert = require('assert')
const {suggest, validSeed} = require('bip39-checker')
const {randomMnemonicSeed, mnemonicToSeed} = require('bip39-seeder')

randomMnemonicSeed(null, seed => {

    assert(validSeed(seed))

    // Strengthen the seed by 11 bits
    const stretched = mnemonicToSeed(seed)
    assert(stretched.toString('hex'))
    assert.equal(stretched.length, 64)
    // By convention:
    //  stretched.slice(0, 32) is the private key or HD master private key, etc..
    //  stretched.I.slice(32) may be used for something else like an initialization vector, chain code, etc..

    console.log('Random mnemonic seed:', seed)
})

About

Creates a random numonic using Bip39 adding: CPU entropy, seed checking using bip39-checker, and a command-line interface.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published