Consensys/eth-lightwallet

ightwallet.keystore.deriveKeyFromPassword is not an function ???

Opened this issue · 1 comments

const lightwallet = require('eth-lightwallet');
lightwallet.keystore.deriveKeyFromPassword('12321',
    function (err, pwDerivedKey) {
        var seed = lightwallet.keystore.generateRandomSeed();
        var keystore = new lightwallet.keystore(seed, pwDerivedKey);

        keystore.generateNewAddress(pwDerivedKey);
        var address = keystore.getAddresses()[0];
        var prv_key = keystore.exportPrivateKey(address, pwDerivedKey);
        console.log('address and key: ', address, prv_key);
});

**

/home/user/Ethereum/web3jstest/test.js:26
lightwallet.keystore.deriveKeyFromPassword('12321',
^

TypeError: lightwallet.keystore.deriveKeyFromPassword is not a function
at Object. (/home/user/Ethereum/web3jstest/test.js:26:22)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3

**

var password = Math.random().toString();
var seed = lightwallet.keystore.generateRandomSeed();

lightwallet.keystore.createVault({
    password: password,
    seedPhrase: seed,
    hdPathString: "m/0'/0'/0'"
}, function (err, ks) {

    ks.keyFromPassword(password, function (err, pwDerivedKey) {
        if (!ks.isDerivedKeyCorrect(pwDerivedKey)) {
            throw new Error("Incorrect derived key!");
        }

        try {
            ks.generateNewAddress(pwDerivedKey, 1);
        } catch (err) {
            console.log(err);
            console.trace();
        }
        var address = ks.getAddresses()[0];
        var prv_key = ks.exportPrivateKey(address, pwDerivedKey);

        console.log('address and key: ', address, prv_key);


    });
});