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

Commit

Permalink
fix(Helpers): do not return address string from isValidPrivateKey
Browse files Browse the repository at this point in the history
  • Loading branch information
Thore3 committed Aug 7, 2017
1 parent e578728 commit 21d16dc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,8 @@ Helpers.isValidBIP39Mnemonic = function (mnemonic) {

Helpers.isValidPrivateKey = function (candidate) {
try {
var format = Helpers.detectPrivateKeyFormat(candidate);
if (format === 'bip38') { return true; }
var key = Helpers.privateKeyStringToKey(candidate, format);
return key.getAddress();
let format = Helpers.detectPrivateKeyFormat(candidate);
return format === 'bip38' || Helpers.privateKeyStringToKey(candidate, format) != null;
} catch (e) {
return false;
}
Expand Down

0 comments on commit 21d16dc

Please sign in to comment.