Skip to content
This repository has been archived by the owner on Jun 7, 2019. It is now read-only.

Implement bip39 account generation - Closes #133 #138

Merged

Conversation

alepop
Copy link
Contributor

@alepop alepop commented Jun 22, 2017

  • Add mnemonic module
  • Add API method for generating new Account

In this implementation, I use some code from lisk-nano for generating a random seed. And take functionality from bitcore-mnemonic package. Why don't use bitcore-mnemonic package instead?
Because there too many dependencies.
Close #133

└─┬ bitcore-mnemonic@1.2.5
  └─┬ bitcore-lib@0.14.0
    ├── bn.js@2.0.4
    ├── bs58@2.0.0
    ├── buffer-compare@1.0.0
    ├─┬ elliptic@3.0.3
    │ ├── bn.js@2.0.4  deduped
    │ ├── brorand@1.0.5
    │ ├─┬ hash.js@1.0.3
    │ │ └── inherits@2.0.1  deduped
    │ └── inherits@2.0.1  deduped
    ├── inherits@2.0.1
    └── lodash@3.10.1

@alepop alepop force-pushed the implement-bip39-account-generation branch 2 times, most recently from b035061 to 48851b1 Compare June 22, 2017 18:25
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 99.235% when pulling 48851b1 on alepop:implement-bip39-account-generation into 3107ff7 on LiskHQ:development.

@alepop alepop force-pushed the implement-bip39-account-generation branch from 48851b1 to dd23ce8 Compare June 22, 2017 18:47
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 99.235% when pulling dd23ce8 on alepop:implement-bip39-account-generation into 3107ff7 on LiskHQ:development.

*/

LiskAPI.prototype.generateAccount = function (secret, callback) {
this.sendRequest('accounts/generatePublicKey', { secret: secret }, function (result) {
Copy link
Contributor

@toschdev toschdev Jun 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the cryptographic function instead of an API call:
https://github.com/LiskHQ/lisk-js/blob/development/lib/transactions/crypto/keys.js

It is also synchronous and already tested

return callback(result);
});
var keys = LiskJS.crypto.getPrivateAndPublicKeyFromSecret(secret);
callback(keys)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The callback is not necessary, as stated the function is synchronous, you can just return it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But all API methods receive the callback as the second parameter and return this and I follow that design.

@alepop alepop force-pushed the implement-bip39-account-generation branch from 00bcdec to 6594836 Compare June 23, 2017 21:28
@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 99.236% when pulling 6594836 on alepop:implement-bip39-account-generation into 3107ff7 on LiskHQ:development.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants