You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
junderw 4acb7127f7
Remove hex functions and make async default
6 years ago
..
index.js Remove hex functions and make async default 6 years ago
readme.js Remove hex functions and make async default 6 years ago
vectors.json Revert "fix issue with 11 bit padding messing up checksum check." 8 years ago
wordlist.json BIP39: allow for custom wordlists 10 years ago

readme.js

const bip39 = require('../')
const Buffer = require('safe-buffer').Buffer
const proxyquire = require('proxyquire')
const test = require('tape')

test('README example 1', function (t) {
// defaults to BIP39 English word list
const entropy = 'ffffffffffffffffffffffffffffffff'
const mnemonic = bip39.entropyToMnemonic(entropy)

t.plan(2)
t.equal(mnemonic, 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong')

// reversible
t.equal(bip39.mnemonicToEntropy(mnemonic), entropy)
})

test('README example 2', function (t) {
const stub = {
randombytes: function (size) {
return Buffer.from('qwertyuiopasdfghjklzxcvbnm[];,./'.slice(0, size), 'utf8')
}
}
const proxiedbip39 = proxyquire('../', stub)

// mnemonic strength defaults to 128 bits
const mnemonic = proxiedbip39.generateMnemonic()

t.plan(2)
t.equal(mnemonic, 'imitate robot frame trophy nuclear regret saddle around inflict case oil spice')
t.equal(bip39.validateMnemonic(mnemonic), true)
})

test('README example 3', function