Clean up formatting of BIP32key (jshint)
This commit is contained in:
parent
49513684a2
commit
d39567c589
1 changed files with 4 additions and 4 deletions
|
@ -7,7 +7,7 @@ var util = require('./util'),
|
||||||
|
|
||||||
var BIP32key = function(opts) {
|
var BIP32key = function(opts) {
|
||||||
if (!opts) opts = {}
|
if (!opts) opts = {}
|
||||||
if (typeof opts == "string") {
|
if (typeof opts == 'string') {
|
||||||
try {
|
try {
|
||||||
opts = BIP32key.deserialize(opts);
|
opts = BIP32key.deserialize(opts);
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ BIP32key.deserialize = function(str) {
|
||||||
back = bytes.slice(bytes.length-4);
|
back = bytes.slice(bytes.length-4);
|
||||||
var checksum = Crypto.SHA256(Crypto.SHA256(front,{asBytes: true}), {asBytes: true})
|
var checksum = Crypto.SHA256(Crypto.SHA256(front,{asBytes: true}), {asBytes: true})
|
||||||
.slice(0,4);
|
.slice(0,4);
|
||||||
if (""+checksum != ""+back) {
|
if ('' + checksum != '' + back) {
|
||||||
throw new Error("Checksum failed");
|
throw new Error('Checksum failed');
|
||||||
}
|
}
|
||||||
var type = conv.bytesToString(bytes.slice(0,4)) == PRIVDERIV ? 'priv' : 'pub';
|
var type = conv.bytesToString(bytes.slice(0,4)) == PRIVDERIV ? 'priv' : 'pub';
|
||||||
return new BIP32key({
|
return new BIP32key({
|
||||||
|
@ -116,7 +116,7 @@ BIP32key.prototype.privtopub = BIP32key.prototype.getPub = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
BIP32key.fromMasterKey = function(seed) {
|
BIP32key.fromMasterKey = function(seed) {
|
||||||
var I = Bitcoin.Crypto.HMAC(Bitcoin.Crypto.SHA512,seed,"Bitcoin seed",{ asBytes: true })
|
var I = Bitcoin.Crypto.HMAC(Bitcoin.Crypto.SHA512,seed, 'Bitcoin seed' , { asBytes: true })
|
||||||
return new BIP32key({
|
return new BIP32key({
|
||||||
vbytes: conv.stringToBytes(PRIVDERIV),
|
vbytes: conv.stringToBytes(PRIVDERIV),
|
||||||
type: 'priv',
|
type: 'priv',
|
||||||
|
|
Loading…
Add table
Reference in a new issue