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
|
* @returns {Boolean} If the private key is would be valid
|
||||||
*/
|
*/
|
||||||
PrivateKey.isValid = function(data, network){
|
PrivateKey.isValid = function(data, network){
|
||||||
|
if (!data) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return !PrivateKey.getValidationError(data, network);
|
return !PrivateKey.getValidationError(data, network);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -267,6 +267,10 @@ describe('PrivateKey', function() {
|
||||||
a.should.equal(false);
|
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() {
|
it('should validate as true', function() {
|
||||||
var a = PrivateKey.isValid('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m');
|
var a = PrivateKey.isValid('L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m');
|
||||||
a.should.equal(true);
|
a.should.equal(true);
|
||||||
|
|
Loading…
Reference in New Issue