-
Notifications
You must be signed in to change notification settings - Fork 64
Implement bip39 account generation - Closes #133 #138
Implement bip39 account generation - Closes #133 #138
Conversation
b035061
to
48851b1
Compare
48851b1
to
dd23ce8
Compare
lib/api/liskApi.js
Outdated
*/ | ||
|
||
LiskAPI.prototype.generateAccount = function (secret, callback) { | ||
this.sendRequest('accounts/generatePublicKey', { secret: secret }, function (result) { |
There was a problem hiding this comment.
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
lib/api/liskApi.js
Outdated
return callback(result); | ||
}); | ||
var keys = LiskJS.crypto.getPrivateAndPublicKeyFromSecret(secret); | ||
callback(keys) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
00bcdec
to
6594836
Compare
In this implementation, I use some code from
lisk-nano
for generating a random seed. And take functionality frombitcore-mnemonic
package. Why don't usebitcore-mnemonic
package instead?Because there too many dependencies.
Close #133