Comparing version 0.5.15-beta.1 to 0.5.15
@@ -142,3 +142,4 @@ 'use strict'; | ||
debugWs('Received message', message.data); | ||
var id = JSON.parse(message.data).id; | ||
var data = JSON.parse(message.data); | ||
var id = data.id; | ||
var msToRespond = Date.now() - _this2.requestsTime[id]; | ||
@@ -149,3 +150,3 @@ delete _this2.requestsTime[id]; | ||
} | ||
_this2.emit('message', JSON.parse(message.data)); | ||
_this2.emit('message', data); | ||
}); | ||
@@ -276,3 +277,3 @@ | ||
_this4.inFlight -= 1; | ||
// this.inFlight -= 1; | ||
release(); | ||
@@ -303,3 +304,3 @@ | ||
_this4.inFlight += 1; | ||
// this.inFlight += 1; | ||
_this4.ws.send(payload); | ||
@@ -306,0 +307,0 @@ }); |
@@ -98,3 +98,3 @@ 'use strict'; | ||
ebuf = new Buffer(ebuf.copy(0, ebuf.offset).toBinary(), 'binary'); | ||
var encryption_key = _hash2.default.sha512(ebuf | ||
var encryption_key = _hash2.default.sha512(ebuf); | ||
@@ -112,7 +112,7 @@ // D E B U G | ||
);var iv = encryption_key.slice(32, 48); | ||
var key = encryption_key.slice(0, 32 | ||
var iv = encryption_key.slice(32, 48); | ||
var key = encryption_key.slice(0, 32); | ||
// check is first 64 bit of sha256 hash treated as uint64_t truncated to 32 bits. | ||
);var check = _hash2.default.sha256(encryption_key); | ||
var check = _hash2.default.sha256(encryption_key); | ||
check = check.slice(0, 4); | ||
@@ -138,5 +138,5 @@ var cbuf = _bytebuffer2.default.fromBinary(check.toString('binary'), _bytebuffer2.default.DEFAULT_CAPACITY, _bytebuffer2.default.LITTLE_ENDIAN); | ||
message = toBinaryBuffer(message); | ||
var decipher = _browserifyAes2.default.createDecipheriv('aes-256-cbc', key, iv | ||
var decipher = _browserifyAes2.default.createDecipheriv('aes-256-cbc', key, iv); | ||
// decipher.setAutoPadding(true) | ||
);message = Buffer.concat([decipher.update(message), decipher.final()]); | ||
message = Buffer.concat([decipher.update(message), decipher.final()]); | ||
return message; | ||
@@ -152,5 +152,5 @@ } | ||
message = toBinaryBuffer(message); | ||
var cipher = _browserifyAes2.default.createCipheriv('aes-256-cbc', key, iv | ||
var cipher = _browserifyAes2.default.createCipheriv('aes-256-cbc', key, iv); | ||
// cipher.setAutoPadding(true) | ||
);message = Buffer.concat([cipher.update(message), cipher.final()]); | ||
message = Buffer.concat([cipher.update(message), cipher.final()]); | ||
return message; | ||
@@ -157,0 +157,0 @@ } |
'use strict'; | ||
var assert = require('assert' // from github.com/bitcoinjs/bitcoinjs-lib from github.com/cryptocoinjs/ecdsa | ||
);var crypto = require('./hash'); | ||
var assert = require('assert'); // from github.com/bitcoinjs/bitcoinjs-lib from github.com/cryptocoinjs/ecdsa | ||
var crypto = require('./hash'); | ||
var enforceType = require('./enforce_types'); | ||
var BigInteger = require('bigi'); | ||
var ECSignature = require('./ecsignature' | ||
var ECSignature = require('./ecsignature'); | ||
// https://tools.ietf.org/html/rfc6979#section-3.2 | ||
);function deterministicGenerateK(curve, hash, d, checkSig, nonce) { | ||
function deterministicGenerateK(curve, hash, d, checkSig, nonce) { | ||
@@ -28,33 +28,33 @@ enforceType('Buffer', hash); | ||
// Step B | ||
v.fill(1 | ||
v.fill(1); | ||
// Step C | ||
);k.fill(0 | ||
k.fill(0); | ||
// Step D | ||
);k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0]), x, hash]), k | ||
k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0]), x, hash]), k); | ||
// Step E | ||
);v = crypto.HmacSHA256(v, k | ||
v = crypto.HmacSHA256(v, k); | ||
// Step F | ||
);k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([1]), x, hash]), k | ||
k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([1]), x, hash]), k); | ||
// Step G | ||
);v = crypto.HmacSHA256(v, k | ||
v = crypto.HmacSHA256(v, k); | ||
// Step H1/H2a, ignored as tlen === qlen (256 bit) | ||
// Step H2b | ||
);v = crypto.HmacSHA256(v, k); | ||
v = crypto.HmacSHA256(v, k); | ||
var T = BigInteger.fromBuffer(v | ||
var T = BigInteger.fromBuffer(v); | ||
// Step H3, repeat until T is within the interval [1, n - 1] | ||
);while (T.signum() <= 0 || T.compareTo(curve.n) >= 0 || !checkSig(T)) { | ||
while (T.signum() <= 0 || T.compareTo(curve.n) >= 0 || !checkSig(T)) { | ||
k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0])]), k); | ||
v = crypto.HmacSHA256(v, k | ||
v = crypto.HmacSHA256(v, k); | ||
// Step H1/H2a, again, ignored as tlen === qlen (256 bit) | ||
// Step H2b again | ||
);v = crypto.HmacSHA256(v, k); | ||
v = crypto.HmacSHA256(v, k); | ||
@@ -89,6 +89,6 @@ T = BigInteger.fromBuffer(v); | ||
var N_OVER_TWO = n.shiftRight(1 | ||
var N_OVER_TWO = n.shiftRight(1); | ||
// enforce low S values, see bip62: 'low s values in signatures' | ||
);if (s.compareTo(N_OVER_TWO) > 0) { | ||
if (s.compareTo(N_OVER_TWO) > 0) { | ||
s = n.subtract(s); | ||
@@ -112,14 +112,14 @@ } | ||
// c = s^-1 mod n | ||
var c = s.modInverse(n | ||
var c = s.modInverse(n); | ||
// 1.4.4 Compute u1 = es^−1 mod n | ||
// u2 = rs^−1 mod n | ||
);var u1 = e.multiply(c).mod(n); | ||
var u2 = r.multiply(c).mod(n | ||
var u1 = e.multiply(c).mod(n); | ||
var u2 = r.multiply(c).mod(n); | ||
// 1.4.5 Compute R = (xR, yR) = u1G + u2Q | ||
);var R = G.multiplyTwo(u1, Q, u2 | ||
var R = G.multiplyTwo(u1, Q, u2); | ||
// 1.4.5 (cont.) Enforce R is not at infinity | ||
);if (curve.isInfinity(R)) return false; | ||
if (curve.isInfinity(R)) return false; | ||
@@ -130,6 +130,6 @@ // 1.4.6 Convert the field element R.x to an integer | ||
// 1.4.7 Set v = xR mod n | ||
var v = xR.mod(n | ||
var v = xR.mod(n); | ||
// 1.4.8 If v = r, output "valid", and if v != r, output "invalid" | ||
);return v.equals(r); | ||
return v.equals(r); | ||
} | ||
@@ -162,6 +162,6 @@ | ||
assert(r.signum() > 0 && r.compareTo(n) < 0, 'Invalid r value'); | ||
assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value' | ||
assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value'); | ||
// A set LSB signifies that the y-coordinate is odd | ||
);var isYOdd = i & 1; | ||
var isYOdd = i & 1; | ||
@@ -174,14 +174,14 @@ // The more significant bit specifies whether we should use the | ||
var x = isSecondKey ? r.add(n) : r; | ||
var R = curve.pointFromX(isYOdd, x | ||
var R = curve.pointFromX(isYOdd, x); | ||
// 1.4 Check that nR is at infinity | ||
);var nR = R.multiply(n); | ||
assert(curve.isInfinity(nR), 'nR is not a valid curve point' | ||
var nR = R.multiply(n); | ||
assert(curve.isInfinity(nR), 'nR is not a valid curve point'); | ||
// Compute -e from e | ||
);var eNeg = e.negate().mod(n | ||
var eNeg = e.negate().mod(n); | ||
// 1.6.1 Compute Q = r^-1 (sR - eG) | ||
// Q = r^-1 (sR + -eG) | ||
);var rInv = r.modInverse(n); | ||
var rInv = r.modInverse(n); | ||
@@ -207,6 +207,6 @@ var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv); | ||
for (var i = 0; i < 4; i++) { | ||
var Qprime = recoverPubKey(curve, e, signature, i | ||
var Qprime = recoverPubKey(curve, e, signature, i); | ||
// 1.6.2 Verify Q | ||
);if (Qprime.equals(Q)) { | ||
if (Qprime.equals(Q)) { | ||
return i; | ||
@@ -213,0 +213,0 @@ } |
'use strict'; | ||
var assert = require('assert' // from https://github.com/bitcoinjs/bitcoinjs-lib | ||
);var enforceType = require('./enforce_types'); | ||
var assert = require('assert'); // from https://github.com/bitcoinjs/bitcoinjs-lib | ||
var enforceType = require('./enforce_types'); | ||
@@ -109,10 +109,10 @@ var BigInteger = require('bigi'); | ||
sequence.push(0x02, rBa.length); | ||
sequence = sequence.concat(rBa | ||
sequence = sequence.concat(rBa); | ||
// INTEGER | ||
);sequence.push(0x02, sBa.length); | ||
sequence = sequence.concat(sBa | ||
sequence.push(0x02, sBa.length); | ||
sequence = sequence.concat(sBa); | ||
// SEQUENCE | ||
);sequence.unshift(0x30, sequence.length); | ||
sequence.unshift(0x30, sequence.length); | ||
@@ -119,0 +119,0 @@ return new Buffer(sequence); |
@@ -84,9 +84,9 @@ 'use strict'; | ||
var KBP = Point.fromAffine(secp256k1, BigInteger.fromBuffer(KB.slice(1, 33)), // x | ||
BigInteger.fromBuffer(KB.slice(33, 65) // y | ||
)); | ||
BigInteger.fromBuffer(KB.slice(33, 65)) // y | ||
); | ||
var r = this.toBuffer(); | ||
var P = KBP.multiply(BigInteger.fromBuffer(r)); | ||
var S = P.affineX.toBuffer({ size: 32 } | ||
var S = P.affineX.toBuffer({ size: 32 }); | ||
// SHA512 used in ECIES | ||
);return hash.sha512(S); | ||
return hash.sha512(S); | ||
} | ||
@@ -114,5 +114,5 @@ | ||
var derived = this.d.add(c //.mod(n) | ||
var derived = this.d.add(c); //.mod(n) | ||
);if (derived.signum() === 0) throw new Error("Child offset derived to an invalid key, try again"); | ||
if (derived.signum() === 0) throw new Error("Child offset derived to an invalid key, try again"); | ||
@@ -119,0 +119,0 @@ return new PrivateKey(derived); |
@@ -61,6 +61,6 @@ 'use strict'; | ||
var otherpub = pubkey === from.toString() ? to.toString() : from.toString(); | ||
memo = _ecc.Aes.decrypt(private_key, otherpub, nonce, encrypted, check | ||
memo = _ecc.Aes.decrypt(private_key, otherpub, nonce, encrypted, check); | ||
// remove varint length prefix | ||
);var mbuf = _bytebuffer2.default.fromBinary(memo.toString('binary'), _bytebuffer2.default.DEFAULT_CAPACITY, _bytebuffer2.default.LITTLE_ENDIAN); | ||
var mbuf = _bytebuffer2.default.fromBinary(memo.toString('binary'), _bytebuffer2.default.DEFAULT_CAPACITY, _bytebuffer2.default.LITTLE_ENDIAN); | ||
try { | ||
@@ -70,5 +70,5 @@ mbuf.mark(); | ||
} catch (e) { | ||
mbuf.reset | ||
mbuf.reset(); | ||
// Sender did not length-prefix the memo | ||
();memo = new Buffer(mbuf.toString('binary'), 'binary').toString('utf-8'); | ||
memo = new Buffer(mbuf.toString('binary'), 'binary').toString('utf-8'); | ||
return '#' + memo; | ||
@@ -114,5 +114,5 @@ } | ||
encrypted: message | ||
} | ||
}); | ||
// serialize | ||
);memo = encMemo.toBuffer(memo); | ||
memo = encMemo.toBuffer(memo); | ||
return '#' + _bs2.default.encode(new Buffer(memo, 'binary')); | ||
@@ -119,0 +119,0 @@ } |
@@ -6,13 +6,13 @@ "use strict"; | ||
var object = op.toObject(void 0, { use_default: true, annotate: true } | ||
var object = op.toObject(void 0, { use_default: true, annotate: true }); | ||
// visual (with descriptions) | ||
);console.error(JSON.stringify(object, null, 4) | ||
console.error(JSON.stringify(object, null, 4)); | ||
// usable in a copy-paste | ||
);object = op.toObject(void 0, { use_default: true, annotate: false } | ||
object = op.toObject(void 0, { use_default: true, annotate: false }); | ||
// copy-paste one-lineer | ||
);console.error(JSON.stringify(object)); | ||
console.error(JSON.stringify(object)); | ||
}; |
@@ -57,4 +57,4 @@ 'use strict'; | ||
b.writeInt64(v.to_long(amount.replace(".", ""))); | ||
var dot = amount.indexOf("." // 0.000 | ||
);var precision = dot === -1 ? 0 : amount.length - dot - 1; | ||
var dot = amount.indexOf("."); // 0.000 | ||
var precision = dot === -1 ? 0 : amount.length - dot - 1; | ||
b.writeUint8(precision); | ||
@@ -61,0 +61,0 @@ b.append(symbol.toUpperCase(), 'binary'); |
{ | ||
"name": "steem", | ||
"version": "0.5.15-beta.1", | ||
"version": "0.5.15", | ||
"description": "Steem.js the JavaScript API for Steem blockchain", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
12726121
74
9506