Merge pull request #1115 from eordano/fix/privCheck
Fix validation error
This commit is contained in:
commit
220a5bb566
|
@ -302,6 +302,9 @@ PrivateKey.getValidationError = function(data, network) {
|
|||
* @returns {Boolean} If the private key is would be valid
|
||||
*/
|
||||
PrivateKey.isValid = function(data, network){
|
||||
if (!data) {
|
||||
return false;
|
||||
}
|
||||
return !PrivateKey.getValidationError(data, network);
|
||||
};
|
||||
|
||||
|
|
|
@ -267,6 +267,10 @@ describe('PrivateKey', function() {
|
|||
a.should.equal(false);
|
||||
});
|
||||
|
||||
it('should recognize that undefined is an invalid private key', function() {
|
||||
PrivateKey.isValid().should.equal(false);
|
||||
});
|
||||
|
||||
it('should validate as true', function() {
|
||||
var a = PrivateKey.isValid('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m');
|
||||
a.should.equal(true);
|
||||
|
|
Loading…
Reference in New Issue