doichain-wallet-address-validator
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -36,3 +36,3 @@ { | ||
], | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"author": "David Reband david.reband@gmail.com", | ||
@@ -39,0 +39,0 @@ "homepage": "https://github.com/Doichain/wallet-address-validator", |
@@ -73,4 +73,7 @@ var base58 = require('./crypto/base58'); | ||
isValidAddress: function (address, currency, networkType) { | ||
return isValidP2PKHandP2SHAddress(address, currency, networkType) || segwit.isValidAddress(address, currency.segwitHrp); | ||
return ( | ||
isValidP2PKHandP2SHAddress(address, currency, networkType) || | ||
segwit.isValidAddress(address, currency.segwitHrp, networkType) | ||
); | ||
} | ||
}; |
@@ -22,2 +22,3 @@ // Copyright (c) 2017 Pieter Wuille | ||
var bech32 = require('./bech32'); | ||
var DEFAULT_NETWORK_TYPE = "prod"; | ||
@@ -74,8 +75,11 @@ function convertbits (data, frombits, tobits, pad) { | ||
function isValidAddress(address, hrp) { | ||
var hrp = hrp || 'bc'; | ||
function isValidAddress(address, hrp, networkType) { | ||
networkType = networkType || DEFAULT_NETWORK_TYPE; | ||
var hrp = (hrp && hrp[networkType] ? hrp[networkType] : "") || "bc"; | ||
var ret = decode(hrp, address); | ||
if (ret === null) { | ||
hrp = 'tb'; | ||
hrp = "tb"; | ||
ret = decode(hrp, address); | ||
@@ -82,0 +86,0 @@ } |
@@ -72,3 +72,3 @@ var XRPValidator = require('./ripple_validator'); | ||
addressTypes: {prod: ['34', '0d'], testnet: ['6f','c4']}, | ||
segwitHrp: 'dc', | ||
segwitHrp: {prod: 'dc', testnet: 'td'}, | ||
validator: BTCValidator | ||
@@ -89,3 +89,3 @@ },{ | ||
addressTypes: {prod: ['0x', '47'], testnet: ['6f', 'c4']}, | ||
segwitHrp: 'vtc', | ||
segwitHrp: {prod: 'vtc'}, | ||
validator: BTCValidator | ||
@@ -92,0 +92,0 @@ },{ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
411503
8999
1