jingtum-base-lib
Advanced tools
Comparing version 1.0.9 to 1.1.0
{ | ||
"name": "jingtum-base-lib", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "jingtum base lib for wallet and so on.", | ||
@@ -42,3 +42,6 @@ "main": "index.js", | ||
"webpack": "^1.13.3" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
} | ||
} |
@@ -54,3 +54,3 @@ 'use strict'; | ||
*/ | ||
function __encode(version, bytes) { | ||
exports.__encode = function(version, bytes) { | ||
var buffer = bufCat0(version, bytes); | ||
@@ -60,3 +60,3 @@ var checksum = new Buffer(sha256(sha256(buffer)).slice(0, 4)); | ||
return base58.encode(ret); | ||
} | ||
}; | ||
/** | ||
@@ -70,3 +70,3 @@ * decode encoded input, | ||
*/ | ||
function __decode(version, input) { | ||
exports.__decode = function(version, input) { | ||
var bytes = base58.decode(input); | ||
@@ -83,3 +83,3 @@ if (!bytes || bytes[0] !== version || bytes.length < 5) { | ||
return bytes.slice(1, -4); | ||
} | ||
}; | ||
@@ -92,3 +92,3 @@ /** | ||
var randBytes = brorand(16); | ||
return __encode(SEED_PREFIX, randBytes); | ||
return this.__encode(SEED_PREFIX, randBytes); | ||
}; | ||
@@ -117,3 +117,3 @@ | ||
var prefix = '00'; | ||
var entropy = __decode(SEED_PREFIX, secret); | ||
// var entropy = __decode(SEED_PREFIX, secret); | ||
var entropy = base58.decode(secret).slice(1, -4); | ||
@@ -144,3 +144,3 @@ var privateKey = prefix + derivePrivateKey(entropy).toString(16, 64).toUpperCase(); | ||
var input = new Buffer(hashjs.ripemd160().update(hash256).digest()); | ||
return __encode(ACCOUNT_PREFIX, input); | ||
return this.__encode(ACCOUNT_PREFIX, input); | ||
}; | ||
@@ -155,7 +155,7 @@ | ||
try { | ||
__decode(ACCOUNT_PREFIX, address); | ||
this.__decode(ACCOUNT_PREFIX, address); | ||
return true; | ||
} catch (err) { | ||
return false; | ||
} | ||
} | ||
}; | ||
@@ -171,3 +171,3 @@ | ||
try { | ||
return __decode(ACCOUNT_PREFIX, address); | ||
return this.__decode(ACCOUNT_PREFIX, address); | ||
@@ -186,3 +186,3 @@ } catch (err) { | ||
try { | ||
return __encode(ACCOUNT_PREFIX, bytes); | ||
return this.__encode(ACCOUNT_PREFIX, bytes); | ||
@@ -189,0 +189,0 @@ } catch (err) { |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
949761
20
13972
1