bitcoin-address
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -23,5 +23,8 @@ | ||
var p = positions[char]; | ||
// if we encounter an invalid character, decoding fails | ||
if (p === undefined) { | ||
return '0'; | ||
throw new Error('invalid base58 string: ' + payload); | ||
} | ||
num = num.mul(base).add(p); | ||
@@ -28,0 +31,0 @@ |
@@ -24,3 +24,8 @@ | ||
var decoded_hex = base58.decode(address); | ||
try { | ||
var decoded_hex = base58.decode(address); | ||
} catch (e) { | ||
// if decoding fails, assume invalid address | ||
return false; | ||
} | ||
@@ -30,2 +35,3 @@ // make a usable buffer from the decoded data | ||
// should be 25 bytes per btc address spec | ||
@@ -32,0 +38,0 @@ if (decoded.length != 25) { |
@@ -5,3 +5,3 @@ { | ||
"description": "bitcoin address verification and other related functions", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/shtylman/bitcoin-address", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -13,3 +13,6 @@ var address = require('..'); | ||
invalid('mzBc4XEFSdzCDcTxAgf6EZXgsZWpztRhef', 'prod'); | ||
// invalid base58 string | ||
invalid('%%@'); | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5206
127