From 0927949460db091d28978d6ad8a02a289fa023eb Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 5 Sep 2017 12:23:01 +0100 Subject: [PATCH 001/113] Rename "OneOfTwo" to "OneOfThree" --- test/helpers.js | 4 ++-- test/trust_is_risk.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index 855c1de..d38b350 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,7 +82,7 @@ var testHelpers = { }); }, - getOneOfTwoMultisigOutput: (originPubKey, destPubKey, value) => { + getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 2, [originPubKey, destPubKey]), value @@ -95,7 +95,7 @@ var testHelpers = { testHelpers.getP2PKHInput(originPubKey) ], outputs: [ - testHelpers.getOneOfTwoMultisigOutput(originPubKey, destPubKey, value) + testHelpers.getOneOfThreeMultisigOutput(originPubKey, destPubKey, value) ] }); }, diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 2040784..278ec1d 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -40,7 +40,7 @@ describe("TrustIsRisk", () => { trustIncreasingMTX = testHelpers.getTrustIncreasingMTX(addr.alice.pubKey, addr.bob.pubKey, 42 * COIN); trustIncreasingTX = trustIncreasingMTX.toTX(); - var inputOneOfTwoMultisig = new Input({ + var inputOneOfThreeMultisig = new Input({ prevout: { hash: trustIncreasingTX.hash().toString("hex"), index: 0 @@ -52,10 +52,10 @@ describe("TrustIsRisk", () => { trustDecreasingMTX = new MTX({ inputs: [ - inputOneOfTwoMultisig + inputOneOfThreeMultisig ], outputs: [ - testHelpers.getOneOfTwoMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 20 * COIN), + testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 20 * COIN), testHelpers.getP2PKHOutput(addr.alice.base58, 22 * COIN) ] }); @@ -170,7 +170,7 @@ describe("TrustIsRisk", () => { it("which has more than one trust outputs decreases trust to zero", () => { trustDecreasingMTX.outputs[0].value -= 15 * COIN; trustDecreasingMTX.outputs.push( - testHelpers.getOneOfTwoMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 5 * COIN)); + testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 5 * COIN)); tir.addTX(trustDecreasingMTX.toTX()); tir.getDirectTrust(alice, bob).should.equal(0); From 977df8dc7b40d487f101ea99c3598914bea3204e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 5 Sep 2017 13:53:15 +0100 Subject: [PATCH 002/113] Add provisional tag --- test/trust_is_risk.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 278ec1d..e109536 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -13,6 +13,9 @@ var fixtures = require("./fixtures"); require("should-sinon"); const COIN = bcoin.consensus.COIN; +const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // +const ripemdTag1 = "1"; //TODO +const tag = "1111111111111111111111111111111111"; // describe("TrustIsRisk", () => { var addr = {}; From f815dc0e1393f5b1c500c0e70d83dac74d768c91 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 5 Sep 2017 13:54:13 +0100 Subject: [PATCH 003/113] Check trustisrisk tag in trust increasing MTX --- test/trust_is_risk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index e109536..a8a1693 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -206,6 +206,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); + trustOutput.script.get(3).should.equal(tag); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From e36468c8dfa4d89d38b387fa33a17f77992630f7 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 5 Sep 2017 13:58:27 +0100 Subject: [PATCH 004/113] Add provisional tag --- src/trust_is_risk.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index d92a947..c8aef90 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,6 +13,10 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); +const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // +const ripemdTag1 = "1"; //TODO +const tag = "1111111111111111111111111111111111"; // + class TrustIsRisk { node : bcoin$FullNode db : TrustDB From 3a7eea6ab639cf7ed7b2b5ea5a1b57cf85960727 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 5 Sep 2017 13:58:55 +0100 Subject: [PATCH 005/113] Add tag to trust increasing MTX --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index c8aef90..8939c47 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -86,7 +86,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 2, [originPubKey, dest]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, tag]), value: trustAmount }) ] From 6efd6fe1c5bc6d5e108c5e0a39874e03658a3da5 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 12:08:19 +0100 Subject: [PATCH 006/113] Turn tag from String to Buffer --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 8939c47..50bf4f2 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -15,7 +15,7 @@ var DirectTrust = require("./direct_trust"); const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // const ripemdTag1 = "1"; //TODO -const tag = "1111111111111111111111111111111111"; // +const tag = Buffer.from("1111111111111111111111111111111111"); // class TrustIsRisk { node : bcoin$FullNode From f5682949a7504d3c8238fcdb0cf08a9e5f7989c1 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 12:31:09 +0100 Subject: [PATCH 007/113] Comment out "trustisrisk" tag creation commands A provisional tag is currently used, the correct tag creation procedure will be implemented later. --- src/trust_is_risk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 50bf4f2..fd730fd 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,9 +13,9 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // -const ripemdTag1 = "1"; //TODO -const tag = Buffer.from("1111111111111111111111111111111111"); // +//const ripemdTag = bcoin.crypto.hash160("trustisrisk"); +//const ripemdTag1 = "1"; TOFIX +const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { node : bcoin$FullNode From 89b25a0cc1a084496985dea19ef8d7a148087306 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 13:49:29 +0100 Subject: [PATCH 008/113] Random change Done to check if Travis CI sees the commented out lines --- src/trust_is_risk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index fd730fd..184cd9c 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,8 +13,8 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -//const ripemdTag = bcoin.crypto.hash160("trustisrisk"); -//const ripemdTag1 = "1"; TOFIX +// const ripemdTag = bcoin.crypto.hash160("trustisrisk"); +// const ripemdTag1 = "1"; TOFIX const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { From 81e7df46d4a0ca88f60161396dfeeadfc4f4af6e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 14:09:52 +0100 Subject: [PATCH 009/113] Comment out "trustisrisk" tag in test --- test/trust_is_risk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index a8a1693..c52c132 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -13,9 +13,9 @@ var fixtures = require("./fixtures"); require("should-sinon"); const COIN = bcoin.consensus.COIN; -const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // -const ripemdTag1 = "1"; //TODO -const tag = "1111111111111111111111111111111111"; // +// const ripemdTag = bcoin.crypto.hash160("trustisrisk"); +// const ripemdTag1 = "1"; TOFIX +const tag = Buffer.from("1111111111111111111111111111111111"); describe("TrustIsRisk", () => { var addr = {}; From f0b1880ef1fb19bdc802b874ed2aafb3ed6c63bb Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 14:32:13 +0100 Subject: [PATCH 010/113] Replace "equal" with "deepEqual" --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index c52c132..0be50c3 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -206,7 +206,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.equal(tag); + trustOutput.script.get(3).should.deepEqual(tag); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From 826cd8e20fa8dd4b44a39f629dcc1b8a41126ad6 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 15:05:39 +0100 Subject: [PATCH 011/113] Add tag to getTrustDecreasingMTX() --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 184cd9c..f346e7e 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -168,7 +168,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 2, [directTrust.origin, directTrust.dest]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, tag]), value: remainingTrustAmount })); } From 8c369e5fd9f833e9e1039189510b69bb449cddce Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 15:27:06 +0100 Subject: [PATCH 012/113] Add provisional "trustisrisk" tag --- test/helpers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/helpers.js b/test/helpers.js index d38b350..349aa11 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -5,6 +5,10 @@ var fixtures = require("./fixtures"); var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); +// const ripemdTag = bcoin.crypto.hash160("trustisrisk"); +// const ripemdTag1 = "1"; TOFIX +const tag = Buffer.from("1111111111111111111111111111111111"); + var testHelpers = { getNode: async () => { var node = new TrustIsRisk.FullNode({network: "regtest", passphrase: "secret"}); From e6ec7f006678e2a02a6a730c166a539e0c0cc741 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Thu, 7 Sep 2017 15:27:27 +0100 Subject: [PATCH 013/113] Add tag to getOneOfThreeMultisigOutput() --- test/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers.js b/test/helpers.js index 349aa11..4f33917 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -88,7 +88,7 @@ var testHelpers = { getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { return new bcoin.primitives.Output({ - script: bcoin.script.fromMultisig(1, 2, [originPubKey, destPubKey]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), value }); }, From 5d35bc8dbb09f3492f1f161d1e51ac28184694e3 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 8 Sep 2017 15:35:47 +0100 Subject: [PATCH 014/113] Add publicKeyArray which contains "Trust is Risk" --- src/trust_is_risk.js | 1 + test/helpers.js | 1 + test/trust_is_risk.js | 1 + 3 files changed, 3 insertions(+) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index f346e7e..0f2c057 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -15,6 +15,7 @@ var DirectTrust = require("./direct_trust"); // const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // const ripemdTag1 = "1"; TOFIX +const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { diff --git a/test/helpers.js b/test/helpers.js index 4f33917..a32302a 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -7,6 +7,7 @@ var assert = require("assert"); // const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // const ripemdTag1 = "1"; TOFIX +const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const tag = Buffer.from("1111111111111111111111111111111111"); var testHelpers = { diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 0be50c3..c1b04f8 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -15,6 +15,7 @@ require("should-sinon"); const COIN = bcoin.consensus.COIN; // const ripemdTag = bcoin.crypto.hash160("trustisrisk"); // const ripemdTag1 = "1"; TOFIX +const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const tag = Buffer.from("1111111111111111111111111111111111"); describe("TrustIsRisk", () => { From f498dd8d9383f6a771978c867d64dde9ac6eb1bb Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 17:46:17 +0100 Subject: [PATCH 015/113] Add public key to addres conversion --- src/trust_is_risk.js | 13 ++++++++++--- test/helpers.js | 13 ++++++++++--- test/trust_is_risk.js | 13 ++++++++++--- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 0f2c057..f712b69 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,10 +13,17 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -// const ripemdTag = bcoin.crypto.hash160("trustisrisk"); -// const ripemdTag1 = "1"; TOFIX const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const tag = Buffer.from("1111111111111111111111111111111111"); +const publicKey = Buffer.from(publicKeyArray); +const step2 = bcoin.crypto.sha256(publicKey); +const step3 = bcoin.crypto.ripemd160(step2); +const step4 = Buffer.concat([buffer.Buffer.alloc(1), step3]); +const step5 = bcoin.crypto.sha256(step4); +const step6 = bcoin.crypto.sha256(step5); +const step7 = step6.slice(0, 4); +const step8 = Buffer.concat([step4, step7]); +const tag = bcoin.base58.encode(step8); +// const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { node : bcoin$FullNode diff --git a/test/helpers.js b/test/helpers.js index a32302a..9a5c195 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -5,10 +5,17 @@ var fixtures = require("./fixtures"); var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); -// const ripemdTag = bcoin.crypto.hash160("trustisrisk"); -// const ripemdTag1 = "1"; TOFIX const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const tag = Buffer.from("1111111111111111111111111111111111"); +const publicKey = Buffer.from(publicKeyArray); +const step2 = bcoin.crypto.sha256(publicKey); +const step3 = bcoin.crypto.ripemd160(step2); +const step4 = Buffer.concat([buffer.Buffer.alloc(1), step3]); +const step5 = bcoin.crypto.sha256(step4); +const step6 = bcoin.crypto.sha256(step5); +const step7 = step6.slice(0, 4); +const step8 = Buffer.concat([step4, step7]); +const tag = bcoin.base58.encode(step8); +// const tag = Buffer.from("1111111111111111111111111111111111"); var testHelpers = { getNode: async () => { diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index c1b04f8..1faf20a 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -13,10 +13,17 @@ var fixtures = require("./fixtures"); require("should-sinon"); const COIN = bcoin.consensus.COIN; -// const ripemdTag = bcoin.crypto.hash160("trustisrisk"); -// const ripemdTag1 = "1"; TOFIX const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const tag = Buffer.from("1111111111111111111111111111111111"); +const publicKey = Buffer.from(publicKeyArray); +const step2 = bcoin.crypto.sha256(publicKey); +const step3 = bcoin.crypto.ripemd160(step2); +const step4 = Buffer.concat([buffer.Buffer.alloc(1), step3]); +const step5 = bcoin.crypto.sha256(step4); +const step6 = bcoin.crypto.sha256(step5); +const step7 = step6.slice(0, 4); +const step8 = Buffer.concat([step4, step7]); +const tag = bcoin.base58.encode(step8); +// const tag = Buffer.from("1111111111111111111111111111111111"); describe("TrustIsRisk", () => { var addr = {}; From ac64cfc44358ebb61b4ba1fea338dffa4ec64cb5 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 17:59:08 +0100 Subject: [PATCH 016/113] Replace buffer.Buffer with Buffer --- src/trust_is_risk.js | 2 +- test/helpers.js | 2 +- test/trust_is_risk.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index f712b69..17f9534 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -17,9 +17,9 @@ const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x const publicKey = Buffer.from(publicKeyArray); const step2 = bcoin.crypto.sha256(publicKey); const step3 = bcoin.crypto.ripemd160(step2); -const step4 = Buffer.concat([buffer.Buffer.alloc(1), step3]); const step5 = bcoin.crypto.sha256(step4); const step6 = bcoin.crypto.sha256(step5); +const step4 = Buffer.concat([Buffer.alloc(1), step3]); const step7 = step6.slice(0, 4); const step8 = Buffer.concat([step4, step7]); const tag = bcoin.base58.encode(step8); diff --git a/test/helpers.js b/test/helpers.js index 9a5c195..e6b250f 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -9,9 +9,9 @@ const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x const publicKey = Buffer.from(publicKeyArray); const step2 = bcoin.crypto.sha256(publicKey); const step3 = bcoin.crypto.ripemd160(step2); -const step4 = Buffer.concat([buffer.Buffer.alloc(1), step3]); const step5 = bcoin.crypto.sha256(step4); const step6 = bcoin.crypto.sha256(step5); +const step4 = Buffer.concat([Buffer.alloc(1), step3]); const step7 = step6.slice(0, 4); const step8 = Buffer.concat([step4, step7]); const tag = bcoin.base58.encode(step8); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 1faf20a..950ef38 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -17,9 +17,9 @@ const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x const publicKey = Buffer.from(publicKeyArray); const step2 = bcoin.crypto.sha256(publicKey); const step3 = bcoin.crypto.ripemd160(step2); -const step4 = Buffer.concat([buffer.Buffer.alloc(1), step3]); const step5 = bcoin.crypto.sha256(step4); const step6 = bcoin.crypto.sha256(step5); +const step4 = Buffer.concat([Buffer.alloc(1), step3]); const step7 = step6.slice(0, 4); const step8 = Buffer.concat([step4, step7]); const tag = bcoin.base58.encode(step8); From b2f2b315ede6f99d490183a727770daf905a9fe3 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 17:59:50 +0100 Subject: [PATCH 017/113] Require crypto and base58 from bcoin --- src/trust_is_risk.js | 12 +- test/helpers.js | 12 +- test/trust_is_risk.js | 395 ------------------------------------------ 3 files changed, 14 insertions(+), 405 deletions(-) delete mode 100644 test/trust_is_risk.js diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 17f9534..10b77bf 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -12,17 +12,19 @@ var assert = require("assert"); var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); +var crypto = require("bcoin/lib/crypto"); +var base58 = require("bcoin/lib/utils/base58"); const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const publicKey = Buffer.from(publicKeyArray); -const step2 = bcoin.crypto.sha256(publicKey); -const step3 = bcoin.crypto.ripemd160(step2); -const step5 = bcoin.crypto.sha256(step4); -const step6 = bcoin.crypto.sha256(step5); +const step2 = crypto.sha256(publicKey); +const step3 = crypto.ripemd160(step2); const step4 = Buffer.concat([Buffer.alloc(1), step3]); +const step5 = crypto.sha256(step4); +const step6 = crypto.sha256(step5); const step7 = step6.slice(0, 4); const step8 = Buffer.concat([step4, step7]); -const tag = bcoin.base58.encode(step8); +const tag = base58.encode(step8); // const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { diff --git a/test/helpers.js b/test/helpers.js index e6b250f..688c329 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -4,17 +4,19 @@ var bcoin = require("bcoin"); var fixtures = require("./fixtures"); var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); +var crypto = require("bcoin/lib/crypto"); +var base58 = require("bcoin/lib/utils/base58"); const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const publicKey = Buffer.from(publicKeyArray); -const step2 = bcoin.crypto.sha256(publicKey); -const step3 = bcoin.crypto.ripemd160(step2); -const step5 = bcoin.crypto.sha256(step4); -const step6 = bcoin.crypto.sha256(step5); +const step2 = crypto.sha256(publicKey); +const step3 = crypto.ripemd160(step2); const step4 = Buffer.concat([Buffer.alloc(1), step3]); +const step5 = crypto.sha256(step4); +const step6 = crypto.sha256(step5); const step7 = step6.slice(0, 4); const step8 = Buffer.concat([step4, step7]); -const tag = bcoin.base58.encode(step8); +const tag = base58.encode(step8); // const tag = Buffer.from("1111111111111111111111111111111111"); var testHelpers = { diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js deleted file mode 100644 index 950ef38..0000000 --- a/test/trust_is_risk.js +++ /dev/null @@ -1,395 +0,0 @@ -var Trust = require("../"); -var helpers = require("../lib/helpers.js"); -var bcoin = require("bcoin"); -var Coin = bcoin.primitives.Coin; -var Address = bcoin.primitives.Address; -var Input = bcoin.primitives.Input; -var MTX = bcoin.primitives.MTX; -var testHelpers = require("./helpers"); -var consensus = require("bcoin/lib/protocol/consensus"); -var sinon = require("sinon"); -var should = require("should"); -var fixtures = require("./fixtures"); -require("should-sinon"); - -const COIN = bcoin.consensus.COIN; -const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const publicKey = Buffer.from(publicKeyArray); -const step2 = bcoin.crypto.sha256(publicKey); -const step3 = bcoin.crypto.ripemd160(step2); -const step5 = bcoin.crypto.sha256(step4); -const step6 = bcoin.crypto.sha256(step5); -const step4 = Buffer.concat([Buffer.alloc(1), step3]); -const step7 = step6.slice(0, 4); -const step8 = Buffer.concat([step4, step7]); -const tag = bcoin.base58.encode(step8); -// const tag = Buffer.from("1111111111111111111111111111111111"); - -describe("TrustIsRisk", () => { - var addr = {}; - for (let [name, keyRing] of Object.entries(fixtures.keyRings)) { - var pubKey = keyRing.getPublicKey(); - var privKey = keyRing.getPrivateKey(); - - addr[name] = {}; - addr[name].pubKey = pubKey; - addr[name].privKey = privKey; - addr[name].base58 = bcoin.primitives.Address.fromHash(bcoin.crypto.hash160(pubKey)).toString(); - } - - // Add base58 address variables to scope. - for (name in fixtures.keyRings) { - var keyRing = fixtures.keyRings[name]; - eval(`var ${name} = "${bcoin.primitives.Address.fromHash(bcoin.crypto.hash160(keyRing.getPublicKey())).toString()}";`); - } - - var node, tir, trustIncreasingMTX, trustDecreasingMTX, trustIncreasingTX; - beforeEach(() => { - node = new bcoin.fullnode({}); - tir = new Trust.TrustIsRisk(node); - - trustIncreasingMTX = testHelpers.getTrustIncreasingMTX(addr.alice.pubKey, addr.bob.pubKey, 42 * COIN); - trustIncreasingTX = trustIncreasingMTX.toTX(); - - var inputOneOfThreeMultisig = new Input({ - prevout: { - hash: trustIncreasingTX.hash().toString("hex"), - index: 0 - }, - script: bcoin.script.fromString( - // 17P8kCbDBPmqLDCCe9dYwbfiEDaRb5xDYE - "0x47 0x3044022035e32834c6ee4db1696cc06762feca2809d865ca12a3b98c801f3f451341a2570220573bf3ffef55f2651e1563acc0a22f8056222f277f5ddf17dd583d4edd40fa6001 0x21 0x02b8f07a401eca4888039b1898f94db44c43ccc6d3aa8b27e9b6ed7b377b24c083") - }); - - trustDecreasingMTX = new MTX({ - inputs: [ - inputOneOfThreeMultisig - ], - outputs: [ - testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 20 * COIN), - testHelpers.getP2PKHOutput(addr.alice.base58, 22 * COIN) - ] - }); - }); - - describe(".getDirectTrust()", () => { - it("returns zero for two arbitary parties that do not trust each other", () => { - tir.getDirectTrust(alice, bob).should.equal(0); - tir.getDirectTrust(bob, alice).should.equal(0); - tir.getDirectTrust(charlie, alice).should.equal(0); - tir.getDirectTrust(alice, charlie).should.equal(0); - tir.getDirectTrust(charlie, frank).should.equal(0); - }); - - it("returns Infinity for one's direct trust to themselves", () => { - tir.getDirectTrust(alice, alice).should.equal(Infinity); - tir.getDirectTrust(bob, bob).should.equal(Infinity); - }); - }); - - describe(".addTX()", () => { - describe("with a non-TIR transaction", () => { - it("does not change trust", () => { - trustIncreasingMTX.outputs[0] = testHelpers.getP2PKHOutput(charlie, 50 * COIN); - tir.addTX(trustIncreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(0); - tir.getDirectTrust(bob, alice).should.equal(0); - tir.getDirectTrust(alice, charlie).should.equal(0); - tir.getDirectTrust(charlie, alice).should.equal(0); - tir.getDirectTrust(charlie, dave).should.equal(0); - }); - }); - - describe("with a trust increasing transaction", () => { - it("correctly increases trust", () => { - tir.addTX(trustIncreasingTX); - - tir.getDirectTrust(alice, bob).should.equal(42 * COIN); - tir.getDirectTrust(bob, alice).should.equal(0); - tir.getDirectTrust(charlie, dave).should.equal(0); - }); - - it("which has more than one input does not change trust", () => { - trustIncreasingMTX.inputs.push(trustIncreasingMTX.inputs[0].clone()); - tir.addTX(trustIncreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(0); - }); - - it("which has a change output correctly increases trust", () => { - trustIncreasingMTX.outputs[0].value -= 10 * COIN; - trustIncreasingMTX.outputs.push(testHelpers.getP2PKHOutput(alice, 10 * COIN)); - tir.addTX(trustIncreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(32 * COIN); - }); - - it("which has two change outputs does not change trust", () => { - trustIncreasingMTX.outputs[0].value -= 10; - for (var i = 0; i < 2; i++) { - trustIncreasingMTX.outputs.push(testHelpers.getP2PKHOutput(alice, 5 * COIN)); - } - tir.addTX(trustIncreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(0); - }); - - it("which has a second output that is not a change output does not change trust", () => { - trustIncreasingMTX.outputs[0].value -= 10 * COIN; - trustIncreasingMTX.outputs.push(testHelpers.getP2PKHOutput(charlie, 5 * COIN)); - tir.addTX(trustIncreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(0); - }); - - it("which has been processed before throws", () => { - var tx = trustIncreasingMTX.toTX(); - should(tir.addTX(tx)); - should.throws(() => tir.addTX(tx), /already processed/i); - tir.getDirectTrust(alice, bob).should.equal(42 * COIN); - }); - }); - - describe("with a trust decreasing transaction", () => { - beforeEach(() => { - tir.addTX(trustIncreasingTX); - }); - - it("correctly decreases trust", () => { - tir.addTX(trustDecreasingMTX.toTX()); - tir.getDirectTrust(alice, bob).should.equal(20 * COIN); - }); - - it("decreases trust to zero for trust decreasing transactions with a wrong recipient", () => { - // By changing the trust recipient from bob to charlie, we make the transaction a - // nullifying trust transaction. - trustDecreasingMTX.outputs[0] = - testHelpers.getOneOfTwoMultisigOutput(addr.alice.pubKey, addr.charlie.pubKey, 20 * COIN); - - tir.addTX(trustDecreasingMTX.toTX()); - tir.getDirectTrust(alice, bob).should.equal(0); - }); - - it("which has a second input decreases trust to zero", () => { - trustDecreasingMTX.inputs.push(testHelpers.getP2PKHInput(addr.alice.pubKey)); - tir.addTX(trustDecreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(0); - }); - - it("which has more than one trust outputs decreases trust to zero", () => { - trustDecreasingMTX.outputs[0].value -= 15 * COIN; - trustDecreasingMTX.outputs.push( - testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 5 * COIN)); - tir.addTX(trustDecreasingMTX.toTX()); - - tir.getDirectTrust(alice, bob).should.equal(0); - }); - }); - }); - - describe(".createTrustIncreasingMTX()", () => { - it("creates valid trust-increasing transactions", async () => { - var getTXStub = sinon.stub(node, "getCoin"); - - var prevOutput = { - hash: "v1pnhp2af4r5wz63j60vnh27s1bftl260qq621y458tn0g4x64u64yqz6d7qi6i8", - index: 1 - }; - - getTXStub.withArgs(prevOutput.hash).returns(new Coin({ - script: testHelpers.getP2PKHOutput(alice, 1).script, - value: 1000 * COIN - })); - - var mtx = await tir.createTrustIncreasingMTX(addr.alice.privKey, addr.bob.pubKey, prevOutput, - 100 * COIN); - - mtx.inputs.length.should.equal(1); - - mtx.outputs.length.should.equal(2); - - var trustOutput = mtx.outputs[0]; - trustOutput.getType().should.equal("multisig"); - [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() - .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.deepEqual(tag); - trustOutput.value.should.equal(100 * COIN); - - var changeOutput = mtx.outputs[1]; - changeOutput.getType().should.equal("pubkeyhash"); - changeOutput.getAddress().toBase58().should.equal(alice); - changeOutput.value.should.equal(900 * COIN - 1000); - }); - }); - - describe(".getTrustDecreasingMTX()", () => { - var trustTXs; - beforeEach(() => { - var tx; - trustTXs = []; - - tx = trustIncreasingTX; - trustTXs.push(tx); - tir.addTX(tx); - - trustIncreasingMTX.outputs[0].value = 100 * COIN; - tx = trustIncreasingMTX.toTX(); - trustTXs.push(tx); - tir.addTX(tx); - - trustIncreasingMTX.outputs[0].value = 500 * COIN; - tx = trustIncreasingMTX.toTX(); - trustTXs.push(tx); - tir.addTX(tx); - - // Total trust 642 BTC - }); - - // Helper specific to the next couple of tests: - // Checks that mtxs is a list of two trust decreasing transactions. The first one spends the - // entire first trust increasing transaction, and the second spends part of the second. - // Also checks that the reduced trust is sent via P2PKH outputs to the correct recipient. - var checkMTXs = (mtxs, recipient) => { - mtxs.length.should.equal(2); - - var mtx = mtxs[0]; - - mtx.inputs.length.should.equal(1); - mtx.inputs[0].prevout.should.have.properties({ - hash: trustTXs[0].hash().toString("hex"), - index: 0 - }); - - mtx.outputs.length.should.equal(1); // Single P2PKH output - mtx.outputs[0].getType().should.equal("pubkeyhash"); - mtx.outputs[0].getAddress().toBase58().should.equal(recipient); - mtx.outputs[0].value.should.equal(42 * COIN - 1000); - - mtx = mtxs[1]; - - mtx.inputs.length.should.equal(1); - mtx.inputs[0].prevout.should.have.properties({ - hash: trustTXs[1].hash().toString("hex"), - index: 0 - }); - - mtx.outputs.length.should.equal(2); // One P2PKH output and one multisig trust output - mtx.outputs[1].script.toString().should.equal(trustTXs[1].outputs[0].script.toString()); - mtx.outputs[1].value.should.equal(60 * COIN); - mtx.outputs[0].getType().should.equal("pubkeyhash"); - mtx.outputs[0].getAddress().toBase58().should.equal(recipient); - mtx.outputs[0].value.should.equal(40 * COIN - 1000); - }; - - it("creates correct trust decreasing transactions", () => { - var mtxs = tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.bob.pubKey, 82 * COIN); - checkMTXs(mtxs, alice); - }); - - it("creates correct trust stealing transactions", () => { - var mtxs = tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.bob.pubKey, 82 * COIN, charlie); - checkMTXs(mtxs, charlie); - }); - - it("throws when trying to decrease self-trust", () => { - should.throws(() => tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.alice.pubKey, 10 * COIN) - , /self-trust/i); - }); - - it("throws when there is not enough trust", () => { - should.throws(() => tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.bob.pubKey, 700 * COIN) - , /insufficient trust/i); - - }); - }); - - describe(".getIndirectTrust()", () => { - it("returns zero for two arbitary parties that do not trust each other", () => { - should(tir.getIndirectTrust(alice, bob)).equal(0); - should(tir.getIndirectTrust(bob, alice)).equal(0); - should(tir.getIndirectTrust(charlie, alice)).equal(0); - should(tir.getIndirectTrust(alice, charlie)).equal(0); - }); - - it("returns Infinity for one's trust to themselves", () => { - should(tir.getIndirectTrust(alice, alice)).equal(Infinity); - should(tir.getIndirectTrust(bob, bob)).equal(Infinity); - }); - - describe("after applying the Nobody Likes Frank graph example", () => { - beforeEach(() => { - testHelpers.applyGraph(tir, "./graphs/nobodyLikesFrank.json", addr); - }); - - it("correctly computes trusts", () => { - should(tir.getIndirectTrust(alice, alice)).equal(Infinity); - should(tir.getIndirectTrust(alice, bob)).equal(10); - should(tir.getIndirectTrust(alice, charlie)).equal(1); - should(tir.getIndirectTrust(alice, dave)).equal(4); - should(tir.getIndirectTrust(alice, eve)).equal(6); - should(tir.getIndirectTrust(alice, frank)).equal(0); - should(tir.getIndirectTrust(alice, george)).equal(2); - - should(tir.getIndirectTrust(bob, alice)).equal(1); - should(tir.getIndirectTrust(bob, bob)).equal(Infinity); - should(tir.getIndirectTrust(bob, charlie)).equal(1); - should(tir.getIndirectTrust(bob, dave)).equal(1); - should(tir.getIndirectTrust(bob, eve)).equal(3); - should(tir.getIndirectTrust(bob, frank)).equal(0); - should(tir.getIndirectTrust(bob, george)).equal(2); - - should(tir.getIndirectTrust(charlie, alice)).equal(0); - should(tir.getIndirectTrust(charlie, bob)).equal(0); - should(tir.getIndirectTrust(charlie, charlie)).equal(Infinity); - should(tir.getIndirectTrust(charlie, dave)).equal(0); - should(tir.getIndirectTrust(charlie, eve)).equal(0); - should(tir.getIndirectTrust(charlie, frank)).equal(0); - should(tir.getIndirectTrust(charlie, george)).equal(3); - - should(tir.getIndirectTrust(dave, alice)).equal(2); - should(tir.getIndirectTrust(dave, bob)).equal(2); - should(tir.getIndirectTrust(dave, charlie)).equal(1); - should(tir.getIndirectTrust(dave, dave)).equal(Infinity); - should(tir.getIndirectTrust(dave, eve)).equal(12); - should(tir.getIndirectTrust(dave, frank)).equal(0); - should(tir.getIndirectTrust(dave, george)).equal(2); - - should(tir.getIndirectTrust(eve, alice)).equal(0); - should(tir.getIndirectTrust(eve, bob)).equal(0); - should(tir.getIndirectTrust(eve, charlie)).equal(0); - should(tir.getIndirectTrust(eve, dave)).equal(0); - should(tir.getIndirectTrust(eve, eve)).equal(Infinity); - should(tir.getIndirectTrust(eve, frank)).equal(0); - should(tir.getIndirectTrust(eve, george)).equal(0); - - should(tir.getIndirectTrust(frank, alice)).equal(0); - should(tir.getIndirectTrust(frank, bob)).equal(0); - should(tir.getIndirectTrust(frank, charlie)).equal(10); - should(tir.getIndirectTrust(frank, dave)).equal(0); - should(tir.getIndirectTrust(frank, eve)).equal(0); - should(tir.getIndirectTrust(frank, frank)).equal(Infinity); - should(tir.getIndirectTrust(frank, george)).equal(3); - - should(tir.getIndirectTrust(george, alice)).equal(0); - should(tir.getIndirectTrust(george, bob)).equal(0); - should(tir.getIndirectTrust(george, charlie)).equal(0); - should(tir.getIndirectTrust(george, dave)).equal(0); - should(tir.getIndirectTrust(george, eve)).equal(0); - should(tir.getIndirectTrust(george, frank)).equal(0); - should(tir.getIndirectTrust(george, george)).equal(Infinity); - }); - - it("correctly computes trusts when bob trusts frank", () => { - tir.addTX(testHelpers.getTrustIncreasingMTX(addr.bob.pubKey, addr.frank.pubKey, 8).toTX()); - should(tir.getIndirectTrust(george, frank)).equal(0); - should(tir.getIndirectTrust(alice, frank)).equal(8); - should(tir.getIndirectTrust(dave, frank)).equal(2); - should(tir.getIndirectTrust(bob, frank)).equal(8); - }); - - // TODO: Decrement direct trusts and test that indirect trusts update correctly - }); - }); -}); From 247dc436b559fd1a96b469d447b280e53fa68385 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 18:05:02 +0100 Subject: [PATCH 018/113] Set i in {crypto,base58} as bcoin.$i --- src/trust_is_risk.js | 4 +- test/helpers.js | 4 +- test/trust_is_risk.js | 397 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 401 insertions(+), 4 deletions(-) create mode 100644 test/trust_is_risk.js diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 10b77bf..a2c7db7 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -12,8 +12,8 @@ var assert = require("assert"); var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -var crypto = require("bcoin/lib/crypto"); -var base58 = require("bcoin/lib/utils/base58"); +var crypto = bcoin.crypto; +var base58 = bcoin.base58; const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const publicKey = Buffer.from(publicKeyArray); diff --git a/test/helpers.js b/test/helpers.js index 688c329..bbf3864 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -4,8 +4,8 @@ var bcoin = require("bcoin"); var fixtures = require("./fixtures"); var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); -var crypto = require("bcoin/lib/crypto"); -var base58 = require("bcoin/lib/utils/base58"); +var crypto = bcoin.crypto; +var base58 = bcoin.base58; const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const publicKey = Buffer.from(publicKeyArray); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js new file mode 100644 index 0000000..32c5bbf --- /dev/null +++ b/test/trust_is_risk.js @@ -0,0 +1,397 @@ +var Trust = require("../"); +var helpers = require("../lib/helpers.js"); +var bcoin = require("bcoin"); +var Coin = bcoin.primitives.Coin; +var Address = bcoin.primitives.Address; +var Input = bcoin.primitives.Input; +var MTX = bcoin.primitives.MTX; +var testHelpers = require("./helpers"); +var consensus = require("bcoin/lib/protocol/consensus"); +var sinon = require("sinon"); +var should = require("should"); +var fixtures = require("./fixtures"); +var crypto = require("bcoin/lib/crypto"); +var base58 = require("bcoin/lib/utils/base58"); +require("should-sinon"); + +const COIN = bcoin.consensus.COIN; +const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const publicKey = Buffer.from(publicKeyArray); +const step2 = crypto.sha256(publicKey); +const step3 = crypto.ripemd160(step2); +const step4 = Buffer.concat([Buffer.alloc(1), step3]); +const step5 = crypto.sha256(step4); +const step6 = crypto.sha256(step5); +const step7 = step6.slice(0, 4); +const step8 = Buffer.concat([step4, step7]); +const tag = base58.encode(step8); +// const tag = Buffer.from("1111111111111111111111111111111111"); + +describe("TrustIsRisk", () => { + var addr = {}; + for (let [name, keyRing] of Object.entries(fixtures.keyRings)) { + var pubKey = keyRing.getPublicKey(); + var privKey = keyRing.getPrivateKey(); + + addr[name] = {}; + addr[name].pubKey = pubKey; + addr[name].privKey = privKey; + addr[name].base58 = bcoin.primitives.Address.fromHash(bcoin.crypto.hash160(pubKey)).toString(); + } + + // Add base58 address variables to scope. + for (name in fixtures.keyRings) { + var keyRing = fixtures.keyRings[name]; + eval(`var ${name} = "${bcoin.primitives.Address.fromHash(bcoin.crypto.hash160(keyRing.getPublicKey())).toString()}";`); + } + + var node, tir, trustIncreasingMTX, trustDecreasingMTX, trustIncreasingTX; + beforeEach(() => { + node = new bcoin.fullnode({}); + tir = new Trust.TrustIsRisk(node); + + trustIncreasingMTX = testHelpers.getTrustIncreasingMTX(addr.alice.pubKey, addr.bob.pubKey, 42 * COIN); + trustIncreasingTX = trustIncreasingMTX.toTX(); + + var inputOneOfThreeMultisig = new Input({ + prevout: { + hash: trustIncreasingTX.hash().toString("hex"), + index: 0 + }, + script: bcoin.script.fromString( + // 17P8kCbDBPmqLDCCe9dYwbfiEDaRb5xDYE + "0x47 0x3044022035e32834c6ee4db1696cc06762feca2809d865ca12a3b98c801f3f451341a2570220573bf3ffef55f2651e1563acc0a22f8056222f277f5ddf17dd583d4edd40fa6001 0x21 0x02b8f07a401eca4888039b1898f94db44c43ccc6d3aa8b27e9b6ed7b377b24c083") + }); + + trustDecreasingMTX = new MTX({ + inputs: [ + inputOneOfThreeMultisig + ], + outputs: [ + testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 20 * COIN), + testHelpers.getP2PKHOutput(addr.alice.base58, 22 * COIN) + ] + }); + }); + + describe(".getDirectTrust()", () => { + it("returns zero for two arbitary parties that do not trust each other", () => { + tir.getDirectTrust(alice, bob).should.equal(0); + tir.getDirectTrust(bob, alice).should.equal(0); + tir.getDirectTrust(charlie, alice).should.equal(0); + tir.getDirectTrust(alice, charlie).should.equal(0); + tir.getDirectTrust(charlie, frank).should.equal(0); + }); + + it("returns Infinity for one's direct trust to themselves", () => { + tir.getDirectTrust(alice, alice).should.equal(Infinity); + tir.getDirectTrust(bob, bob).should.equal(Infinity); + }); + }); + + describe(".addTX()", () => { + describe("with a non-TIR transaction", () => { + it("does not change trust", () => { + trustIncreasingMTX.outputs[0] = testHelpers.getP2PKHOutput(charlie, 50 * COIN); + tir.addTX(trustIncreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(0); + tir.getDirectTrust(bob, alice).should.equal(0); + tir.getDirectTrust(alice, charlie).should.equal(0); + tir.getDirectTrust(charlie, alice).should.equal(0); + tir.getDirectTrust(charlie, dave).should.equal(0); + }); + }); + + describe("with a trust increasing transaction", () => { + it("correctly increases trust", () => { + tir.addTX(trustIncreasingTX); + + tir.getDirectTrust(alice, bob).should.equal(42 * COIN); + tir.getDirectTrust(bob, alice).should.equal(0); + tir.getDirectTrust(charlie, dave).should.equal(0); + }); + + it("which has more than one input does not change trust", () => { + trustIncreasingMTX.inputs.push(trustIncreasingMTX.inputs[0].clone()); + tir.addTX(trustIncreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(0); + }); + + it("which has a change output correctly increases trust", () => { + trustIncreasingMTX.outputs[0].value -= 10 * COIN; + trustIncreasingMTX.outputs.push(testHelpers.getP2PKHOutput(alice, 10 * COIN)); + tir.addTX(trustIncreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(32 * COIN); + }); + + it("which has two change outputs does not change trust", () => { + trustIncreasingMTX.outputs[0].value -= 10; + for (var i = 0; i < 2; i++) { + trustIncreasingMTX.outputs.push(testHelpers.getP2PKHOutput(alice, 5 * COIN)); + } + tir.addTX(trustIncreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(0); + }); + + it("which has a second output that is not a change output does not change trust", () => { + trustIncreasingMTX.outputs[0].value -= 10 * COIN; + trustIncreasingMTX.outputs.push(testHelpers.getP2PKHOutput(charlie, 5 * COIN)); + tir.addTX(trustIncreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(0); + }); + + it("which has been processed before throws", () => { + var tx = trustIncreasingMTX.toTX(); + should(tir.addTX(tx)); + should.throws(() => tir.addTX(tx), /already processed/i); + tir.getDirectTrust(alice, bob).should.equal(42 * COIN); + }); + }); + + describe("with a trust decreasing transaction", () => { + beforeEach(() => { + tir.addTX(trustIncreasingTX); + }); + + it("correctly decreases trust", () => { + tir.addTX(trustDecreasingMTX.toTX()); + tir.getDirectTrust(alice, bob).should.equal(20 * COIN); + }); + + it("decreases trust to zero for trust decreasing transactions with a wrong recipient", () => { + // By changing the trust recipient from bob to charlie, we make the transaction a + // nullifying trust transaction. + trustDecreasingMTX.outputs[0] = + testHelpers.getOneOfTwoMultisigOutput(addr.alice.pubKey, addr.charlie.pubKey, 20 * COIN); + + tir.addTX(trustDecreasingMTX.toTX()); + tir.getDirectTrust(alice, bob).should.equal(0); + }); + + it("which has a second input decreases trust to zero", () => { + trustDecreasingMTX.inputs.push(testHelpers.getP2PKHInput(addr.alice.pubKey)); + tir.addTX(trustDecreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(0); + }); + + it("which has more than one trust outputs decreases trust to zero", () => { + trustDecreasingMTX.outputs[0].value -= 15 * COIN; + trustDecreasingMTX.outputs.push( + testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.bob.pubKey, 5 * COIN)); + tir.addTX(trustDecreasingMTX.toTX()); + + tir.getDirectTrust(alice, bob).should.equal(0); + }); + }); + }); + + describe(".createTrustIncreasingMTX()", () => { + it("creates valid trust-increasing transactions", async () => { + var getTXStub = sinon.stub(node, "getCoin"); + + var prevOutput = { + hash: "v1pnhp2af4r5wz63j60vnh27s1bftl260qq621y458tn0g4x64u64yqz6d7qi6i8", + index: 1 + }; + + getTXStub.withArgs(prevOutput.hash).returns(new Coin({ + script: testHelpers.getP2PKHOutput(alice, 1).script, + value: 1000 * COIN + })); + + var mtx = await tir.createTrustIncreasingMTX(addr.alice.privKey, addr.bob.pubKey, prevOutput, + 100 * COIN); + + mtx.inputs.length.should.equal(1); + + mtx.outputs.length.should.equal(2); + + var trustOutput = mtx.outputs[0]; + trustOutput.getType().should.equal("multisig"); + [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() + .should.deepEqual([alice, bob].sort()); + trustOutput.script.get(3).should.deepEqual(tag); + trustOutput.value.should.equal(100 * COIN); + + var changeOutput = mtx.outputs[1]; + changeOutput.getType().should.equal("pubkeyhash"); + changeOutput.getAddress().toBase58().should.equal(alice); + changeOutput.value.should.equal(900 * COIN - 1000); + }); + }); + + describe(".getTrustDecreasingMTX()", () => { + var trustTXs; + beforeEach(() => { + var tx; + trustTXs = []; + + tx = trustIncreasingTX; + trustTXs.push(tx); + tir.addTX(tx); + + trustIncreasingMTX.outputs[0].value = 100 * COIN; + tx = trustIncreasingMTX.toTX(); + trustTXs.push(tx); + tir.addTX(tx); + + trustIncreasingMTX.outputs[0].value = 500 * COIN; + tx = trustIncreasingMTX.toTX(); + trustTXs.push(tx); + tir.addTX(tx); + + // Total trust 642 BTC + }); + + // Helper specific to the next couple of tests: + // Checks that mtxs is a list of two trust decreasing transactions. The first one spends the + // entire first trust increasing transaction, and the second spends part of the second. + // Also checks that the reduced trust is sent via P2PKH outputs to the correct recipient. + var checkMTXs = (mtxs, recipient) => { + mtxs.length.should.equal(2); + + var mtx = mtxs[0]; + + mtx.inputs.length.should.equal(1); + mtx.inputs[0].prevout.should.have.properties({ + hash: trustTXs[0].hash().toString("hex"), + index: 0 + }); + + mtx.outputs.length.should.equal(1); // Single P2PKH output + mtx.outputs[0].getType().should.equal("pubkeyhash"); + mtx.outputs[0].getAddress().toBase58().should.equal(recipient); + mtx.outputs[0].value.should.equal(42 * COIN - 1000); + + mtx = mtxs[1]; + + mtx.inputs.length.should.equal(1); + mtx.inputs[0].prevout.should.have.properties({ + hash: trustTXs[1].hash().toString("hex"), + index: 0 + }); + + mtx.outputs.length.should.equal(2); // One P2PKH output and one multisig trust output + mtx.outputs[1].script.toString().should.equal(trustTXs[1].outputs[0].script.toString()); + mtx.outputs[1].value.should.equal(60 * COIN); + mtx.outputs[0].getType().should.equal("pubkeyhash"); + mtx.outputs[0].getAddress().toBase58().should.equal(recipient); + mtx.outputs[0].value.should.equal(40 * COIN - 1000); + }; + + it("creates correct trust decreasing transactions", () => { + var mtxs = tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.bob.pubKey, 82 * COIN); + checkMTXs(mtxs, alice); + }); + + it("creates correct trust stealing transactions", () => { + var mtxs = tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.bob.pubKey, 82 * COIN, charlie); + checkMTXs(mtxs, charlie); + }); + + it("throws when trying to decrease self-trust", () => { + should.throws(() => tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.alice.pubKey, 10 * COIN) + , /self-trust/i); + }); + + it("throws when there is not enough trust", () => { + should.throws(() => tir.createTrustDecreasingMTXs(addr.alice.privKey, addr.bob.pubKey, 700 * COIN) + , /insufficient trust/i); + + }); + }); + + describe(".getIndirectTrust()", () => { + it("returns zero for two arbitary parties that do not trust each other", () => { + should(tir.getIndirectTrust(alice, bob)).equal(0); + should(tir.getIndirectTrust(bob, alice)).equal(0); + should(tir.getIndirectTrust(charlie, alice)).equal(0); + should(tir.getIndirectTrust(alice, charlie)).equal(0); + }); + + it("returns Infinity for one's trust to themselves", () => { + should(tir.getIndirectTrust(alice, alice)).equal(Infinity); + should(tir.getIndirectTrust(bob, bob)).equal(Infinity); + }); + + describe("after applying the Nobody Likes Frank graph example", () => { + beforeEach(() => { + testHelpers.applyGraph(tir, "./graphs/nobodyLikesFrank.json", addr); + }); + + it("correctly computes trusts", () => { + should(tir.getIndirectTrust(alice, alice)).equal(Infinity); + should(tir.getIndirectTrust(alice, bob)).equal(10); + should(tir.getIndirectTrust(alice, charlie)).equal(1); + should(tir.getIndirectTrust(alice, dave)).equal(4); + should(tir.getIndirectTrust(alice, eve)).equal(6); + should(tir.getIndirectTrust(alice, frank)).equal(0); + should(tir.getIndirectTrust(alice, george)).equal(2); + + should(tir.getIndirectTrust(bob, alice)).equal(1); + should(tir.getIndirectTrust(bob, bob)).equal(Infinity); + should(tir.getIndirectTrust(bob, charlie)).equal(1); + should(tir.getIndirectTrust(bob, dave)).equal(1); + should(tir.getIndirectTrust(bob, eve)).equal(3); + should(tir.getIndirectTrust(bob, frank)).equal(0); + should(tir.getIndirectTrust(bob, george)).equal(2); + + should(tir.getIndirectTrust(charlie, alice)).equal(0); + should(tir.getIndirectTrust(charlie, bob)).equal(0); + should(tir.getIndirectTrust(charlie, charlie)).equal(Infinity); + should(tir.getIndirectTrust(charlie, dave)).equal(0); + should(tir.getIndirectTrust(charlie, eve)).equal(0); + should(tir.getIndirectTrust(charlie, frank)).equal(0); + should(tir.getIndirectTrust(charlie, george)).equal(3); + + should(tir.getIndirectTrust(dave, alice)).equal(2); + should(tir.getIndirectTrust(dave, bob)).equal(2); + should(tir.getIndirectTrust(dave, charlie)).equal(1); + should(tir.getIndirectTrust(dave, dave)).equal(Infinity); + should(tir.getIndirectTrust(dave, eve)).equal(12); + should(tir.getIndirectTrust(dave, frank)).equal(0); + should(tir.getIndirectTrust(dave, george)).equal(2); + + should(tir.getIndirectTrust(eve, alice)).equal(0); + should(tir.getIndirectTrust(eve, bob)).equal(0); + should(tir.getIndirectTrust(eve, charlie)).equal(0); + should(tir.getIndirectTrust(eve, dave)).equal(0); + should(tir.getIndirectTrust(eve, eve)).equal(Infinity); + should(tir.getIndirectTrust(eve, frank)).equal(0); + should(tir.getIndirectTrust(eve, george)).equal(0); + + should(tir.getIndirectTrust(frank, alice)).equal(0); + should(tir.getIndirectTrust(frank, bob)).equal(0); + should(tir.getIndirectTrust(frank, charlie)).equal(10); + should(tir.getIndirectTrust(frank, dave)).equal(0); + should(tir.getIndirectTrust(frank, eve)).equal(0); + should(tir.getIndirectTrust(frank, frank)).equal(Infinity); + should(tir.getIndirectTrust(frank, george)).equal(3); + + should(tir.getIndirectTrust(george, alice)).equal(0); + should(tir.getIndirectTrust(george, bob)).equal(0); + should(tir.getIndirectTrust(george, charlie)).equal(0); + should(tir.getIndirectTrust(george, dave)).equal(0); + should(tir.getIndirectTrust(george, eve)).equal(0); + should(tir.getIndirectTrust(george, frank)).equal(0); + should(tir.getIndirectTrust(george, george)).equal(Infinity); + }); + + it("correctly computes trusts when bob trusts frank", () => { + tir.addTX(testHelpers.getTrustIncreasingMTX(addr.bob.pubKey, addr.frank.pubKey, 8).toTX()); + should(tir.getIndirectTrust(george, frank)).equal(0); + should(tir.getIndirectTrust(alice, frank)).equal(8); + should(tir.getIndirectTrust(dave, frank)).equal(2); + should(tir.getIndirectTrust(bob, frank)).equal(8); + }); + + // TODO: Decrement direct trusts and test that indirect trusts update correctly + }); + }); +}); From 274ec2a3b3d20389811dc04370d56829b9fd278f Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 18:26:44 +0100 Subject: [PATCH 019/113] Use hash160/256 instead of ripemd/sha --- src/trust_is_risk.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index a2c7db7..e874159 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -12,19 +12,17 @@ var assert = require("assert"); var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -var crypto = bcoin.crypto; -var base58 = bcoin.base58; - const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const publicKey = Buffer.from(publicKeyArray); -const step2 = crypto.sha256(publicKey); -const step3 = crypto.ripemd160(step2); -const step4 = Buffer.concat([Buffer.alloc(1), step3]); -const step5 = crypto.sha256(step4); -const step6 = crypto.sha256(step5); -const step7 = step6.slice(0, 4); -const step8 = Buffer.concat([step4, step7]); -const tag = base58.encode(step8); + +const step2 = bcoin.crypto.hash160(pubKey); +// const step3 = crypto.ripemd160(step2); +const step3 = Buffer.concat([Buffer.alloc(1), step2]); +const step4 = crypto.hash256(step3); +// const step6 = crypto.sha256(step5); +const step5 = step4.slice(0, 4); +const step6 = Buffer.concat([step3, step5]); +const tag = base58.encode(step6); // const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { From ca938c3f0d9649329f4af753bf00d675bb60baea Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 18:27:03 +0100 Subject: [PATCH 020/113] Rename publicKey to pubKey --- src/trust_is_risk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index e874159..4fc4853 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -12,9 +12,9 @@ var assert = require("assert"); var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const publicKey = Buffer.from(publicKeyArray); +const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const pubKey = Buffer.from(pubKeyArray); const step2 = bcoin.crypto.hash160(pubKey); // const step3 = crypto.ripemd160(step2); const step3 = Buffer.concat([Buffer.alloc(1), step2]); From f695312fb456b879f85ec382dcbbad6f175e1b5f Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 9 Sep 2017 18:39:06 +0100 Subject: [PATCH 021/113] Convert step2 string to buffer --- src/trust_is_risk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 4fc4853..0be1b38 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -17,12 +17,12 @@ const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, const pubKey = Buffer.from(pubKeyArray); const step2 = bcoin.crypto.hash160(pubKey); // const step3 = crypto.ripemd160(step2); -const step3 = Buffer.concat([Buffer.alloc(1), step2]); -const step4 = crypto.hash256(step3); +const step3 = Buffer.concat([Buffer.alloc(1), Buffer.from(step2)]); +const step4 = bcoin.crypto.hash256(step3); // const step6 = crypto.sha256(step5); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); -const tag = base58.encode(step6); +const tag = bcoin.base58.encode(step6); // const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { From bfba382caaec7401e795a6b2b478d2f12777df52 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:04:51 +0100 Subject: [PATCH 022/113] Replace hash256 with two sha256 --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 0be1b38..47a5693 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -18,7 +18,7 @@ const pubKey = Buffer.from(pubKeyArray); const step2 = bcoin.crypto.hash160(pubKey); // const step3 = crypto.ripemd160(step2); const step3 = Buffer.concat([Buffer.alloc(1), Buffer.from(step2)]); -const step4 = bcoin.crypto.hash256(step3); +const step4 = bcoin.crypto.sha256(bcoin.crypto.sha256(step3)); // const step6 = crypto.sha256(step5); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); From e07ad9da16e33963b29b4217ca08fe51b30972f1 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:07:07 +0100 Subject: [PATCH 023/113] Remove "bcoin." before "crypto" --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 47a5693..1aa868f 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -18,7 +18,7 @@ const pubKey = Buffer.from(pubKeyArray); const step2 = bcoin.crypto.hash160(pubKey); // const step3 = crypto.ripemd160(step2); const step3 = Buffer.concat([Buffer.alloc(1), Buffer.from(step2)]); -const step4 = bcoin.crypto.sha256(bcoin.crypto.sha256(step3)); +const step4 = crypto.sha256(crypto.sha256(step3)); // const step6 = crypto.sha256(step5); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); From 439581e6a86373d56d1d9b4c9853955e682054e0 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:17:20 +0100 Subject: [PATCH 024/113] Use "bcoin.crypto.hash256()" --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 1aa868f..0be1b38 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -18,7 +18,7 @@ const pubKey = Buffer.from(pubKeyArray); const step2 = bcoin.crypto.hash160(pubKey); // const step3 = crypto.ripemd160(step2); const step3 = Buffer.concat([Buffer.alloc(1), Buffer.from(step2)]); -const step4 = crypto.sha256(crypto.sha256(step3)); +const step4 = bcoin.crypto.hash256(step3); // const step6 = crypto.sha256(step5); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); From d955c4fa5601ccacba6020a1c1bc807bf474c253 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:18:13 +0100 Subject: [PATCH 025/113] Add "hash256()" type --- flow-typed/npm/bcoin_vx.x.x.js | 1 + 1 file changed, 1 insertion(+) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index c6663cc..acfeeef 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -96,6 +96,7 @@ declare module 'bcoin' { }, crypto : { hash160(str : (string | Buffer)) : Hash + hash256(str : (string | Buffer)) : Hash } } } From 13bee497a4d31b80dd1604df3b4070b2d514ec90 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:21:29 +0100 Subject: [PATCH 026/113] Add missing comma (,) --- flow-typed/npm/bcoin_vx.x.x.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index acfeeef..36a355d 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -95,7 +95,7 @@ declare module 'bcoin' { Coin : Class }, crypto : { - hash160(str : (string | Buffer)) : Hash + hash160(str : (string | Buffer)) : Hash, hash256(str : (string | Buffer)) : Hash } } From 3b0a699124bf24b087b18c27002714854bb27a57 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:28:30 +0100 Subject: [PATCH 027/113] Add "base58()" type --- flow-typed/npm/bcoin_vx.x.x.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index 36a355d..cf789da 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -97,6 +97,9 @@ declare module 'bcoin' { crypto : { hash160(str : (string | Buffer)) : Hash, hash256(str : (string | Buffer)) : Hash + }, + base58 : { + encode(str : (string | Buffer)) : Address } } } From 0f75dd2fb9877382346609d4e73f13f9abcba370 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:29:14 +0100 Subject: [PATCH 028/113] Make all steps' types buffers --- src/trust_is_risk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 0be1b38..34fc162 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -15,10 +15,10 @@ var DirectTrust = require("./direct_trust"); const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const pubKey = Buffer.from(pubKeyArray); -const step2 = bcoin.crypto.hash160(pubKey); +const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); // const step3 = crypto.ripemd160(step2); -const step3 = Buffer.concat([Buffer.alloc(1), Buffer.from(step2)]); -const step4 = bcoin.crypto.hash256(step3); +const step3 = Buffer.concat([Buffer.alloc(1), step2]); +const step4 = Buffer.from(bcoin.crypto.hash256(step3)); // const step6 = crypto.sha256(step5); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); From 3fc5f18f5f8f9ce1fd28d7450b5047edf3b63cab Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:32:55 +0100 Subject: [PATCH 029/113] Replace "Address" with "bcoin$Address" --- flow-typed/npm/bcoin_vx.x.x.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index cf789da..8a460f8 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -99,7 +99,7 @@ declare module 'bcoin' { hash256(str : (string | Buffer)) : Hash }, base58 : { - encode(str : (string | Buffer)) : Address + encode(str : (string | Buffer)) : bcoin$Address } } } From 58aa495b4a7063eee283ba407b907cc243a75588 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:36:22 +0100 Subject: [PATCH 030/113] Replace "bcoin$Address" with "Buffer" --- flow-typed/npm/bcoin_vx.x.x.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index 8a460f8..676a00f 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -99,7 +99,7 @@ declare module 'bcoin' { hash256(str : (string | Buffer)) : Hash }, base58 : { - encode(str : (string | Buffer)) : bcoin$Address + encode(str : (string | Buffer)) : Buffer } } } From 6e925ef9872776ad39a0ed3f7feb2162ad14eff4 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:41:07 +0100 Subject: [PATCH 031/113] Use tag creation from src/trust_is_risk.js --- test/helpers.js | 17 +++++++---------- test/trust_is_risk.js | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index bbf3864..f430979 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -8,16 +8,13 @@ var crypto = bcoin.crypto; var base58 = bcoin.base58; const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const publicKey = Buffer.from(publicKeyArray); -const step2 = crypto.sha256(publicKey); -const step3 = crypto.ripemd160(step2); -const step4 = Buffer.concat([Buffer.alloc(1), step3]); -const step5 = crypto.sha256(step4); -const step6 = crypto.sha256(step5); -const step7 = step6.slice(0, 4); -const step8 = Buffer.concat([step4, step7]); -const tag = base58.encode(step8); -// const tag = Buffer.from("1111111111111111111111111111111111"); +const pubKey = Buffer.from(pubKeyArray); +const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); +const step3 = Buffer.concat([Buffer.alloc(1), step2]); +const step4 = Buffer.from(bcoin.crypto.hash256(step3)); +const step5 = step4.slice(0, 4); +const step6 = Buffer.concat([step3, step5]); +const tag = bcoin.base58.encode(step6); var testHelpers = { getNode: async () => { diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 32c5bbf..63a14b3 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -16,16 +16,13 @@ require("should-sinon"); const COIN = bcoin.consensus.COIN; const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const publicKey = Buffer.from(publicKeyArray); -const step2 = crypto.sha256(publicKey); -const step3 = crypto.ripemd160(step2); -const step4 = Buffer.concat([Buffer.alloc(1), step3]); -const step5 = crypto.sha256(step4); -const step6 = crypto.sha256(step5); -const step7 = step6.slice(0, 4); -const step8 = Buffer.concat([step4, step7]); -const tag = base58.encode(step8); -// const tag = Buffer.from("1111111111111111111111111111111111"); +const pubKey = Buffer.from(pubKeyArray); +const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); +const step3 = Buffer.concat([Buffer.alloc(1), step2]); +const step4 = Buffer.from(bcoin.crypto.hash256(step3)); +const step5 = step4.slice(0, 4); +const step6 = Buffer.concat([step3, step5]); +const tag = bcoin.base58.encode(step6); describe("TrustIsRisk", () => { var addr = {}; From 619274a912fa9f98b3221a71bb0d329181fcf4c2 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:41:17 +0100 Subject: [PATCH 032/113] Remove commented out lines --- src/trust_is_risk.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 34fc162..0031826 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -16,14 +16,11 @@ var DirectTrust = require("./direct_trust"); const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const pubKey = Buffer.from(pubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); -// const step3 = crypto.ripemd160(step2); const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); -// const step6 = crypto.sha256(step5); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); const tag = bcoin.base58.encode(step6); -// const tag = Buffer.from("1111111111111111111111111111111111"); class TrustIsRisk { node : bcoin$FullNode From 821feaffc6cadef5f99334363092f2473a7b4a9d Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:44:59 +0100 Subject: [PATCH 033/113] Rename "publicKeyArray" to "pubKeyArray" --- test/helpers.js | 2 +- test/trust_is_risk.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index f430979..3ba208c 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -7,7 +7,7 @@ var assert = require("assert"); var crypto = bcoin.crypto; var base58 = bcoin.base58; -const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const pubKey = Buffer.from(pubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 63a14b3..c9d505e 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -15,7 +15,7 @@ var base58 = require("bcoin/lib/utils/base58"); require("should-sinon"); const COIN = bcoin.consensus.COIN; -const publicKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; const pubKey = Buffer.from(pubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); From 73ec9ca22c0eee5e438e9c47797389fe8c331711 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:49:33 +0100 Subject: [PATCH 034/113] Rename "pubKey" to "fakePubKey" --- src/trust_is_risk.js | 6 +++--- test/helpers.js | 6 +++--- test/trust_is_risk.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 0031826..a9a8c92 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,9 +13,9 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const pubKey = Buffer.from(pubKeyArray); -const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); +const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const fakePubKey = Buffer.from(fakePubKeyArray); +const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); const step5 = step4.slice(0, 4); diff --git a/test/helpers.js b/test/helpers.js index 3ba208c..41dda7e 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -7,9 +7,9 @@ var assert = require("assert"); var crypto = bcoin.crypto; var base58 = bcoin.base58; -const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const pubKey = Buffer.from(pubKeyArray); -const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); +const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const fakePubKey = Buffer.from(fakePubKeyArray); +const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); const step5 = step4.slice(0, 4); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index c9d505e..7ea4f68 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -15,9 +15,9 @@ var base58 = require("bcoin/lib/utils/base58"); require("should-sinon"); const COIN = bcoin.consensus.COIN; -const pubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; -const pubKey = Buffer.from(pubKeyArray); -const step2 = Buffer.from(bcoin.crypto.hash160(pubKey)); +const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const fakePubKey = Buffer.from(fakePubKeyArray); +const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); const step5 = step4.slice(0, 4); From 9fb9eaaa1da4d3b4a683eded7653154f2a5b5461 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 22:53:29 +0100 Subject: [PATCH 035/113] Make fakePubKeyArray preetier --- src/trust_is_risk.js | 9 ++++++++- test/helpers.js | 9 ++++++++- test/trust_is_risk.js | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index a9a8c92..a9ee63f 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,7 +13,14 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/helpers.js b/test/helpers.js index 41dda7e..1e21169 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -7,7 +7,14 @@ var assert = require("assert"); var crypto = bcoin.crypto; var base58 = bcoin.base58; -const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 7ea4f68..1e894de 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -15,7 +15,14 @@ var base58 = require("bcoin/lib/utils/base58"); require("should-sinon"); const COIN = bcoin.consensus.COIN; -const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; +const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); From e4e9b9d712e2e77c89e3b51572b64fa62d67cbb9 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 10 Sep 2017 23:01:50 +0100 Subject: [PATCH 036/113] Add TODO comment to check tag --- test/trust_is_risk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 1e894de..4f4f544 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -51,6 +51,7 @@ describe("TrustIsRisk", () => { var node, tir, trustIncreasingMTX, trustDecreasingMTX, trustIncreasingTX; beforeEach(() => { + // TODO: check that tag has correct type and format: Valid address, corresponding public key is "0x04Trust is Risk0x00..0x00" node = new bcoin.fullnode({}); tir = new Trust.TrustIsRisk(node); From 764dcc432b9c2187f6c84d57025d35b41dc3f058 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 11:36:16 +0100 Subject: [PATCH 037/113] Replace tabs with spaces --- src/trust_is_risk.js | 14 +++++++------- test/helpers.js | 14 +++++++------- test/trust_is_risk.js | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index a9ee63f..f98738d 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -14,13 +14,13 @@ var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/helpers.js b/test/helpers.js index 1e21169..839f1d7 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -8,13 +8,13 @@ var crypto = bcoin.crypto; var base58 = bcoin.base58; const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 4f4f544..8e04431 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -16,13 +16,13 @@ require("should-sinon"); const COIN = bcoin.consensus.COIN; const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); From 33387a81226ebad5db1eb6f83c1824534884c8b6 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 14:45:29 +0100 Subject: [PATCH 038/113] Turn tag from string to Buffer --- src/trust_is_risk.js | 2 +- test/helpers.js | 2 +- test/trust_is_risk.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index f98738d..50b07be 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -27,7 +27,7 @@ const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); -const tag = bcoin.base58.encode(step6); +const tag = Buffer.from(bcoin.base58.encode(step6)); class TrustIsRisk { node : bcoin$FullNode diff --git a/test/helpers.js b/test/helpers.js index 839f1d7..929bd1d 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -21,7 +21,7 @@ const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); -const tag = bcoin.base58.encode(step6); +const tag = Buffer.from(bcoin.base58.encode(step6)); var testHelpers = { getNode: async () => { diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 8e04431..b4b0652 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -29,7 +29,7 @@ const step3 = Buffer.concat([Buffer.alloc(1), step2]); const step4 = Buffer.from(bcoin.crypto.hash256(step3)); const step5 = step4.slice(0, 4); const step6 = Buffer.concat([step3, step5]); -const tag = bcoin.base58.encode(step6); +const tag = Buffer.from(bcoin.base58.encode(step6)); describe("TrustIsRisk", () => { var addr = {}; From fa7d3b81451650ad4596731c6442d465d9444a04 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 17:42:57 +0100 Subject: [PATCH 039/113] Indent --- src/trust_is_risk.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 50b07be..14391ce 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -14,13 +14,13 @@ var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); From 95896bb5ded3eeb7594e8aca4cc84ea4a937fcdc Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 17:43:26 +0100 Subject: [PATCH 040/113] Add tag validity and content tests --- test/trust_is_risk.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index b4b0652..bf86273 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -79,6 +79,24 @@ describe("TrustIsRisk", () => { }); }); + describe("tag", () => { + it("is a valid bitcoin address", () => { + assert(Address.fromString(tag.toString('ascii'))); + }); + + it("corresponds to a public key that contains \"Trust is Risk\"", () => { + const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; + bcoin.httpWallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + }); + }); + describe(".getDirectTrust()", () => { it("returns zero for two arbitary parties that do not trust each other", () => { tir.getDirectTrust(alice, bob).should.equal(0); From 152302d6ac7204daf69f354b4780e193c461543b Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 17:47:50 +0100 Subject: [PATCH 041/113] Accept small identation --- src/trust_is_risk.js | 14 +++++++------- test/trust_is_risk.js | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 14391ce..50b07be 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -14,13 +14,13 @@ var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index bf86273..952e113 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -86,14 +86,14 @@ describe("TrustIsRisk", () => { it("corresponds to a public key that contains \"Trust is Risk\"", () => { const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; bcoin.httpWallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00]; }); }); From 1ffb083c432e17f1902cd6aa0f99568c899a0c7d Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 17:49:12 +0100 Subject: [PATCH 042/113] Use should instead of assert() --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 952e113..0d3ffe2 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -81,7 +81,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("is a valid bitcoin address", () => { - assert(Address.fromString(tag.toString('ascii'))); + Address.fromString(tag.toString("ascii")).should.equal(1); }); it("corresponds to a public key that contains \"Trust is Risk\"", () => { From ba456d843934a5f6fce2576d406b6f7ec270e5e4 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 17:49:41 +0100 Subject: [PATCH 043/113] Use wallet.getKey instead of httpWallet.getKey --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 0d3ffe2..4d61cc5 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -86,7 +86,6 @@ describe("TrustIsRisk", () => { it("corresponds to a public key that contains \"Trust is Risk\"", () => { const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - bcoin.httpWallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -94,6 +93,7 @@ describe("TrustIsRisk", () => { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; + bcoin.wallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); }); }); From 7675547fa267938af5467755830c84a680ccb0f7 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 17:53:16 +0100 Subject: [PATCH 044/113] Replace equal with exist --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 4d61cc5..e01aeb0 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -81,7 +81,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("is a valid bitcoin address", () => { - Address.fromString(tag.toString("ascii")).should.equal(1); + Address.fromString(tag.toString("ascii")).should.exist(1); }); it("corresponds to a public key that contains \"Trust is Risk\"", () => { From c5364583f79abb57a5e5b80009ded53a0ad8f7a1 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 18:53:42 +0100 Subject: [PATCH 045/113] Make fake public key preetier --- src/trust_is_risk.js | 12 +++++------- test/helpers.js | 12 +++++------- test/trust_is_risk.js | 24 ++++++++++-------------- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 50b07be..023dcbe 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -14,13 +14,11 @@ var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/helpers.js b/test/helpers.js index 929bd1d..1ce9220 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -8,13 +8,11 @@ var crypto = bcoin.crypto; var base58 = bcoin.base58; const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index e01aeb0..d2d2847 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -16,13 +16,11 @@ require("should-sinon"); const COIN = bcoin.consensus.COIN; const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00]; const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); @@ -86,13 +84,11 @@ describe("TrustIsRisk", () => { it("corresponds to a public key that contains \"Trust is Risk\"", () => { const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00]; + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00]; bcoin.wallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); }); }); From d1a761a4145897888110e91e24de9ca7b90bc0f7 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 19:30:20 +0100 Subject: [PATCH 046/113] Remove unneeded crypto and base58 vars --- test/helpers.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index 1ce9220..7715c08 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -4,8 +4,6 @@ var bcoin = require("bcoin"); var fixtures = require("./fixtures"); var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); -var crypto = bcoin.crypto; -var base58 = bcoin.base58; const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From f0b0c69436969b99328ef5c1a4d29fe425658372 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 20:09:01 +0100 Subject: [PATCH 047/113] Add "HDPublicKey" type --- flow-typed/npm/bcoin_vx.x.x.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index 676a00f..db7d461 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -100,6 +100,9 @@ declare module 'bcoin' { }, base58 : { encode(str : (string | Buffer)) : Buffer + }, + HDPublicKey : { + fromBase58(str : (string | Buffer)) : Buffer } } } From 15d2500523f88eab51e845521beaab17a550a813 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 20:09:39 +0100 Subject: [PATCH 048/113] Require "assert" --- test/trust_is_risk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index d2d2847..d6fb21d 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -12,6 +12,7 @@ var should = require("should"); var fixtures = require("./fixtures"); var crypto = require("bcoin/lib/crypto"); var base58 = require("bcoin/lib/utils/base58"); +var assert = require("assert"); require("should-sinon"); const COIN = bcoin.consensus.COIN; From a2680bb5abbc644364a979232aca17682d418167 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 20:10:30 +0100 Subject: [PATCH 049/113] Replace "should" with "assert" --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index d6fb21d..2009b6a 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -80,7 +80,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("is a valid bitcoin address", () => { - Address.fromString(tag.toString("ascii")).should.exist(1); + assert.ok(Address.fromString(tag.toString("ascii"))); }); it("corresponds to a public key that contains \"Trust is Risk\"", () => { From 35ab49ad17c98e605c537666b4459fe4ee278b7a Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 11 Sep 2017 20:11:12 +0100 Subject: [PATCH 050/113] Play with Address to Public Key function --- test/trust_is_risk.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 2009b6a..82d8841 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -90,7 +90,8 @@ describe("TrustIsRisk", () => { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; - bcoin.wallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + bcoin.prototype.HDPublicKey.fromBase58(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + bcoin.http.Wallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); }); }); From 8fbcd6f52848830a797df675ce51c3463c552e61 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 19:57:31 +0100 Subject: [PATCH 051/113] Add package-lock.json --- package-lock.json | 3062 +++++++++++++++++++++++++++++++++++++++++ test/trust_is_risk.js | 2 +- 2 files changed, 3063 insertions(+), 1 deletion(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..d417c2e --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3062 @@ +{ + "name": "trust-is-risk", + "version": "0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=" + }, + "abstract-leveldown": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", + "integrity": "sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA==", + "optional": true, + "requires": { + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "accepts": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.1.4.tgz", + "integrity": "sha1-1xyW99QdD+2iw4zRToonwEFY30o=", + "optional": true, + "requires": { + "mime-types": "2.0.14", + "negotiator": "0.4.9" + }, + "dependencies": { + "mime-db": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz", + "integrity": "sha1-PQxjGA9FjrENMlqqN9fFiuMS6dc=", + "optional": true + }, + "mime-types": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz", + "integrity": "sha1-MQ4VnbI+B3+Lsit0jav6SVcUCqY=", + "optional": true, + "requires": { + "mime-db": "1.12.0" + } + } + } + }, + "acorn": { + "version": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", + "integrity": "sha1-kRy1PgNoB88Pp3jcXTcPvYZCRtc=", + "dev": true + }, + "acorn-jsx": { + "version": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz" + }, + "dependencies": { + "acorn": { + "version": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "after": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz", + "integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8=", + "optional": true + }, + "ajv": { + "version": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "requires": { + "co": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "json-stable-stringify": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz" + } + }, + "ajv-keywords": { + "version": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", + "dev": true + }, + "ansi": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz", + "integrity": "sha1-DELU+xcWDVqa8eSEus4cZpIsGyE=" + }, + "ansi-escapes": { + "version": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-regex": { + "version": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" + }, + "ansi-styles": { + "version": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "aproba": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", + "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==", + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "requires": { + "delegates": "1.0.0", + "readable-stream": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz" + } + }, + "argparse": { + "version": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" + } + }, + "array-index": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-index/-/array-index-1.0.0.tgz", + "integrity": "sha1-7FanSe4QPk4Ix5C5w1PfFgVbl/k=", + "optional": true, + "requires": { + "debug": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz" + } + }, + "array-union": { + "version": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz" + } + }, + "array-uniq": { + "version": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "arraybuffer.slice": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz", + "integrity": "sha1-8zshWfBTKj8xB6JywMz70a0peco=" + }, + "arrify": { + "version": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + }, + "babel-code-frame": { + "version": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "esutils": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "js-tokens": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" + } + }, + "babel-eslint": { + "version": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-7.2.3.tgz", + "integrity": "sha1-sv4tgBJkcPXBlELcdXJTqJdxCCc=", + "dev": true, + "requires": { + "babel-code-frame": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "babel-traverse": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "babel-types": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "babylon": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz" + } + }, + "babel-messages": { + "version": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz" + } + }, + "babel-runtime": { + "version": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "regenerator-runtime": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz" + } + }, + "babel-traverse": { + "version": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "babel-messages": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "babel-types": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "babylon": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "debug": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "globals": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "invariant": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz" + } + }, + "babel-types": { + "version": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "esutils": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "to-fast-properties": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz" + } + }, + "babylon": { + "version": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha1-ry87iPpvXB5MY00aD46sT1WzleM=", + "dev": true + }, + "backo2": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", + "integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc=", + "optional": true + }, + "balanced-match": { + "version": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base64-arraybuffer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz", + "integrity": "sha1-R030qfLaJOBd8xWMOx2zw81GoVQ=" + }, + "base64id": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz", + "integrity": "sha1-As4P3u4M709ACA4ec+g08LG/zj8=", + "optional": true + }, + "bcoin": { + "version": "1.0.0-beta.12", + "resolved": "https://registry.npmjs.org/bcoin/-/bcoin-1.0.0-beta.12.tgz", + "integrity": "sha1-hb+4F/VjDlnKsLeHv51DaPwSRsQ=", + "requires": { + "bcoin-native": "0.0.14", + "bn.js": "4.11.6", + "elliptic": "6.3.2", + "leveldown": "1.5.0", + "secp256k1": "3.2.5", + "socket.io": "1.4.8", + "socket.io-client": "1.4.8" + } + }, + "bcoin-native": { + "version": "0.0.14", + "resolved": "https://registry.npmjs.org/bcoin-native/-/bcoin-native-0.0.14.tgz", + "integrity": "sha1-gRvFFbIJRlvnGESsPzo7kO+J9BE=", + "optional": true, + "requires": { + "bindings": "1.2.1", + "nan": "2.5.1" + } + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "benchmark": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-1.0.0.tgz", + "integrity": "sha1-Lx4vpMNZ8REiqhgwgiGOlX45DHM=" + }, + "better-assert": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz", + "integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=", + "requires": { + "callsite": "1.0.0" + } + }, + "bindings": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", + "integrity": "sha1-FK1hE4EtLTfXLme0ystLtyZQXxE=", + "optional": true + }, + "bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", + "optional": true, + "requires": { + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + }, + "bl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.0.3.tgz", + "integrity": "sha1-/FQhoo/UImA2w7OJGmaiW8ZNIm4=", + "requires": { + "readable-stream": "2.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "requires": { + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "isarray": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "string_decoder": "0.10.31", + "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, + "blob": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.4.tgz", + "integrity": "sha1-vPEwUspURj8w+fx+lbmkdjCpSSE=" + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "concat-map": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browser-stdout": { + "version": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "browserify-aes": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", + "integrity": "sha512-WYCMOT/PtGTlpOKFht0YJFYcPy6pLCR98CtWfzK13zoynLlBMvAdEMSRGmgnJCw2M2j/5qxBkinZQFobieM8dQ==", + "optional": true, + "requires": { + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.1.3", + "evp_bytestokey": "1.0.3", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "optional": true + }, + "caller-path": { + "version": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz" + } + }, + "callsite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz", + "integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA=" + }, + "callsites": { + "version": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "chalk": { + "version": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "has-ansi": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "supports-color": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz" + } + }, + "chownr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", + "optional": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + }, + "circular-json": { + "version": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha1-gVyZ6oT2gJUp0vRXkb34JxE1LWY=", + "dev": true + }, + "cli-cursor": { + "version": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz" + } + }, + "cli-width": { + "version": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "co": { + "version": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "code-point-at": { + "version": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz" + } + }, + "component-bind": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", + "integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E=", + "optional": true + }, + "component-emitter": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.1.2.tgz", + "integrity": "sha1-KWWU8nU9qmOZbSrwjRWpURbJrsM=" + }, + "component-inherit": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz", + "integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM=", + "optional": true + }, + "concat-map": { + "version": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "concat-stream": { + "version": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "readable-stream": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "typedarray": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" + }, + "core-js": { + "version": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=", + "dev": true + }, + "core-util-is": { + "version": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "create-hash": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", + "integrity": "sha1-YGBCrIuSYnUPSDyt2rD1gZFy2P0=", + "requires": { + "cipher-base": "1.0.4", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "ripemd160": "2.0.1", + "sha.js": "2.4.8" + } + }, + "create-hmac": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.6.tgz", + "integrity": "sha1-rLniIaThe9sHbpBlfEK5PjcmzwY=", + "optional": true, + "requires": { + "cipher-base": "1.0.4", + "create-hash": "1.1.3", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "ripemd160": "2.0.1", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "sha.js": "2.4.8" + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "requires": { + "boom": "2.10.1" + } + }, + "d": { + "version": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", + "requires": { + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "debug": { + "version": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "requires": { + "ms": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" + } + }, + "deep-extend": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "optional": true + }, + "deep-is": { + "version": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "del": { + "version": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "is-path-cwd": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "is-path-in-cwd": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "pify": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "pinkie-promise": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "rimraf": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" + }, + "diff": { + "version": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "doctrine": { + "version": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "dev": true, + "requires": { + "esutils": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "isarray": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" + } + }, + "drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", + "optional": true, + "requires": { + "browserify-aes": "1.0.8", + "create-hash": "1.1.3", + "create-hmac": "1.1.6" + } + }, + "duplexer2": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", + "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "requires": { + "readable-stream": "1.1.14" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "elliptic": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz", + "integrity": "sha1-5MgeCCnPCmWrcOmYuCMnI7XBvEg=", + "requires": { + "bn.js": "4.11.6", + "brorand": "1.1.0", + "hash.js": "1.1.3", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + } + }, + "end-of-stream": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", + "integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", + "requires": { + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + } + }, + "engine.io": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.6.11.tgz", + "integrity": "sha1-JTOpemWHbED/z5U5e375tJXEI/4=", + "optional": true, + "requires": { + "accepts": "1.1.4", + "base64id": "0.1.0", + "debug": "2.2.0", + "engine.io-parser": "1.2.4", + "ws": "1.1.0" + }, + "dependencies": { + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "optional": true, + "requires": { + "ms": "0.7.1" + } + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "optional": true + } + } + }, + "engine.io-client": { + "version": "1.6.11", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.6.11.tgz", + "integrity": "sha1-fSUNj6HCGBGezeUTkEWKV9UXE3Y=", + "optional": true, + "requires": { + "component-emitter": "1.1.2", + "component-inherit": "0.0.3", + "debug": "2.2.0", + "engine.io-parser": "1.2.4", + "has-cors": "1.1.0", + "indexof": "0.0.1", + "parsejson": "0.0.1", + "parseqs": "0.0.2", + "parseuri": "0.0.4", + "ws": "1.0.1", + "xmlhttprequest-ssl": "1.5.1", + "yeast": "0.1.2" + }, + "dependencies": { + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "optional": true, + "requires": { + "ms": "0.7.1" + } + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "optional": true + }, + "ws": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-1.0.1.tgz", + "integrity": "sha1-fQsqLljN3YGQOcKcneZQReGzEOk=", + "optional": true, + "requires": { + "options": "0.0.6", + "ultron": "1.0.2" + } + } + } + }, + "engine.io-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.2.4.tgz", + "integrity": "sha1-4Il7C/FOeS1M0qWVBVORnFaUjEI=", + "requires": { + "after": "0.8.1", + "arraybuffer.slice": "0.0.6", + "base64-arraybuffer": "0.1.2", + "blob": "0.0.4", + "has-binary": "0.1.6", + "utf8": "2.1.0" + }, + "dependencies": { + "after": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/after/-/after-0.8.1.tgz", + "integrity": "sha1-q11PuIP1loFtNRX495HAr0ht1ic=" + }, + "has-binary": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.6.tgz", + "integrity": "sha1-JTJvOc+k9hath4eJTjryz7x7bhA=", + "requires": { + "isarray": "0.0.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + } + } + }, + "es5-ext": { + "version": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", + "requires": { + "es6-iterator": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz" + } + }, + "es6-iterator": { + "version": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz" + } + }, + "es6-map": { + "version": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", + "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "es6-iterator": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "es6-set": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "event-emitter": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz" + } + }, + "es6-set": { + "version": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", + "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", + "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "es6-iterator": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "event-emitter": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz" + } + }, + "es6-symbol": { + "version": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", + "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz" + } + }, + "es6-weak-map": { + "version": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", + "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "es6-iterator": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", + "es6-symbol": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz" + } + }, + "escape-string-regexp": { + "version": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escope": { + "version": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", + "dev": true, + "requires": { + "es6-map": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", + "es6-weak-map": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", + "esrecurse": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "estraverse": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz" + } + }, + "eslint": { + "version": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", + "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", + "dev": true, + "requires": { + "babel-code-frame": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "chalk": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "concat-stream": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "debug": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "doctrine": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", + "escope": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", + "espree": "https://registry.npmjs.org/espree/-/espree-3.5.0.tgz", + "esquery": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "estraverse": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "esutils": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "file-entry-cache": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "globals": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "ignore": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", + "imurmurhash": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "inquirer": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "is-my-json-valid": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", + "is-resolvable": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "js-yaml": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.9.1.tgz", + "json-stable-stringify": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "levn": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "natural-compare": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "optionator": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "path-is-inside": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "pluralize": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "progress": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "require-uncached": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "shelljs": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "strip-bom": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "strip-json-comments": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "table": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "text-table": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "user-home": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz" + } + }, + "eslint-plugin-flowtype": { + "version": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.35.1.tgz", + "integrity": "sha1-mtmBgbRno2RfvSqNQwOTzBek6mM=", + "dev": true, + "requires": { + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz" + } + }, + "espree": { + "version": "https://registry.npmjs.org/espree/-/espree-3.5.0.tgz", + "integrity": "sha1-mDWGJb3QVYYeon4oZ+pyn69GPY0=", + "dev": true, + "requires": { + "acorn": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", + "acorn-jsx": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz" + } + }, + "esprima": { + "version": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha1-RJnt3NERDgshi6zy+n9/WfVcqAQ=", + "dev": true + }, + "esquery": { + "version": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz" + } + }, + "esrecurse": { + "version": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + } + }, + "estraverse": { + "version": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "event-emitter": { + "version": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", + "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", + "dev": true, + "requires": { + "d": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", + "es5-ext": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz" + } + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "optional": true, + "requires": { + "md5.js": "1.3.4", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + }, + "execspawn": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/execspawn/-/execspawn-1.0.1.tgz", + "integrity": "sha1-gob53efOzeeQX73ATiTzaPI/jaY=", + "optional": true, + "requires": { + "util-extend": "1.0.3" + } + }, + "exit-hook": { + "version": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-template": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-1.1.0.tgz", + "integrity": "sha512-kkjwkMqj0h4w/sb32ERCDxCQkREMCAgS39DscDnSwDsbxnwwM1BTZySdC3Bn1lhY7vL08n9GoO/fVTynjDgRyQ==", + "optional": true + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-future": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/fast-future/-/fast-future-1.0.2.tgz", + "integrity": "sha1-hDWpqqAteSSNF9cE52JZMB2ZKAo=", + "optional": true + }, + "fast-levenshtein": { + "version": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + } + }, + "file-entry-cache": { + "version": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz" + } + }, + "flat-cache": { + "version": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", + "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=", + "dev": true, + "requires": { + "circular-json": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "del": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "write": "https://registry.npmjs.org/write/-/write-0.2.1.tgz" + } + }, + "flow-bin": { + "version": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.45.0.tgz", + "integrity": "sha1-AJ3Q9Xej9mXHTKi+gnrowt2P1rU=", + "dev": true + }, + "flow-remove-types": { + "version": "https://registry.npmjs.org/flow-remove-types/-/flow-remove-types-1.2.1.tgz", + "integrity": "sha1-WOJhv4uEK9I0yGyvuYKhITr/Dts=", + "dev": true, + "requires": { + "babylon": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "vlq": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "formatio": { + "version": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", + "integrity": "sha1-87IWfZBoxGmKjVH092CjmlTYGOs=", + "dev": true, + "requires": { + "samsam": "https://registry.npmjs.org/samsam/-/samsam-1.2.1.tgz" + } + }, + "fs.realpath": { + "version": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "requires": { + "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "rimraf": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz" + } + }, + "gauge": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.7.tgz", + "integrity": "sha1-6c7FSD09TuDvRLYKfZnkk14TbZM=", + "requires": { + "ansi": "0.3.1", + "has-unicode": "2.0.1", + "lodash.pad": "4.5.1", + "lodash.padend": "4.6.1", + "lodash.padstart": "4.6.1" + } + }, + "generate-function": { + "version": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", + "dev": true + }, + "generate-object-property": { + "version": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "dev": true, + "requires": { + "is-property": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "ghreleases": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/ghreleases/-/ghreleases-1.0.6.tgz", + "integrity": "sha512-uySVPT5T9uP1xeWR7nl3WD8/JjJJXAph/0zdgUQJ7ovFpL3rxBT/HT0sO6w0GDWCj2gwXvzxBKrIeJAgBhs+fw==", + "optional": true, + "requires": { + "after": "0.8.2", + "ghrepos": "2.0.0", + "ghutils": "3.2.1", + "simple-mime": "0.1.0", + "url-template": "2.0.8", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "ghrepos": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ghrepos/-/ghrepos-2.0.0.tgz", + "integrity": "sha1-1m6unZijtTmORg1tt+EKdCaS6Bs=", + "optional": true, + "requires": { + "ghutils": "3.2.1" + } + }, + "ghutils": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ghutils/-/ghutils-3.2.1.tgz", + "integrity": "sha1-T87f+sk1/KzgbhKhfGF04sKf/k8=", + "requires": { + "jsonist": "1.3.0", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha1-l/tdlr/eiXMxPyDoKI75oWf6ZM4=", + "optional": true + }, + "glob": { + "version": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", + "requires": { + "fs.realpath": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "inflight": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "minimatch": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + } + }, + "globals": { + "version": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=", + "dev": true + }, + "globby": { + "version": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "arrify": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "pify": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "pinkie-promise": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz" + } + }, + "graceful-fs": { + "version": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "graceful-readlink": { + "version": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "graph-theory-ford-fulkerson": { + "version": "https://registry.npmjs.org/graph-theory-ford-fulkerson/-/graph-theory-ford-fulkerson-1.0.0.tgz", + "integrity": "sha1-LDHSHXDxp9KCiZX+BnZFdv9/nik=" + }, + "growl": { + "version": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" + }, + "har-validator": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "requires": { + "ajv": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "har-schema": "1.0.5" + } + }, + "has-ansi": { + "version": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + } + }, + "has-binary": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-binary/-/has-binary-0.1.7.tgz", + "integrity": "sha1-aOYesWIQyVRaClzOBqhzkS/h5ow=", + "requires": { + "isarray": "0.0.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + } + } + }, + "has-cors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", + "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=", + "optional": true + }, + "has-flag": { + "version": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" + }, + "hash-base": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", + "integrity": "sha1-ZuodhW206KVHDK32/OI65SRO8uE=", + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "minimalistic-assert": "1.0.0" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "hyperquest": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hyperquest/-/hyperquest-1.2.0.tgz", + "integrity": "sha1-OeH+9miI3Hzg3sbA3YFPb8iUStU=", + "requires": { + "duplexer2": "0.0.2", + "through2": "0.6.5" + } + }, + "ignore": { + "version": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", + "integrity": "sha1-xOcVRV9gc6jX5drnLS/J1xZj26Y=", + "dev": true + }, + "imurmurhash": { + "version": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=" + }, + "inflight": { + "version": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + } + }, + "inherits": { + "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ini": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "optional": true + }, + "inquirer": { + "version": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", + "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", + "dev": true, + "requires": { + "ansi-escapes": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "ansi-regex": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "chalk": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "cli-cursor": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "cli-width": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "figures": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "readline2": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", + "run-async": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", + "rx-lite": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", + "string-width": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "through": "https://registry.npmjs.org/through/-/through-2.3.8.tgz" + } + }, + "interpret": { + "version": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", + "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=", + "dev": true + }, + "invariant": { + "version": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true, + "requires": { + "loose-envify": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz" + } + }, + "is-fullwidth-code-point": { + "version": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "requires": { + "number-is-nan": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz" + } + }, + "is-my-json-valid": { + "version": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", + "integrity": "sha1-WoRnd+LCYg0eaRBOXToDsfYIjxE=", + "dev": true, + "requires": { + "generate-function": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "generate-object-property": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "jsonpointer": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "is-path-cwd": { + "version": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "dev": true, + "requires": { + "is-path-inside": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz" + } + }, + "is-path-inside": { + "version": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", + "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "dev": true, + "requires": { + "path-is-inside": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz" + } + }, + "is-property": { + "version": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", + "dev": true + }, + "is-resolvable": { + "version": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", + "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", + "dev": true, + "requires": { + "tryit": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-tokens": { + "version": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.9.1.tgz", + "integrity": "sha1-CHdc69/dNZIJ8NKs04PI+GppBKA=", + "dev": true, + "requires": { + "argparse": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "esprima": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-stable-stringify": { + "version": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "json3": { + "version": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=" + }, + "jsonify": { + "version": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, + "jsonist": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsonist/-/jsonist-1.3.0.tgz", + "integrity": "sha1-wMdLle8clSA4YZsp76UgscyYdVY=", + "requires": { + "bl": "1.0.3", + "hyperquest": "1.2.0", + "json-stringify-safe": "5.0.1", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "jsonpointer": { + "version": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "leveldown": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-1.5.0.tgz", + "integrity": "sha1-a408vqekqJqkdERgfXNYIT5vy4E=", + "optional": true, + "requires": { + "abstract-leveldown": "2.6.3", + "bindings": "1.2.1", + "fast-future": "1.0.2", + "nan": "2.4.0", + "prebuild": "4.5.0" + }, + "dependencies": { + "nan": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.4.0.tgz", + "integrity": "sha1-+zxZ1F/k7/4hXwuJD4rfbrMtIjI=", + "optional": true + } + } + }, + "levn": { + "version": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "type-check": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + } + }, + "lodash": { + "version": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash._baseassign": { + "version": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "lodash.keys": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz" + } + }, + "lodash._basecopy": { + "version": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "lodash._basecreate": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "lodash._isiterateecall": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz" + } + }, + "lodash.isarguments": { + "version": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "lodash.isarguments": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "lodash.isarray": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz" + } + }, + "lodash.pad": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/lodash.pad/-/lodash.pad-4.5.1.tgz", + "integrity": "sha1-QzCUmoM6fI2iLMIPaibE1Z3runA=" + }, + "lodash.padend": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padend/-/lodash.padend-4.6.1.tgz", + "integrity": "sha1-U8y6BH0G4VjTEfRdpiX05J5vFm4=" + }, + "lodash.padstart": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.padstart/-/lodash.padstart-4.6.1.tgz", + "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=" + }, + "lolex": { + "version": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", + "integrity": "sha1-OpoCg0UqR9dDnnJzG54H1zhuSfY=", + "dev": true + }, + "loose-envify": { + "version": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz" + } + }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "optional": true, + "requires": { + "hash-base": "3.0.4", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + }, + "dependencies": { + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "optional": true, + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + } + } + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "requires": { + "mime-db": "1.30.0" + } + }, + "minimalistic-assert": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=" + }, + "minimatch": { + "version": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", + "requires": { + "brace-expansion": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mkdirp": { + "version": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz" + }, + "dependencies": { + "minimist": { + "version": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "mocha": { + "version": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz", + "integrity": "sha1-EyhWfScX+ZcDD4AGI0vOm4zXJGU=", + "dev": true, + "requires": { + "browser-stdout": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "commander": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "debug": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "diff": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "escape-string-regexp": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "growl": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "json3": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "lodash.create": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "supports-color": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz" + }, + "dependencies": { + "glob": { + "version": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "inflight": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "minimatch": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "path-is-absolute": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + } + }, + "supports-color": { + "version": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz" + } + } + } + }, + "ms": { + "version": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "mute-stream": { + "version": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", + "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", + "dev": true + }, + "nan": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.5.1.tgz", + "integrity": "sha1-1bAWkSUzJql6K77p5hxV2NYDUeI=", + "optional": true + }, + "native-promise-only": { + "version": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", + "integrity": "sha1-IKMYwwy0X3H+et+/eyHJnBRy7xE=", + "dev": true + }, + "natural-compare": { + "version": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "negotiator": { + "version": "0.4.9", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.9.tgz", + "integrity": "sha1-kuRrbbU8fkIe1koryU8IvnYw3z8=", + "optional": true + }, + "node-abi": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.1.1.tgz", + "integrity": "sha512-6oxV13poCOv7TfGvhsSz6XZWpXeKkdGVh72++cs33OfMh3KAX8lN84dCvmqSETyDXAFcUHtV7eJrgFBoOqZbNQ==", + "optional": true + }, + "node-gyp": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.6.2.tgz", + "integrity": "sha1-m/vlRWIoYoSDjnUOrAUpWFP6HGA=", + "optional": true, + "requires": { + "fstream": "1.0.11", + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "minimatch": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "nopt": "3.0.6", + "npmlog": "2.0.4", + "osenv": "0.1.4", + "request": "2.81.0", + "rimraf": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "semver": "5.3.0", + "tar": "2.2.1", + "which": "1.3.0" + } + }, + "node-ninja": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/node-ninja/-/node-ninja-1.0.2.tgz", + "integrity": "sha1-IKCeV7kuLfWRmT1L8JisPnJwYrY=", + "optional": true, + "requires": { + "fstream": "1.0.11", + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "graceful-fs": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "minimatch": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "nopt": "3.0.6", + "npmlog": "2.0.4", + "osenv": "0.1.4", + "path-array": "1.0.1", + "request": "2.81.0", + "rimraf": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "semver": "5.3.0", + "tar": "2.2.1", + "which": "1.3.0" + } + }, + "noop-logger": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", + "integrity": "sha1-lKKxYzxPExdVMAfYlm/Q6EG2pMI=", + "optional": true + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "requires": { + "abbrev": "1.1.0" + } + }, + "npmlog": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-2.0.4.tgz", + "integrity": "sha1-mLUlMPJRTKkNCexbIsiEZyI3VpI=", + "requires": { + "ansi": "0.3.1", + "are-we-there-yet": "1.1.4", + "gauge": "1.2.7" + } + }, + "number-is-nan": { + "version": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "object-assign": { + "version": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-component": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz", + "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", + "optional": true + }, + "once": { + "version": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + } + }, + "onetime": { + "version": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "optionator": { + "version": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "fast-levenshtein": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "levn": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "prelude-ls": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "type-check": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "wordwrap": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz" + } + }, + "options": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/options/-/options-0.0.6.tgz", + "integrity": "sha1-7CLTEoBrtT5zF3Pnza788cZDEo8=" + }, + "os-homedir": { + "version": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" + }, + "osenv": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "requires": { + "os-homedir": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "os-tmpdir": "1.0.2" + } + }, + "parsejson": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/parsejson/-/parsejson-0.0.1.tgz", + "integrity": "sha1-mxDGwNglq1ieaFFTgm3go7oni8w=", + "optional": true, + "requires": { + "better-assert": "1.0.2" + } + }, + "parseqs": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.2.tgz", + "integrity": "sha1-nf5wss3aw4i95PNbHyQPpYrb5sc=", + "optional": true, + "requires": { + "better-assert": "1.0.2" + } + }, + "parseuri": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.4.tgz", + "integrity": "sha1-gGWCo5iH4eoY3V4v4OAZAiaOk1A=", + "requires": { + "better-assert": "1.0.2" + } + }, + "path-array": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-array/-/path-array-1.0.1.tgz", + "integrity": "sha1-fi8PNfB6IBUSK4aLfqwOssT+wnE=", + "optional": true, + "requires": { + "array-index": "1.0.0" + } + }, + "path-is-absolute": { + "version": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-is-inside": { + "version": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-parse": { + "version": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-to-regexp": { + "version": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", + "dev": true, + "requires": { + "isarray": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "dependencies": { + "isarray": { + "version": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } + } + }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=" + }, + "pify": { + "version": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz" + } + }, + "pluralize": { + "version": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", + "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", + "dev": true + }, + "prebuild": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/prebuild/-/prebuild-4.5.0.tgz", + "integrity": "sha1-KqoN8gY7/4FKgDvU3JT/m2Tl3wA=", + "optional": true, + "requires": { + "async": "1.5.2", + "execspawn": "1.0.1", + "expand-template": "1.1.0", + "ghreleases": "1.0.6", + "github-from-package": "0.0.0", + "minimist": "1.2.0", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "node-gyp": "3.6.2", + "node-ninja": "1.0.2", + "noop-logger": "0.1.1", + "npmlog": "2.0.4", + "os-homedir": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "pump": "1.0.2", + "rc": "1.2.1", + "simple-get": "1.4.3", + "tar-fs": "1.15.3", + "tar-stream": "1.5.4", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "prebuild-install": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-2.2.2.tgz", + "integrity": "sha512-F46pcvDxtQhbV3B+dm+exHuKxIyJK26fVNiJRmbTW/5D7o0Z2yzc8CKeu7UWbo9XxQZoVOC88aKgySAsza+cWw==", + "optional": true, + "requires": { + "expand-template": "1.1.0", + "github-from-package": "0.0.0", + "minimist": "1.2.0", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "node-abi": "2.1.1", + "noop-logger": "0.1.1", + "npmlog": "4.1.2", + "os-homedir": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "pump": "1.0.2", + "rc": "1.2.1", + "simple-get": "1.4.3", + "tar-fs": "1.15.3", + "tunnel-agent": "0.6.0", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + }, + "dependencies": { + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "optional": true, + "requires": { + "aproba": "1.1.2", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "signal-exit": "3.0.2", + "string-width": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "wide-align": "1.1.2" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "optional": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + } + } + }, + "prelude-ls": { + "version": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "process-nextick-args": { + "version": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "progress": { + "version": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", + "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", + "dev": true + }, + "pump": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-1.0.2.tgz", + "integrity": "sha1-Oz7mUS+U8OV1U4wXmV+fFpkKXVE=", + "requires": { + "end-of-stream": "1.4.0", + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" + }, + "rc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "optional": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz" + } + }, + "readable-stream": { + "version": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", + "requires": { + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "isarray": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "process-nextick-args": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "string_decoder": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "util-deprecate": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + } + }, + "readline2": { + "version": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", + "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", + "dev": true, + "requires": { + "code-point-at": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "is-fullwidth-code-point": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "mute-stream": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz" + } + }, + "rechoir": { + "version": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz" + } + }, + "regenerator-runtime": { + "version": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha1-flT+W1zNXWYk6mJVw0c74JC4AuE=", + "dev": true + }, + "request": { + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.6.0", + "uuid": "3.1.0" + } + }, + "require-uncached": { + "version": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "resolve-from": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz" + } + }, + "resolve": { + "version": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha1-p1vgHFPaJdk0qY69DkxKcxL5KoY=", + "dev": true, + "requires": { + "path-parse": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz" + } + }, + "resolve-from": { + "version": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "restore-cursor": { + "version": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "onetime": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz" + } + }, + "rimraf": { + "version": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "requires": { + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz" + } + }, + "ripemd160": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", + "integrity": "sha1-D0WEKVxTo2KK9+bXmsohzlfRxuc=", + "requires": { + "hash-base": "2.0.2", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + } + }, + "run-async": { + "version": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", + "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", + "dev": true, + "requires": { + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + } + }, + "rx-lite": { + "version": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", + "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", + "dev": true + }, + "safe-buffer": { + "version": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=" + }, + "samsam": { + "version": "https://registry.npmjs.org/samsam/-/samsam-1.2.1.tgz", + "integrity": "sha1-7dOQk6MYQ3DLhZJDsr3yVefY6mc=", + "dev": true + }, + "secp256k1": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.2.5.tgz", + "integrity": "sha1-Dd5bJ+UCFmX23/ynssPgEMbBPJM=", + "optional": true, + "requires": { + "bindings": "1.2.1", + "bip66": "1.1.5", + "bn.js": "4.11.6", + "create-hash": "1.1.3", + "drbg.js": "1.0.1", + "elliptic": "6.3.2", + "nan": "2.5.1", + "prebuild-install": "2.2.2" + } + }, + "semver": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "optional": true + }, + "sha.js": { + "version": "2.4.8", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.8.tgz", + "integrity": "sha1-NwaMLEdra69ALRSknGf1l5IfY08=", + "requires": { + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + } + }, + "shelljs": { + "version": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", + "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", + "dev": true, + "requires": { + "glob": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "interpret": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", + "rechoir": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz" + } + }, + "should": { + "version": "https://registry.npmjs.org/should/-/should-11.2.1.tgz", + "integrity": "sha1-kPVRRVUtAc/CAGZuToGKHJZw7aI=", + "dev": true, + "requires": { + "should-equal": "https://registry.npmjs.org/should-equal/-/should-equal-1.0.1.tgz", + "should-format": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "should-type": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "should-type-adaptors": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.0.1.tgz", + "should-util": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz" + } + }, + "should-equal": { + "version": "https://registry.npmjs.org/should-equal/-/should-equal-1.0.1.tgz", + "integrity": "sha1-C26VFvJgGp+wuy3MNpr6HH4gCvc=", + "dev": true, + "requires": { + "should-type": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz" + } + }, + "should-format": { + "version": "https://registry.npmjs.org/should-format/-/should-format-3.0.3.tgz", + "integrity": "sha1-m/yPdPo5IFxT04w01xcwPidxJPE=", + "dev": true, + "requires": { + "should-type": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "should-type-adaptors": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.0.1.tgz" + } + }, + "should-sinon": { + "version": "https://registry.npmjs.org/should-sinon/-/should-sinon-0.0.5.tgz", + "integrity": "sha1-/8ioUb9FB2fn0K0i/4cVZQvpUOQ=", + "dev": true + }, + "should-type": { + "version": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "integrity": "sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=", + "dev": true + }, + "should-type-adaptors": { + "version": "https://registry.npmjs.org/should-type-adaptors/-/should-type-adaptors-1.0.1.tgz", + "integrity": "sha1-7+VVPN9oz/ZuXF9RtxLcNRx3vqo=", + "dev": true, + "requires": { + "should-type": "https://registry.npmjs.org/should-type/-/should-type-1.4.0.tgz", + "should-util": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz" + } + }, + "should-util": { + "version": "https://registry.npmjs.org/should-util/-/should-util-1.0.0.tgz", + "integrity": "sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "optional": true + }, + "simple-get": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-1.4.3.tgz", + "integrity": "sha1-6XVe2kB+ltpAxeUVjJ6jezO+y+s=", + "optional": true, + "requires": { + "once": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "unzip-response": "1.0.2", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "simple-mime": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/simple-mime/-/simple-mime-0.1.0.tgz", + "integrity": "sha1-lfUXxPRm18/1YacfydqyWW6p7y4=", + "optional": true + }, + "sinon": { + "version": "https://registry.npmjs.org/sinon/-/sinon-2.4.1.tgz", + "integrity": "sha1-Ah/WS1TLd9nS+w1Dze3652KcOjY=", + "dev": true, + "requires": { + "diff": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "formatio": "https://registry.npmjs.org/formatio/-/formatio-1.2.0.tgz", + "lolex": "https://registry.npmjs.org/lolex/-/lolex-1.6.0.tgz", + "native-promise-only": "https://registry.npmjs.org/native-promise-only/-/native-promise-only-0.8.1.tgz", + "path-to-regexp": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", + "samsam": "https://registry.npmjs.org/samsam/-/samsam-1.2.1.tgz", + "text-encoding": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "type-detect": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz" + } + }, + "slice-ansi": { + "version": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", + "dev": true + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "requires": { + "hoek": "2.16.3" + } + }, + "socket.io": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.4.8.tgz", + "integrity": "sha1-5XbzMM0L7WTlWz/SbfmRFBiEhns=", + "optional": true, + "requires": { + "debug": "2.2.0", + "engine.io": "1.6.11", + "has-binary": "0.1.7", + "socket.io-adapter": "0.4.0", + "socket.io-client": "1.4.8", + "socket.io-parser": "2.2.6" + }, + "dependencies": { + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "optional": true, + "requires": { + "ms": "0.7.1" + } + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "optional": true + } + } + }, + "socket.io-adapter": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-0.4.0.tgz", + "integrity": "sha1-+5+CqxqmUpC/csNleVW5MKmRok8=", + "optional": true, + "requires": { + "debug": "2.2.0", + "socket.io-parser": "2.2.2" + }, + "dependencies": { + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "optional": true, + "requires": { + "ms": "0.7.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "optional": true + }, + "json3": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.2.6.tgz", + "integrity": "sha1-9u/JPAagTemuxTBT3yVZuxniA4s=", + "optional": true + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "optional": true + }, + "socket.io-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.2.tgz", + "integrity": "sha1-PXr2tkSX6Va32f53X5mXFgJ/lBc=", + "optional": true, + "requires": { + "benchmark": "1.0.0", + "component-emitter": "1.1.2", + "debug": "0.7.4", + "isarray": "0.0.1", + "json3": "3.2.6" + }, + "dependencies": { + "debug": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz", + "integrity": "sha1-BuHqgILCyxTjmAbiLi9vdX+Srzk=", + "optional": true + } + } + } + } + }, + "socket.io-client": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.4.8.tgz", + "integrity": "sha1-SBskHnPfFA6hpPsDSGqFrQl/VVg=", + "optional": true, + "requires": { + "backo2": "1.0.2", + "component-bind": "1.0.0", + "component-emitter": "1.2.0", + "debug": "2.2.0", + "engine.io-client": "1.6.11", + "has-binary": "0.1.7", + "indexof": "0.0.1", + "object-component": "0.0.3", + "parseuri": "0.0.4", + "socket.io-parser": "2.2.6", + "to-array": "0.1.4" + }, + "dependencies": { + "component-emitter": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.0.tgz", + "integrity": "sha1-zNETqGOI0GSC0D3j/H35hSa6jv4=", + "optional": true + }, + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "optional": true, + "requires": { + "ms": "0.7.1" + } + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", + "optional": true + } + } + }, + "socket.io-parser": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-2.2.6.tgz", + "integrity": "sha1-ON/WHfUNz4qx2eIJEyK/kCuii5k=", + "requires": { + "benchmark": "1.0.0", + "component-emitter": "1.1.2", + "debug": "2.2.0", + "isarray": "0.0.1", + "json3": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz" + }, + "dependencies": { + "debug": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", + "integrity": "sha1-+HBX6ZWxofauaklgZkE3vFbwOdo=", + "requires": { + "ms": "0.7.1" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "ms": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", + "integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=" + } + } + }, + "sorted-set": { + "version": "https://registry.npmjs.org/sorted-set/-/sorted-set-0.3.0.tgz", + "integrity": "sha1-POAVeFtkdPH6A6HGn/8ymFL8N+M=" + }, + "sprintf-js": { + "version": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "string_decoder": { + "version": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", + "requires": { + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + }, + "string-width": { + "version": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "is-fullwidth-code-point": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "strip-ansi": { + "version": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "requires": { + "ansi-regex": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" + } + }, + "strip-bom": { + "version": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-json-comments": { + "version": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "supports-color": { + "version": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "table": { + "version": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", + "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", + "dev": true, + "requires": { + "ajv": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "ajv-keywords": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", + "chalk": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "lodash": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "slice-ansi": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", + "string-width": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz" + }, + "dependencies": { + "ansi-regex": { + "version": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "dev": true, + "requires": { + "is-fullwidth-code-point": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz" + } + }, + "strip-ansi": { + "version": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" + } + } + } + }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz" + } + }, + "tar-fs": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-1.15.3.tgz", + "integrity": "sha1-7M+TXpQUk9gVECjmNuUc5MPKfyA=", + "optional": true, + "requires": { + "chownr": "1.0.1", + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "pump": "1.0.2", + "tar-stream": "1.5.4" + } + }, + "tar-stream": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.4.tgz", + "integrity": "sha1-NlSc8E7RrumyowwBQyUiONr5QBY=", + "requires": { + "bl": "1.0.3", + "end-of-stream": "1.4.0", + "readable-stream": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + } + }, + "text-encoding": { + "version": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", + "integrity": "sha1-45mpgiV6J22uQou5KEXLcb3CbRk=", + "dev": true + }, + "text-table": { + "version": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "requires": { + "readable-stream": "1.0.34", + "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "requires": { + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + } + } + }, + "to-array": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz", + "integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA=", + "optional": true + }, + "to-fast-properties": { + "version": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "requires": { + "punycode": "1.4.1" + } + }, + "tryit": { + "version": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", + "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-check": { + "version": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz" + } + }, + "type-detect": { + "version": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "dev": true + }, + "typedarray": { + "version": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "ultron": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", + "integrity": "sha1-rOEWq1V80Zc4ak6I9GhTeMiy5Po=" + }, + "unzip-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz", + "integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=", + "optional": true + }, + "url-template": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=", + "optional": true + }, + "user-home": { + "version": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", + "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", + "dev": true, + "requires": { + "os-homedir": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz" + } + }, + "utf8": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.0.tgz", + "integrity": "sha1-DP7FyAUtRKI+OqqQgQToB1+V39U=" + }, + "util-deprecate": { + "version": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "util-extend": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/util-extend/-/util-extend-1.0.3.tgz", + "integrity": "sha1-p8IW0mdUUWljeztu3GypEZ4v+T8=", + "optional": true + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "extsprintf": "1.3.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + } + } + }, + "vlq": { + "version": "https://registry.npmjs.org/vlq/-/vlq-0.2.2.tgz", + "integrity": "sha1-4xbVJXtAuGu0PLjV/qXX9U1rDKE=", + "dev": true + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "requires": { + "isexe": "2.0.0" + } + }, + "wide-align": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "optional": true, + "requires": { + "string-width": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" + } + }, + "wordwrap": { + "version": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrappy": { + "version": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "write": { + "version": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz" + } + }, + "ws": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.0.tgz", + "integrity": "sha1-wdb9FRXTzv8fCuJ1m/X9dwMKrR0=", + "optional": true, + "requires": { + "options": "0.0.6", + "ultron": "1.0.2" + } + }, + "xmlhttprequest-ssl": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.1.tgz", + "integrity": "sha1-O3dB/qSoZnWXbpCNKW1ERZYfqmc=", + "optional": true + }, + "xtend": { + "version": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yeast": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz", + "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk=", + "optional": true + } + } +} diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 82d8841..cf5ee8b 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -188,7 +188,7 @@ describe("TrustIsRisk", () => { // By changing the trust recipient from bob to charlie, we make the transaction a // nullifying trust transaction. trustDecreasingMTX.outputs[0] = - testHelpers.getOneOfTwoMultisigOutput(addr.alice.pubKey, addr.charlie.pubKey, 20 * COIN); + testHelpers.getOneOfThreeMultisigOutput(addr.alice.pubKey, addr.charlie.pubKey, 20 * COIN); tir.addTX(trustDecreasingMTX.toTX()); tir.getDirectTrust(alice, bob).should.equal(0); From 037189b1dfbfe62edeb803d394e013988f456de8 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 22:09:03 +0100 Subject: [PATCH 052/113] Remove unneeded requires --- test/trust_is_risk.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index cf5ee8b..f59c791 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -10,8 +10,6 @@ var consensus = require("bcoin/lib/protocol/consensus"); var sinon = require("sinon"); var should = require("should"); var fixtures = require("./fixtures"); -var crypto = require("bcoin/lib/crypto"); -var base58 = require("bcoin/lib/utils/base58"); var assert = require("assert"); require("should-sinon"); From 3a9c031646ca2e274476c3f94745106bae2679e4 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 22:09:35 +0100 Subject: [PATCH 053/113] Prepend "Address" with "bcoin.primitives." --- test/trust_is_risk.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index f59c791..306de19 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -78,7 +78,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("is a valid bitcoin address", () => { - assert.ok(Address.fromString(tag.toString("ascii"))); + assert.ok(bcoin.primitives.Address.fromString(tag.toString("ascii"))); }); it("corresponds to a public key that contains \"Trust is Risk\"", () => { @@ -88,8 +88,8 @@ describe("TrustIsRisk", () => { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; - bcoin.prototype.HDPublicKey.fromBase58(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); - bcoin.http.Wallet.getKey(Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + bcoin.prototype.HDPublicKey.fromBase58(bcoin.primitives.Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + bcoin.http.Wallet.getKey(bcoin.primitives.Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); }); }); From 88a190a7071ae185d2f2a15410486d016ae4a582 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 23:16:51 +0100 Subject: [PATCH 054/113] Remove HDPublicKey --- flow-typed/npm/bcoin_vx.x.x.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index db7d461..f1a55da 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -101,9 +101,6 @@ declare module 'bcoin' { base58 : { encode(str : (string | Buffer)) : Buffer }, - HDPublicKey : { - fromBase58(str : (string | Buffer)) : Buffer - } } } From 78fed482444e3a5d2000b1c603c4551c9d99b18e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 23:17:46 +0100 Subject: [PATCH 055/113] Add secp256k1 --- test/trust_is_risk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 306de19..0cd49e3 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -7,6 +7,7 @@ var Input = bcoin.primitives.Input; var MTX = bcoin.primitives.MTX; var testHelpers = require("./helpers"); var consensus = require("bcoin/lib/protocol/consensus"); +var secp256k1 = bcoin.crypto.ec-secp256k1; var sinon = require("sinon"); var should = require("should"); var fixtures = require("./fixtures"); From 7f766599e411a9ea90142da88c996d0f59204127 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 23:18:14 +0100 Subject: [PATCH 056/113] Add fakePubKey verification test --- test/trust_is_risk.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 0cd49e3..94af402 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -78,6 +78,10 @@ describe("TrustIsRisk", () => { }); describe("tag", () => { + it("corresponds to a valid public key", () => { + assert(bcoin.crypto.publicKeyVerify(fakePubKey)); + }); + it("is a valid bitcoin address", () => { assert.ok(bcoin.primitives.Address.fromString(tag.toString("ascii"))); }); From 86ea4bcf1624da40cff0e6d24d5c9931554dfd2d Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 23:18:40 +0100 Subject: [PATCH 057/113] Remove ".ok" from "assert" --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 94af402..e83bafd 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -83,7 +83,7 @@ describe("TrustIsRisk", () => { }); it("is a valid bitcoin address", () => { - assert.ok(bcoin.primitives.Address.fromString(tag.toString("ascii"))); + assert(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))); }); it("corresponds to a public key that contains \"Trust is Risk\"", () => { From 5457bda4d8c355da1fc5888186301d311ed5156e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 12 Sep 2017 23:19:17 +0100 Subject: [PATCH 058/113] Replace "fromString" with "fromBase58", comment --- test/trust_is_risk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index e83bafd..1df4527 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -93,8 +93,8 @@ describe("TrustIsRisk", () => { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; - bcoin.prototype.HDPublicKey.fromBase58(bcoin.primitives.Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); - bcoin.http.Wallet.getKey(bcoin.primitives.Address.fromString(tag.toString("ascii"))).should.equal(fakePubKeyArray); + //bcoin.primitives.HDPublicKey.fromBase58(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))).should.equal(fakePubKeyArray); + bcoin.http.Wallet.getKey(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))).should.equal(Buffer.from(fakePubKey)); }); }); From 32085a9ff2b34926deabf2f07a17a3c12a8c6b7b Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 13 Sep 2017 20:58:13 +0100 Subject: [PATCH 059/113] Verify fake public key correctly --- test/trust_is_risk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 1df4527..6775945 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -7,7 +7,7 @@ var Input = bcoin.primitives.Input; var MTX = bcoin.primitives.MTX; var testHelpers = require("./helpers"); var consensus = require("bcoin/lib/protocol/consensus"); -var secp256k1 = bcoin.crypto.ec-secp256k1; +var secp256k1 = require("bcoin/lib/crypto/ec-secp256k1"); var sinon = require("sinon"); var should = require("should"); var fixtures = require("./fixtures"); @@ -79,7 +79,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("corresponds to a valid public key", () => { - assert(bcoin.crypto.publicKeyVerify(fakePubKey)); + assert(secp256k1.publicKeyVerify(fakePubKey)); }); it("is a valid bitcoin address", () => { From 52cf7d66e36401787d8d34f29c6d2cd4349eff9d Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 13 Sep 2017 20:58:43 +0100 Subject: [PATCH 060/113] Remove old fake public key --- test/trust_is_risk.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 6775945..2fc85d7 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -87,12 +87,6 @@ describe("TrustIsRisk", () => { }); it("corresponds to a public key that contains \"Trust is Risk\"", () => { - const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00]; //bcoin.primitives.HDPublicKey.fromBase58(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))).should.equal(fakePubKeyArray); bcoin.http.Wallet.getKey(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))).should.equal(Buffer.from(fakePubKey)); }); From db912b5dea6c53b39e791960c1f975dc7d9f7b52 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 13 Sep 2017 21:00:36 +0100 Subject: [PATCH 061/113] Add tag generator This script shows how the fake public key which corresponds to the tag "address" was generated. --- test/tag-generator.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/tag-generator.py diff --git a/test/tag-generator.py b/test/tag-generator.py new file mode 100644 index 0000000..3bab049 --- /dev/null +++ b/test/tag-generator.py @@ -0,0 +1,27 @@ +# Thanks to http://code.activestate.com/recipes/577821-integer-square-root-function/ for isqrt() +def isqrt(x): + if x < 0: + raise ValueError('square root not defined for negative numbers') + n = int(x) + if n == 0: + return 0 + a, b = divmod(n.bit_length(), 2) + x = 2**(a+b) + while True: + y = (x + n//x)//2 + if y >= x: + return x + x = y + +x = 0x5472757374206973205269736b00000000000000000000000000000000000000 +# 54:72:75:73:74:20:69:73:20:52:69:73:6b is the ASCII representation of "Trust is Risk" +p = 2**256 - 2**32 - 977 +y = pow((x**3 + 7), (p+1)//4, p) + +while ((y**2) % p) != (x**3 + 7) % p: + x=x+1 + y = pow((x**3 + 7), (p+1)//4, p) + +print("Found it!") +print("x is " + hex(x)) +print("y is " + hex(y)) From d96f244c991896c36c540ac0783d8d9f893983ad Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 13 Sep 2017 21:02:57 +0100 Subject: [PATCH 062/113] Use valid fake public key --- src/trust_is_risk.js | 17 +++++++++++------ test/helpers.js | 17 +++++++++++------ test/trust_is_risk.js | 18 ++++++++++++------ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 023dcbe..66832cf 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,12 +13,17 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00]; +const fakePubKeyArray = [0x04, // constant 0x04 prefix + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + // secp256k1 curve: y^2 = x^3 + 7 + 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, + 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate + 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/helpers.js b/test/helpers.js index 7715c08..e14016a 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -5,12 +5,17 @@ var fixtures = require("./fixtures"); var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); -const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00]; +const fakePubKeyArray = [0x04, // constant 0x04 prefix + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + // secp256k1 curve: y^2 = x^3 + 7 + 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, + 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate + 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 2fc85d7..1039f80 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -15,12 +15,18 @@ var assert = require("assert"); require("should-sinon"); const COIN = bcoin.consensus.COIN; -const fakePubKeyArray = [0x04, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00]; + +const fakePubKeyArray = [0x04, // constant 0x04 prefix + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + // secp256k1 curve: y^2 = x^3 + 7 + 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, + 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate + 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + const fakePubKey = Buffer.from(fakePubKeyArray); const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); const step3 = Buffer.concat([Buffer.alloc(1), step2]); From 8235022d61776c9767f03181f96a180bd2d9621c Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 15 Sep 2017 12:15:55 +0100 Subject: [PATCH 063/113] Remove TODO --- test/trust_is_risk.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 1039f80..1ba391d 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -55,7 +55,6 @@ describe("TrustIsRisk", () => { var node, tir, trustIncreasingMTX, trustDecreasingMTX, trustIncreasingTX; beforeEach(() => { - // TODO: check that tag has correct type and format: Valid address, corresponding public key is "0x04Trust is Risk0x00..0x00" node = new bcoin.fullnode({}); tir = new Trust.TrustIsRisk(node); From caab3be55786d691a33c089d6fe2e0552f029414 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 15 Sep 2017 12:16:15 +0100 Subject: [PATCH 064/113] Use "should" syntax instead of "assert" --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 1ba391d..883fad5 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -84,7 +84,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("corresponds to a valid public key", () => { - assert(secp256k1.publicKeyVerify(fakePubKey)); + secp256k1.publicKeyVerify(fakePubKey).should.equal(true); }); it("is a valid bitcoin address", () => { From fb6b2462065fc28595ca36f9ccc912c7dd306a10 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 15 Sep 2017 16:06:44 +0100 Subject: [PATCH 065/113] Add test that fakePubKey is a buffer --- test/trust_is_risk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 883fad5..a90828a 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -84,6 +84,7 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("corresponds to a valid public key", () => { + Buffer.isBuffer(fakePubKey).should.equal(true); secp256k1.publicKeyVerify(fakePubKey).should.equal(true); }); From bb09e2101a155644eeaa6e3385f2e6f94f569d31 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 15 Sep 2017 16:35:28 +0100 Subject: [PATCH 066/113] Simplify tag creation from key Use bcoin libraries instead of reinventing the wheel --- src/trust_is_risk.js | 8 ++------ test/helpers.js | 8 ++------ test/trust_is_risk.js | 9 +++------ 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 66832cf..f9ec257 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -25,12 +25,8 @@ const fakePubKeyArray = [0x04, // constant 0x04 prefix 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; const fakePubKey = Buffer.from(fakePubKeyArray); -const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); -const step3 = Buffer.concat([Buffer.alloc(1), step2]); -const step4 = Buffer.from(bcoin.crypto.hash256(step3)); -const step5 = step4.slice(0, 4); -const step6 = Buffer.concat([step3, step5]); -const tag = Buffer.from(bcoin.base58.encode(step6)); +const fakeKeyRing = KeyRing.fromPublic(fakePubKey); +const tag = Buffer.from(fakeKeyRing.getAddress("base58")); class TrustIsRisk { node : bcoin$FullNode diff --git a/test/helpers.js b/test/helpers.js index e14016a..dda2061 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -17,12 +17,8 @@ const fakePubKeyArray = [0x04, // constant 0x04 prefix 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; const fakePubKey = Buffer.from(fakePubKeyArray); -const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); -const step3 = Buffer.concat([Buffer.alloc(1), step2]); -const step4 = Buffer.from(bcoin.crypto.hash256(step3)); -const step5 = step4.slice(0, 4); -const step6 = Buffer.concat([step3, step5]); -const tag = Buffer.from(bcoin.base58.encode(step6)); +const fakeKeyRing = KeyRing.fromPublic(fakePubKey); +const tag = Buffer.from(fakeKeyRing.getAddress("base58")); var testHelpers = { getNode: async () => { diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index a90828a..ed0ee61 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -5,6 +5,7 @@ var Coin = bcoin.primitives.Coin; var Address = bcoin.primitives.Address; var Input = bcoin.primitives.Input; var MTX = bcoin.primitives.MTX; +var KeyRing = bcoin.primitives.KeyRing; var testHelpers = require("./helpers"); var consensus = require("bcoin/lib/protocol/consensus"); var secp256k1 = require("bcoin/lib/crypto/ec-secp256k1"); @@ -28,12 +29,8 @@ const fakePubKeyArray = [0x04, // constant 0x04 prefix 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; const fakePubKey = Buffer.from(fakePubKeyArray); -const step2 = Buffer.from(bcoin.crypto.hash160(fakePubKey)); -const step3 = Buffer.concat([Buffer.alloc(1), step2]); -const step4 = Buffer.from(bcoin.crypto.hash256(step3)); -const step5 = step4.slice(0, 4); -const step6 = Buffer.concat([step3, step5]); -const tag = Buffer.from(bcoin.base58.encode(step6)); +const fakeKeyRing = KeyRing.fromPublic(fakePubKey); +const tag = Buffer.from(fakeKeyRing.getAddress("base58")); describe("TrustIsRisk", () => { var addr = {}; From d13061e58ca46501b7980860a7c2d355d71ad2fa Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 15 Sep 2017 17:19:59 +0100 Subject: [PATCH 067/113] Add getAddress() type --- flow-typed/npm/bcoin_vx.x.x.js | 1 + 1 file changed, 1 insertion(+) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index f1a55da..73c672f 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -73,6 +73,7 @@ declare class bcoin$KeyRing { getPublicKey() : Buffer; getPrivateKey() : Buffer; + getAddress() : Buffer; } declare class bcoin$Coin extends bcoin$Output { From 2c60c69d90fedd15cf85467ea7257188fe0ab362 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 15 Sep 2017 17:20:26 +0100 Subject: [PATCH 068/113] Remove last test in tag The test needed to invert a hash... --- test/trust_is_risk.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index ed0ee61..98b9feb 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -88,11 +88,6 @@ describe("TrustIsRisk", () => { it("is a valid bitcoin address", () => { assert(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))); }); - - it("corresponds to a public key that contains \"Trust is Risk\"", () => { - //bcoin.primitives.HDPublicKey.fromBase58(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))).should.equal(fakePubKeyArray); - bcoin.http.Wallet.getKey(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))).should.equal(Buffer.from(fakePubKey)); - }); }); describe(".getDirectTrust()", () => { From 907170ddb5547d273fca592d1628c572641fecd5 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 17 Sep 2017 16:09:08 +0100 Subject: [PATCH 069/113] Add spv_node.js Change all occurences of "full" to "spv" in the new file --- src/spv_node.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/spv_node.js diff --git a/src/spv_node.js b/src/spv_node.js new file mode 100644 index 0000000..aa26fa4 --- /dev/null +++ b/src/spv_node.js @@ -0,0 +1,14 @@ +// @flow +var bcoin = require("bcoin"); +var TrustIsRisk = require("./trust_is_risk"); + +class SpvNode extends bcoin.spvnode { + trust : TrustIsRisk + + constructor(options : Object) { + super(options); + this.trust = new TrustIsRisk(this); + } +} + +module.exports = SpvNode; From 37fb6f40f4fbfe07405b6a766734152d519cff56 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 17 Sep 2017 16:20:15 +0100 Subject: [PATCH 070/113] Add SPVNode types and refs to relevant files --- flow-typed/npm/bcoin_vx.x.x.js | 8 ++++++++ src/spv_node.js | 4 ++-- src/trust_is_risk.js | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index 73c672f..0903ad9 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -9,6 +9,13 @@ declare class bcoin$FullNode { getCoin(hash : Hash, index : number) : bcoin$Coin; } +declare class bcoin$SPVNode { + on(eventName : string, eventHandler : Function) : void; + getTX(hash : Hash) : Promise; + getCoin(hash : Hash, index : number) : bcoin$Coin; + //TODO Check if changes/additions are needed +} + declare class bcoin$Address { toBase58() : string; hash : Buffer; @@ -84,6 +91,7 @@ declare class bcoin$Coin extends bcoin$Output { declare module 'bcoin' { declare module.exports: { fullnode : Class, + spvnode : Class, script : Class, primitives : { Address : Class, diff --git a/src/spv_node.js b/src/spv_node.js index aa26fa4..91a7e12 100644 --- a/src/spv_node.js +++ b/src/spv_node.js @@ -2,7 +2,7 @@ var bcoin = require("bcoin"); var TrustIsRisk = require("./trust_is_risk"); -class SpvNode extends bcoin.spvnode { +class SPVNode extends bcoin.spvnode { trust : TrustIsRisk constructor(options : Object) { @@ -11,4 +11,4 @@ class SpvNode extends bcoin.spvnode { } } -module.exports = SpvNode; +module.exports = SPVNode; diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index f9ec257..2cc1bb8 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -29,10 +29,10 @@ const fakeKeyRing = KeyRing.fromPublic(fakePubKey); const tag = Buffer.from(fakeKeyRing.getAddress("base58")); class TrustIsRisk { - node : bcoin$FullNode + node : (bcoin$FullNode | bcoin$SPVNode) db : TrustDB - constructor(node : bcoin$FullNode) { + constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { this.node = node; this.db = new TrustDB(); From 6b0112b38f9aa024cfedb72d92760ab435608860 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 18 Sep 2017 20:04:12 +0100 Subject: [PATCH 071/113] Add pool.watchAddress() function type --- flow-typed/npm/bcoin_vx.x.x.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index 0903ad9..3bad75a 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -13,9 +13,14 @@ declare class bcoin$SPVNode { on(eventName : string, eventHandler : Function) : void; getTX(hash : Hash) : Promise; getCoin(hash : Hash, index : number) : bcoin$Coin; + pool : bcoin$Pool; //TODO Check if changes/additions are needed } +declare class bcoin$Pool { + watchAddress(address : Buffer) : void; +} + declare class bcoin$Address { toBase58() : string; hash : Buffer; @@ -93,6 +98,7 @@ declare module 'bcoin' { fullnode : Class, spvnode : Class, script : Class, + pool : Class, primitives : { Address : Class, TX : Class, From 63cc3b8160bd03b8c98729065aede90015a95a37 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 18 Sep 2017 20:04:47 +0100 Subject: [PATCH 072/113] Add tag --- src/spv_node.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/spv_node.js b/src/spv_node.js index 91a7e12..8b3ebde 100644 --- a/src/spv_node.js +++ b/src/spv_node.js @@ -2,6 +2,21 @@ var bcoin = require("bcoin"); var TrustIsRisk = require("./trust_is_risk"); +const fakePubKeyArray = [0x04, // constant 0x04 prefix + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + // secp256k1 curve: y^2 = x^3 + 7 + 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, + 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate + 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + +const fakePubKey = Buffer.from(fakePubKeyArray); +const fakeKeyRing = bcoin.primitives.KeyRing.fromPublic(fakePubKey); +const tag = Buffer.from(fakeKeyRing.getAddress("base58")); + class SPVNode extends bcoin.spvnode { trust : TrustIsRisk From 1704b5613626403b2cecc6bd3a46a5cd08ffc36a Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 18 Sep 2017 20:05:05 +0100 Subject: [PATCH 073/113] Add tag to Bloom filter --- src/spv_node.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spv_node.js b/src/spv_node.js index 8b3ebde..721cdec 100644 --- a/src/spv_node.js +++ b/src/spv_node.js @@ -23,6 +23,7 @@ class SPVNode extends bcoin.spvnode { constructor(options : Object) { super(options); this.trust = new TrustIsRisk(this); + this.pool.watchAddress(tag); } } From 6cd6779e8b7d6452af653c990d44d11331650b34 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 18 Sep 2017 20:05:32 +0100 Subject: [PATCH 074/113] Add SPV node test file --- test/spv_node.js | 196 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 test/spv_node.js diff --git a/test/spv_node.js b/test/spv_node.js new file mode 100644 index 0000000..f24d2f5 --- /dev/null +++ b/test/spv_node.js @@ -0,0 +1,196 @@ +var Trust = require("../"); +var helpers = require("../lib/helpers.js"); +var bcoin = require("bcoin"); +var Script = bcoin.script; +var Address = bcoin.primitives.Address; +var KeyRing = bcoin.primitives.KeyRing; +var MTX = bcoin.primitives.MTX; +var Input = bcoin.primitives.Input; +var Output = bcoin.primitives.Output; +var Outpoint = bcoin.primitives.Outpoint; +var testHelpers = require("./helpers"); +var consensus = require("bcoin/lib/protocol/consensus"); +var sinon = require("sinon"); +var should = require("should"); +var assert = require("assert"); +var fixtures = require("./fixtures"); +require("should-sinon"); + +const COIN = consensus.COIN; + +describe("SPVNode", () => { + var node = null; + var walletDB = null; + var NodeWatcher = null; + var watcher = null; + + beforeEach("get node", async () => { + node = await testHelpers.getNode(); + watcher = new testHelpers.NodeWatcher(node); + }); + + beforeEach("get walletDB", async () => { + walletDB = await testHelpers.getWalletDB(node); + }); + + afterEach("close walletDB", async () => walletDB.close()); + afterEach("close node", async () => node.close()); + + it("should call trust.addTX() on every transaction", async function() { + var sender = await testHelpers.createWallet(walletDB, "sender"); + var receiver = await testHelpers.createWallet(walletDB, "receiver"); + + await testHelpers.delay(1000); + // Produce a block and reward the sender, so that we have a coin to spend. + await testHelpers.mineBlock(node, sender.getAddress("base58")); + + // Make the coin spendable. + consensus.COINBASE_MATURITY = 0; + await testHelpers.delay(100); + + await sender.send({ + outputs: [{ + value: 10 * COIN, + address: receiver.getAddress("base58") + }] + }); + await watcher.waitForTX(); + + node.trust.addTX.should.be.calledOnce(); + }); + + describe("with the nobodyLikesFrank.json example", () => { + var addresses, rings = {}; + + beforeEach("apply graph transactions", async () => { + addresses = {}; + + for (var [name, keyRing] of Object.entries(fixtures.keyRings)) { + addresses[name] = helpers.pubKeyToEntity(keyRing.getPublicKey()); + } + + // Alice mines three blocks, each rewards her with 50 spendable BTC + consensus.COINBASE_MATURITY = 0; + var blockCount = 3; + var coinbaseHashes = []; + for(let i = 0; i < blockCount; i++) { + var block = await testHelpers.mineBlock(node, addresses.alice); + coinbaseHashes.push(block.txs[0].hash()); + await testHelpers.delay(500); + } + + // Alice sends 20 BTC to everyone (including herself) via P2PKH + var sendAmount = 20; + var outputs = fixtures.names.map((name) => { + return testHelpers.getP2PKHOutput( + Address.fromHash(bcoin.crypto.hash160(fixtures.keyRings[name].getPublicKey())) + .toBase58(), + sendAmount * consensus.COIN); + }); + + // We have to use a change output, because transaction with too large a fee are considered + // invalid. + var fee = 0.01; + var changeAmount = 50 * blockCount - sendAmount * fixtures.names.length - fee; + if (changeAmount >= 0.01) { + outputs.push(new Output({ + script: Script.fromPubkeyhash(bcoin.crypto.hash160( + fixtures.keyRings.alice.getPublicKey())), + value: changeAmount * consensus.COIN + })); + } + + // Use the coinbase coins as inputs + var coinbaseCoins = await Promise.all(coinbaseHashes.map((hash) => { + return node.getCoin(hash.toString("hex"), 0); + })); + var mtx = new MTX({outputs}); + coinbaseCoins.forEach((coin) => mtx.addCoin(coin)); + + var signedCount = mtx.sign(fixtures.keyRings.alice); + assert(signedCount === blockCount); + assert(await mtx.verify()); + + var tx = mtx.toTX(); + node.sendTX(tx); + await watcher.waitForTX(); + + prevout = {}; + fixtures.names.forEach((name) => { + prevout[name] = { + hash: tx.hash().toString("hex"), + index: fixtures.names.indexOf(name) + }; + }); + + // Alice mines another block + await testHelpers.mineBlock(node, helpers.pubKeyToEntity( + fixtures.keyRings.alice.getPublicKey())); + await testHelpers.delay(500); + + var graph = require("./graphs/nobodyLikesFrank.json"); + for (var origin in graph) { + var neighbours = graph[origin]; + for (var dest in neighbours) { + var value = neighbours[dest]; + if (!value || value < 1) continue; + + let outpoint = new Outpoint(prevout[origin].hash, prevout[origin].index); + + let mtx = await node.trust.createTrustIncreasingMTX( + fixtures.keyRings[origin].getPrivateKey(), + fixtures.keyRings[dest].getPublicKey(), + outpoint, + value * consensus.COIN); + + assert(await mtx.verify()); + + let tx = mtx.toTX(); + node.sendTX(tx); + await watcher.waitForTX(); + + prevout[origin] = {hash: tx.hash().toString("hex"), index: 1}; + } + } + + // Alice mines yet another block + await testHelpers.mineBlock(node, helpers.pubKeyToEntity( + fixtures.keyRings.alice.getPublicKey())); + await testHelpers.delay(500); + }); + + it("computes trusts correctly", () => { + for (name in addresses) { // Add addresses to scope + eval(`var ${name} = "${addresses[name]}";`); + } + + should(node.trust.getIndirectTrust(alice, alice)).equal(Infinity); + should(node.trust.getIndirectTrust(alice, bob)).equal(10 * COIN); + should(node.trust.getIndirectTrust(alice, charlie)).equal(1 * COIN); + should(node.trust.getIndirectTrust(alice, frank)).equal(0); + should(node.trust.getIndirectTrust(alice, eve)).equal(6 * COIN); + + should(node.trust.getIndirectTrust(bob, alice)).equal(1 * COIN); + should(node.trust.getIndirectTrust(bob, eve)).equal(3 * COIN); + should(node.trust.getIndirectTrust(dave, eve)).equal(12 * COIN); + should(node.trust.getIndirectTrust(george, eve)).equal(0); + }); + + it("after decreasing some trusts computes trusts correctly", async () => { + var mtxs = node.trust.createTrustDecreasingMTXs(fixtures.keyRings.alice.getPrivateKey(), + fixtures.keyRings.bob.getPublicKey(), 3 * COIN); + mtxs.length.should.equal(1); + var mtx = mtxs[0]; + + should(await mtx.verify()); + node.sendTX(mtx.toTX()); + + await testHelpers.delay(750); + should(node.trust.getIndirectTrust(addresses.alice, addresses.bob)).equal(7 * COIN); + }); + }); + + describe("with the topcoder.json example", () => { + //TODO: Write tests here. + }); +}); From 8a89d63f7263197d79419c3b374f76833bfdc7de Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 19 Sep 2017 21:49:19 +0100 Subject: [PATCH 075/113] Put tag in TrustIsRisk constructor --- src/trust_is_risk.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 2cc1bb8..1ed8103 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,26 +13,30 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); -const fakePubKeyArray = [0x04, // constant 0x04 prefix - 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - // secp256k1 curve: y^2 = x^3 + 7 - 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, - 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, - 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate - 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - -const fakePubKey = Buffer.from(fakePubKeyArray); -const fakeKeyRing = KeyRing.fromPublic(fakePubKey); -const tag = Buffer.from(fakeKeyRing.getAddress("base58")); - class TrustIsRisk { node : (bcoin$FullNode | bcoin$SPVNode) db : TrustDB - + fakePubKeyArray : Array + fakePubKey : Buffer + fakeKeyRing : KeyRing + tag : Buffer + constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { + this.fakePubKeyArray = [0x04, // constant 0x04 prefix + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + // secp256k1 curve: y^2 = x^3 + 7 + 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, + 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate + 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + + this.fakePubKey = Buffer.from(this.fakePubKeyArray); + this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); + this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); + this.node = node; this.db = new TrustDB(); @@ -97,7 +101,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, tag]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.tag]), value: trustAmount }) ] @@ -179,7 +183,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, tag]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.tag]), value: remainingTrustAmount })); } From 5aeb1fc969650bca4de0795eb2a849e98452355e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 19 Sep 2017 22:36:01 +0100 Subject: [PATCH 076/113] Separate type declarations and assignments --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 1ed8103..94c44e7 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -20,7 +20,7 @@ class TrustIsRisk { fakePubKey : Buffer fakeKeyRing : KeyRing tag : Buffer - + constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { this.fakePubKeyArray = [0x04, // constant 0x04 prefix 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, From d572b77eb7ce02f8e9828430715a98b70c52c4a2 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Tue, 19 Sep 2017 22:55:13 +0100 Subject: [PATCH 077/113] Use tag from TrustIsRisk class --- test/helpers.js | 17 +---------------- test/trust_is_risk.js | 24 ++++-------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index dda2061..be995d3 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -2,24 +2,8 @@ var TrustIsRisk = require("../"); var WalletDB = require("bcoin/lib/wallet/walletdb"); var bcoin = require("bcoin"); var fixtures = require("./fixtures"); -var KeyRing = bcoin.primitives.KeyRing; var assert = require("assert"); -const fakePubKeyArray = [0x04, // constant 0x04 prefix - 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - // secp256k1 curve: y^2 = x^3 + 7 - 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, - 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, - 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate - 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - -const fakePubKey = Buffer.from(fakePubKeyArray); -const fakeKeyRing = KeyRing.fromPublic(fakePubKey); -const tag = Buffer.from(fakeKeyRing.getAddress("base58")); - var testHelpers = { getNode: async () => { var node = new TrustIsRisk.FullNode({network: "regtest", passphrase: "secret"}); @@ -98,6 +82,7 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { + tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).tag; return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), value diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 98b9feb..7a29167 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -5,7 +5,6 @@ var Coin = bcoin.primitives.Coin; var Address = bcoin.primitives.Address; var Input = bcoin.primitives.Input; var MTX = bcoin.primitives.MTX; -var KeyRing = bcoin.primitives.KeyRing; var testHelpers = require("./helpers"); var consensus = require("bcoin/lib/protocol/consensus"); var secp256k1 = require("bcoin/lib/crypto/ec-secp256k1"); @@ -17,21 +16,6 @@ require("should-sinon"); const COIN = bcoin.consensus.COIN; -const fakePubKeyArray = [0x04, // constant 0x04 prefix - 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - // secp256k1 curve: y^2 = x^3 + 7 - 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, - 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, - 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate - 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - -const fakePubKey = Buffer.from(fakePubKeyArray); -const fakeKeyRing = KeyRing.fromPublic(fakePubKey); -const tag = Buffer.from(fakeKeyRing.getAddress("base58")); - describe("TrustIsRisk", () => { var addr = {}; for (let [name, keyRing] of Object.entries(fixtures.keyRings)) { @@ -81,12 +65,12 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("corresponds to a valid public key", () => { - Buffer.isBuffer(fakePubKey).should.equal(true); - secp256k1.publicKeyVerify(fakePubKey).should.equal(true); + Buffer.isBuffer(tir.fakePubKey).should.equal(true); + secp256k1.publicKeyVerify(tir.fakePubKey).should.equal(true); }); it("is a valid bitcoin address", () => { - assert(bcoin.primitives.Address.fromBase58(tag.toString("ascii"))); + assert(bcoin.primitives.Address.fromBase58(tir.tag.toString("ascii"))); }); }); @@ -232,7 +216,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.deepEqual(tag); + trustOutput.script.get(3).should.deepEqual(tir.tag); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From 14f7cb7f0e667a646cd71d8c06f1fa5baca2fe70 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 17:32:23 +0100 Subject: [PATCH 078/113] Add console capability --- .eslintrc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index f8d4494..2d511eb 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,7 +30,8 @@ ], "flowtype/space-before-type-colon": 0, "no-undef": 0, - "no-unused-vars": 0 + "no-unused-vars": 0, + "no-console": 0 }, "settings": { "flowtype": { From a932ed31c112d1cdea86d8a49728e3b0f871f8a3 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:20:39 +0100 Subject: [PATCH 079/113] Run npm install --- package-lock.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index d417c2e..2086d94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "abstract-leveldown": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", - "integrity": "sha512-2++wDf/DYqkPR3o5tbfdhF96EfMApo1GpPfzOsR/ZYXdkSmELlvOOEAl9iKkRsktMPHdGjO4rtkBpf2I7TiTeA==", + "integrity": "sha1-HF6Mal75Za6MNd+zqHcMR2uCxLg=", "optional": true, "requires": { "xtend": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" @@ -106,7 +106,7 @@ "aproba": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.2.tgz", - "integrity": "sha512-ZpYajIfO0j2cOFTO955KUMIKNmj6zhX8kVztMAxFsDaMwz+9Z9SV0uou2pC9HJqcfpffOsjnbrDMvkNy+9RXPw==", + "integrity": "sha1-RcZikJTeTpb2k+9+q3SuB5wkD8E=", "optional": true }, "are-we-there-yet": { @@ -417,7 +417,7 @@ "browserify-aes": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.8.tgz", - "integrity": "sha512-WYCMOT/PtGTlpOKFht0YJFYcPy6pLCR98CtWfzK13zoynLlBMvAdEMSRGmgnJCw2M2j/5qxBkinZQFobieM8dQ==", + "integrity": "sha1-yPo7G3WFu3unfFVgtgmW3extUwk=", "optional": true, "requires": { "buffer-xor": "1.0.3", @@ -478,7 +478,7 @@ "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94=", "requires": { "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "safe-buffer": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz" @@ -1042,7 +1042,7 @@ "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "integrity": "sha1-f8vbGY3HGVlDLv4ThCaE4FJaywI=", "optional": true, "requires": { "md5.js": "1.3.4", @@ -1066,7 +1066,7 @@ "expand-template": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-1.1.0.tgz", - "integrity": "sha512-kkjwkMqj0h4w/sb32ERCDxCQkREMCAgS39DscDnSwDsbxnwwM1BTZySdC3Bn1lhY7vL08n9GoO/fVTynjDgRyQ==", + "integrity": "sha1-4J77qXe/mPnuDtJavQxpLgKuw/w=", "optional": true }, "extend": { @@ -1361,7 +1361,7 @@ "hash.js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", - "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "integrity": "sha1-NA3tvmKQGHFRweodd3o0SJNd+EY=", "requires": { "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "minimalistic-assert": "1.0.0" @@ -1880,7 +1880,7 @@ "node-abi": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.1.1.tgz", - "integrity": "sha512-6oxV13poCOv7TfGvhsSz6XZWpXeKkdGVh72++cs33OfMh3KAX8lN84dCvmqSETyDXAFcUHtV7eJrgFBoOqZbNQ==", + "integrity": "sha1-yc2iVuyKqZvKsvZEbbOK8UMziyo=", "optional": true }, "node-gyp": { @@ -2138,7 +2138,7 @@ "prebuild-install": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-2.2.2.tgz", - "integrity": "sha512-F46pcvDxtQhbV3B+dm+exHuKxIyJK26fVNiJRmbTW/5D7o0Z2yzc8CKeu7UWbo9XxQZoVOC88aKgySAsza+cWw==", + "integrity": "sha1-3UfE1h83VPsXu/YBdZ5ZIuFuBnE=", "optional": true, "requires": { "expand-template": "1.1.0", @@ -3009,7 +3009,7 @@ "wide-align": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "integrity": "sha1-Vx4PGwYEY268DfwhsDObvjE0FxA=", "optional": true, "requires": { "string-width": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" From df25421b17d3becdb20189a9c4ede279b6cd81c0 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:21:56 +0100 Subject: [PATCH 080/113] Create short tag and public key --- src/trust_is_risk.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 94c44e7..0a4b5de 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -17,9 +17,13 @@ class TrustIsRisk { node : (bcoin$FullNode | bcoin$SPVNode) db : TrustDB fakePubKeyArray : Array + shortFakePubKeyArray : Array fakePubKey : Buffer + shortFakePubKey : Buffer fakeKeyRing : KeyRing + shortFakeKeyRing : KeyRing tag : Buffer + shortTag : Buffer constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { this.fakePubKeyArray = [0x04, // constant 0x04 prefix @@ -32,10 +36,19 @@ class TrustIsRisk { 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - + + this.shortFakePubKeyArray = [0x02, // 0x02 prefix for even y values + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // only x is given in short version + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; + this.fakePubKey = Buffer.from(this.fakePubKeyArray); + this.shortFakePubKey = Buffer.from(this.shortFakePubKeyArray); this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); + this.shortFakeKeyRing = KeyRing.fromPublic(this.shortFakePubKey); this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); + this.shortTag = Buffer.from(this.shortFakeKeyRing.getAddress("base58")); this.node = node; this.db = new TrustDB(); From e393d8568ee5907ab0369c9193f1a608d1285df9 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:22:56 +0100 Subject: [PATCH 081/113] Use short tag and public key --- src/trust_is_risk.js | 2 +- test/helpers.js | 2 +- test/trust_is_risk.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 0a4b5de..9757077 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -196,7 +196,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.tag]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.shortFakePubKey]), value: remainingTrustAmount })); } diff --git a/test/helpers.js b/test/helpers.js index be995d3..f9b3bd2 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,7 +82,7 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { - tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).tag; + tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).shortTag; return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), value diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 7a29167..89bb123 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -70,7 +70,7 @@ describe("TrustIsRisk", () => { }); it("is a valid bitcoin address", () => { - assert(bcoin.primitives.Address.fromBase58(tir.tag.toString("ascii"))); + assert(bcoin.primitives.Address.fromBase58(tir.shortTag.toString("ascii"))); }); }); @@ -216,7 +216,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.deepEqual(tir.tag); + trustOutput.script.get(3).should.deepEqual(tir.shortTag); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From c93bcf35ca47299374987a5656b80f2172d9c07b Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:24:10 +0100 Subject: [PATCH 082/113] Break down commands into smaller pieces --- test/full_node.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/full_node.js b/test/full_node.js index a3260ba..4737fbf 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -184,7 +184,11 @@ describe("FullNode", () => { var mtx = mtxs[0]; should(await mtx.verify()); - node.sendTX(mtx.toTX()); + var aba = mtx.toTX(); + node.sendTX(aba); + await testHelpers.delay(1000000); + //node.sendTX(mtx.toTX()); + console.log("aha"); await testHelpers.delay(750); should(node.trust.getIndirectTrust(addresses.alice, addresses.bob)).equal(7 * COIN); From b8147960ff9c0487eacc07a591913da61f1baa8c Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:29:58 +0100 Subject: [PATCH 083/113] Rename tag vars for clarity --- src/trust_is_risk.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 9757077..cb60ba6 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -16,17 +16,17 @@ var DirectTrust = require("./direct_trust"); class TrustIsRisk { node : (bcoin$FullNode | bcoin$SPVNode) db : TrustDB + uncompressedFakePubKeyArray : Array fakePubKeyArray : Array - shortFakePubKeyArray : Array + uncompressedFakePubKey : Buffer fakePubKey : Buffer - shortFakePubKey : Buffer + uncompressedFakeKeyRing : KeyRing fakeKeyRing : KeyRing - shortFakeKeyRing : KeyRing + uncompressedTag : Buffer tag : Buffer - shortTag : Buffer constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { - this.fakePubKeyArray = [0x04, // constant 0x04 prefix + this.uncompressedFakePubKeyArray = [0x04, // constant 0x04 prefix 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" @@ -37,18 +37,18 @@ class TrustIsRisk { 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - this.shortFakePubKeyArray = [0x02, // 0x02 prefix for even y values + this.fakePubKeyArray = [0x02, // 0x02 prefix for even y values 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // only x is given in short version 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; + this.uncompressedFakePubKey = Buffer.from(this.uncompressedFakePubKeyArray); this.fakePubKey = Buffer.from(this.fakePubKeyArray); - this.shortFakePubKey = Buffer.from(this.shortFakePubKeyArray); + this.uncompressedFakeKeyRing = KeyRing.fromPublic(this.uncompressedFakePubKey); this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); - this.shortFakeKeyRing = KeyRing.fromPublic(this.shortFakePubKey); + this.uncompressedTag = Buffer.from(this.uncompressedFakeKeyRing.getAddress("base58")); this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); - this.shortTag = Buffer.from(this.shortFakeKeyRing.getAddress("base58")); this.node = node; this.db = new TrustDB(); From fb33b3a491d64957b9ea25085ac800e54572e01b Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:32:04 +0100 Subject: [PATCH 084/113] Use tag instead of shortTag --- test/helpers.js | 2 +- test/trust_is_risk.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index f9b3bd2..be995d3 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,7 +82,7 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { - tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).shortTag; + tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).tag; return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), value diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 89bb123..7a29167 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -70,7 +70,7 @@ describe("TrustIsRisk", () => { }); it("is a valid bitcoin address", () => { - assert(bcoin.primitives.Address.fromBase58(tir.shortTag.toString("ascii"))); + assert(bcoin.primitives.Address.fromBase58(tir.tag.toString("ascii"))); }); }); @@ -216,7 +216,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.deepEqual(tir.shortTag); + trustOutput.script.get(3).should.deepEqual(tir.tag); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From 3fe3c7ebf4ba148c21ff028c7f86eca74365c400 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:32:22 +0100 Subject: [PATCH 085/113] Use public key instead of tag --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index cb60ba6..5929b0f 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -114,7 +114,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.tag]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.fakePubKey]), value: trustAmount }) ] From 3ebc94b61aeeef1f28213d8413d2b203406542c0 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:39:19 +0100 Subject: [PATCH 086/113] Reorder commands for ease of use --- test/full_node.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/full_node.js b/test/full_node.js index 4737fbf..e63acfb 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -184,11 +184,11 @@ describe("FullNode", () => { var mtx = mtxs[0]; should(await mtx.verify()); - var aba = mtx.toTX(); - node.sendTX(aba); - await testHelpers.delay(1000000); - //node.sendTX(mtx.toTX()); - console.log("aha"); + node.sendTX(mtx.toTX()); +// var aba = mtx.toTX(); +// node.sendTX(aba); +// await testHelpers.delay(1000000); +// console.log("aha"); await testHelpers.delay(750); should(node.trust.getIndirectTrust(addresses.alice, addresses.bob)).equal(7 * COIN); From 9488f7f0f4943aed1fb6ac6143662bf054ff4e4e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:39:35 +0100 Subject: [PATCH 087/113] Replace public keys with tags --- src/trust_is_risk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 5929b0f..1b617c9 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -114,7 +114,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.fakePubKey]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.tag]), value: trustAmount }) ] @@ -196,7 +196,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.shortFakePubKey]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.tag]), value: remainingTrustAmount })); } From 3c7517bb45093f314e5ccf76591f460eff02596e Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 20 Sep 2017 21:41:12 +0100 Subject: [PATCH 088/113] Group uncompressed together --- src/trust_is_risk.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 1b617c9..69534d1 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -16,13 +16,15 @@ var DirectTrust = require("./direct_trust"); class TrustIsRisk { node : (bcoin$FullNode | bcoin$SPVNode) db : TrustDB + uncompressedFakePubKeyArray : Array - fakePubKeyArray : Array uncompressedFakePubKey : Buffer - fakePubKey : Buffer uncompressedFakeKeyRing : KeyRing - fakeKeyRing : KeyRing uncompressedTag : Buffer + + fakePubKeyArray : Array + fakePubKey : Buffer + fakeKeyRing : KeyRing tag : Buffer constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { @@ -37,17 +39,19 @@ class TrustIsRisk { 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + this.uncompressedFakePubKey = Buffer.from(this.uncompressedFakePubKeyArray); + this.uncompressedFakeKeyRing = KeyRing.fromPublic(this.uncompressedFakePubKey); + this.uncompressedTag = Buffer.from(this.uncompressedFakeKeyRing.getAddress("base58")); + + this.fakePubKeyArray = [0x02, // 0x02 prefix for even y values 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // only x is given in short version 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; - this.uncompressedFakePubKey = Buffer.from(this.uncompressedFakePubKeyArray); this.fakePubKey = Buffer.from(this.fakePubKeyArray); - this.uncompressedFakeKeyRing = KeyRing.fromPublic(this.uncompressedFakePubKey); this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); - this.uncompressedTag = Buffer.from(this.uncompressedFakeKeyRing.getAddress("base58")); this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); this.node = node; From 1ed0e59f70811eb3afbbd2ff08c068d157221753 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 22 Sep 2017 22:22:31 +0100 Subject: [PATCH 089/113] Hide spv_node.js temporarily It was hidden in order to avoid running the corresponding tests. It will be brought back after the full node tests are all successful. --- test/{spv_node.js => .spv_node.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{spv_node.js => .spv_node.js} (100%) diff --git a/test/spv_node.js b/test/.spv_node.js similarity index 100% rename from test/spv_node.js rename to test/.spv_node.js From c291ec98985c0110d7e348a7be79110fe12f5d80 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 22 Sep 2017 22:24:07 +0100 Subject: [PATCH 090/113] Use uncompressedFakePubKey instead of tag --- src/trust_is_risk.js | 4 ++-- test/helpers.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 69534d1..17ee375 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -118,7 +118,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.tag]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.uncompressedFakePubKey]), value: trustAmount }) ] @@ -200,7 +200,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.tag]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.uncompressedFakePubKey]), value: remainingTrustAmount })); } diff --git a/test/helpers.js b/test/helpers.js index be995d3..b5ea1b2 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,7 +82,7 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { - tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).tag; + tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).uncompressedFakePubKey; return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), value From e7cb2fdd76887459d92359ff9c1babef8f9b8ec0 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 22 Sep 2017 22:35:08 +0100 Subject: [PATCH 091/113] Replace tag with fakePubKey --- test/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 7a29167..43bb468 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -216,7 +216,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.deepEqual(tir.tag); + trustOutput.script.get(3).should.deepEqual(tir.fakePubKey); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From 14efb8a4832a9ecdc85a8402e0d9d82b71640ac6 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 22 Sep 2017 22:35:36 +0100 Subject: [PATCH 092/113] Remove "uncompressed" from fakePubKey* --- src/trust_is_risk.js | 30 +++++++++++++++--------------- test/helpers.js | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 17ee375..70699c2 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -17,18 +17,18 @@ class TrustIsRisk { node : (bcoin$FullNode | bcoin$SPVNode) db : TrustDB - uncompressedFakePubKeyArray : Array - uncompressedFakePubKey : Buffer - uncompressedFakeKeyRing : KeyRing - uncompressedTag : Buffer - fakePubKeyArray : Array fakePubKey : Buffer fakeKeyRing : KeyRing tag : Buffer + compressedFakePubKeyArray : Array + compressedFakePubKey : Buffer + compressedFakeKeyRing : KeyRing + compressedTag : Buffer + constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { - this.uncompressedFakePubKeyArray = [0x04, // constant 0x04 prefix + this.fakePubKeyArray = [0x04, // constant 0x04 prefix 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" @@ -39,20 +39,20 @@ class TrustIsRisk { 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - this.uncompressedFakePubKey = Buffer.from(this.uncompressedFakePubKeyArray); - this.uncompressedFakeKeyRing = KeyRing.fromPublic(this.uncompressedFakePubKey); - this.uncompressedTag = Buffer.from(this.uncompressedFakeKeyRing.getAddress("base58")); + this.fakePubKey = Buffer.from(this.fakePubKeyArray); + this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); + this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); - this.fakePubKeyArray = [0x02, // 0x02 prefix for even y values + this.compressedFakePubKeyArray = [0x02, // 0x02 prefix for even y values 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // only x is given in short version 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; - this.fakePubKey = Buffer.from(this.fakePubKeyArray); - this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); - this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); + this.compressedFakePubKey = Buffer.from(this.compressedFakePubKeyArray); + this.compressedFakeKeyRing = KeyRing.fromPublic(this.compressedFakePubKey); + this.compressedTag = Buffer.from(this.compressedFakeKeyRing.getAddress("base58")); this.node = node; this.db = new TrustDB(); @@ -118,7 +118,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.uncompressedFakePubKey]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.fakePubKey]), value: trustAmount }) ] @@ -200,7 +200,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.uncompressedFakePubKey]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.fakePubKey]), value: remainingTrustAmount })); } diff --git a/test/helpers.js b/test/helpers.js index b5ea1b2..4a21a82 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,7 +82,7 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { - tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).uncompressedFakePubKey; + tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).fakePubKey; return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), value From 16ef72cb35cb6ee08ab57ba59893f95d24faf952 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 22 Sep 2017 22:47:15 +0100 Subject: [PATCH 093/113] Bring back spv_node.js test from hiding --- test/{.spv_node.js => spv_node.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{.spv_node.js => spv_node.js} (100%) diff --git a/test/.spv_node.js b/test/spv_node.js similarity index 100% rename from test/.spv_node.js rename to test/spv_node.js From 7216d41711a94e2ba66f68e58573c3ff76064577 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 23 Sep 2017 19:06:02 +0100 Subject: [PATCH 094/113] Replace "new Buffer" with "Buffer.from" "new Buffer" is [deprecated](https://nodejs.org/api/buffer.html#buffer_new_buffer_string_encoding) --- test/fixtures.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures.js b/test/fixtures.js index a11f021..726417b 100644 --- a/test/fixtures.js +++ b/test/fixtures.js @@ -14,7 +14,7 @@ var privateKeys = { var keyRings = {}; for (let name in privateKeys) { let key = privateKeys[name]; - keyRings[name] = KeyRing.fromPrivate(new Buffer(key, "hex")); + keyRings[name] = KeyRing.fromPrivate(Buffer.from(key, "hex")); } module.exports = { From 4f59609b527155eaec601ff759232c96220990e1 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sat, 23 Sep 2017 19:19:06 +0100 Subject: [PATCH 095/113] Remove spv_node.js files --- src/spv_node.js | 30 -------- test/spv_node.js | 196 ----------------------------------------------- 2 files changed, 226 deletions(-) delete mode 100644 src/spv_node.js delete mode 100644 test/spv_node.js diff --git a/src/spv_node.js b/src/spv_node.js deleted file mode 100644 index 721cdec..0000000 --- a/src/spv_node.js +++ /dev/null @@ -1,30 +0,0 @@ -// @flow -var bcoin = require("bcoin"); -var TrustIsRisk = require("./trust_is_risk"); - -const fakePubKeyArray = [0x04, // constant 0x04 prefix - 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - // secp256k1 curve: y^2 = x^3 + 7 - 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, - 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, - 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate - 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - -const fakePubKey = Buffer.from(fakePubKeyArray); -const fakeKeyRing = bcoin.primitives.KeyRing.fromPublic(fakePubKey); -const tag = Buffer.from(fakeKeyRing.getAddress("base58")); - -class SPVNode extends bcoin.spvnode { - trust : TrustIsRisk - - constructor(options : Object) { - super(options); - this.trust = new TrustIsRisk(this); - this.pool.watchAddress(tag); - } -} - -module.exports = SPVNode; diff --git a/test/spv_node.js b/test/spv_node.js deleted file mode 100644 index f24d2f5..0000000 --- a/test/spv_node.js +++ /dev/null @@ -1,196 +0,0 @@ -var Trust = require("../"); -var helpers = require("../lib/helpers.js"); -var bcoin = require("bcoin"); -var Script = bcoin.script; -var Address = bcoin.primitives.Address; -var KeyRing = bcoin.primitives.KeyRing; -var MTX = bcoin.primitives.MTX; -var Input = bcoin.primitives.Input; -var Output = bcoin.primitives.Output; -var Outpoint = bcoin.primitives.Outpoint; -var testHelpers = require("./helpers"); -var consensus = require("bcoin/lib/protocol/consensus"); -var sinon = require("sinon"); -var should = require("should"); -var assert = require("assert"); -var fixtures = require("./fixtures"); -require("should-sinon"); - -const COIN = consensus.COIN; - -describe("SPVNode", () => { - var node = null; - var walletDB = null; - var NodeWatcher = null; - var watcher = null; - - beforeEach("get node", async () => { - node = await testHelpers.getNode(); - watcher = new testHelpers.NodeWatcher(node); - }); - - beforeEach("get walletDB", async () => { - walletDB = await testHelpers.getWalletDB(node); - }); - - afterEach("close walletDB", async () => walletDB.close()); - afterEach("close node", async () => node.close()); - - it("should call trust.addTX() on every transaction", async function() { - var sender = await testHelpers.createWallet(walletDB, "sender"); - var receiver = await testHelpers.createWallet(walletDB, "receiver"); - - await testHelpers.delay(1000); - // Produce a block and reward the sender, so that we have a coin to spend. - await testHelpers.mineBlock(node, sender.getAddress("base58")); - - // Make the coin spendable. - consensus.COINBASE_MATURITY = 0; - await testHelpers.delay(100); - - await sender.send({ - outputs: [{ - value: 10 * COIN, - address: receiver.getAddress("base58") - }] - }); - await watcher.waitForTX(); - - node.trust.addTX.should.be.calledOnce(); - }); - - describe("with the nobodyLikesFrank.json example", () => { - var addresses, rings = {}; - - beforeEach("apply graph transactions", async () => { - addresses = {}; - - for (var [name, keyRing] of Object.entries(fixtures.keyRings)) { - addresses[name] = helpers.pubKeyToEntity(keyRing.getPublicKey()); - } - - // Alice mines three blocks, each rewards her with 50 spendable BTC - consensus.COINBASE_MATURITY = 0; - var blockCount = 3; - var coinbaseHashes = []; - for(let i = 0; i < blockCount; i++) { - var block = await testHelpers.mineBlock(node, addresses.alice); - coinbaseHashes.push(block.txs[0].hash()); - await testHelpers.delay(500); - } - - // Alice sends 20 BTC to everyone (including herself) via P2PKH - var sendAmount = 20; - var outputs = fixtures.names.map((name) => { - return testHelpers.getP2PKHOutput( - Address.fromHash(bcoin.crypto.hash160(fixtures.keyRings[name].getPublicKey())) - .toBase58(), - sendAmount * consensus.COIN); - }); - - // We have to use a change output, because transaction with too large a fee are considered - // invalid. - var fee = 0.01; - var changeAmount = 50 * blockCount - sendAmount * fixtures.names.length - fee; - if (changeAmount >= 0.01) { - outputs.push(new Output({ - script: Script.fromPubkeyhash(bcoin.crypto.hash160( - fixtures.keyRings.alice.getPublicKey())), - value: changeAmount * consensus.COIN - })); - } - - // Use the coinbase coins as inputs - var coinbaseCoins = await Promise.all(coinbaseHashes.map((hash) => { - return node.getCoin(hash.toString("hex"), 0); - })); - var mtx = new MTX({outputs}); - coinbaseCoins.forEach((coin) => mtx.addCoin(coin)); - - var signedCount = mtx.sign(fixtures.keyRings.alice); - assert(signedCount === blockCount); - assert(await mtx.verify()); - - var tx = mtx.toTX(); - node.sendTX(tx); - await watcher.waitForTX(); - - prevout = {}; - fixtures.names.forEach((name) => { - prevout[name] = { - hash: tx.hash().toString("hex"), - index: fixtures.names.indexOf(name) - }; - }); - - // Alice mines another block - await testHelpers.mineBlock(node, helpers.pubKeyToEntity( - fixtures.keyRings.alice.getPublicKey())); - await testHelpers.delay(500); - - var graph = require("./graphs/nobodyLikesFrank.json"); - for (var origin in graph) { - var neighbours = graph[origin]; - for (var dest in neighbours) { - var value = neighbours[dest]; - if (!value || value < 1) continue; - - let outpoint = new Outpoint(prevout[origin].hash, prevout[origin].index); - - let mtx = await node.trust.createTrustIncreasingMTX( - fixtures.keyRings[origin].getPrivateKey(), - fixtures.keyRings[dest].getPublicKey(), - outpoint, - value * consensus.COIN); - - assert(await mtx.verify()); - - let tx = mtx.toTX(); - node.sendTX(tx); - await watcher.waitForTX(); - - prevout[origin] = {hash: tx.hash().toString("hex"), index: 1}; - } - } - - // Alice mines yet another block - await testHelpers.mineBlock(node, helpers.pubKeyToEntity( - fixtures.keyRings.alice.getPublicKey())); - await testHelpers.delay(500); - }); - - it("computes trusts correctly", () => { - for (name in addresses) { // Add addresses to scope - eval(`var ${name} = "${addresses[name]}";`); - } - - should(node.trust.getIndirectTrust(alice, alice)).equal(Infinity); - should(node.trust.getIndirectTrust(alice, bob)).equal(10 * COIN); - should(node.trust.getIndirectTrust(alice, charlie)).equal(1 * COIN); - should(node.trust.getIndirectTrust(alice, frank)).equal(0); - should(node.trust.getIndirectTrust(alice, eve)).equal(6 * COIN); - - should(node.trust.getIndirectTrust(bob, alice)).equal(1 * COIN); - should(node.trust.getIndirectTrust(bob, eve)).equal(3 * COIN); - should(node.trust.getIndirectTrust(dave, eve)).equal(12 * COIN); - should(node.trust.getIndirectTrust(george, eve)).equal(0); - }); - - it("after decreasing some trusts computes trusts correctly", async () => { - var mtxs = node.trust.createTrustDecreasingMTXs(fixtures.keyRings.alice.getPrivateKey(), - fixtures.keyRings.bob.getPublicKey(), 3 * COIN); - mtxs.length.should.equal(1); - var mtx = mtxs[0]; - - should(await mtx.verify()); - node.sendTX(mtx.toTX()); - - await testHelpers.delay(750); - should(node.trust.getIndirectTrust(addresses.alice, addresses.bob)).equal(7 * COIN); - }); - }); - - describe("with the topcoder.json example", () => { - //TODO: Write tests here. - }); -}); From 8639115d5d5adbae700313156e6f27ffd6e5d6ee Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Mon, 25 Sep 2017 17:54:39 +0100 Subject: [PATCH 096/113] Remove commented out lines --- test/full_node.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/full_node.js b/test/full_node.js index e63acfb..a3260ba 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -185,10 +185,6 @@ describe("FullNode", () => { should(await mtx.verify()); node.sendTX(mtx.toTX()); -// var aba = mtx.toTX(); -// node.sendTX(aba); -// await testHelpers.delay(1000000); -// console.log("aha"); await testHelpers.delay(750); should(node.trust.getIndirectTrust(addresses.alice, addresses.bob)).equal(7 * COIN); From f0eb7ca17ddca59f68f9229591a708050f9476eb Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:09:31 +0100 Subject: [PATCH 097/113] Define bcoin, inherit full and spv --- flow-typed/npm/bcoin_vx.x.x.js | 9 ++++----- src/trust_is_risk.js | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/flow-typed/npm/bcoin_vx.x.x.js b/flow-typed/npm/bcoin_vx.x.x.js index 3bad75a..4beb37e 100644 --- a/flow-typed/npm/bcoin_vx.x.x.js +++ b/flow-typed/npm/bcoin_vx.x.x.js @@ -3,16 +3,15 @@ type Hash = (string | Buffer); type Network = any; -declare class bcoin$FullNode { +declare class bcoin$Node { on(eventName : string, eventHandler : Function) : void; getTX(hash : Hash) : Promise; getCoin(hash : Hash, index : number) : bcoin$Coin; } -declare class bcoin$SPVNode { - on(eventName : string, eventHandler : Function) : void; - getTX(hash : Hash) : Promise; - getCoin(hash : Hash, index : number) : bcoin$Coin; +declare class bcoin$FullNode extends bcoin$Node {} + +declare class bcoin$SPVNode extends bcoin$Node { pool : bcoin$Pool; //TODO Check if changes/additions are needed } diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 70699c2..a85a399 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -14,7 +14,7 @@ var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); class TrustIsRisk { - node : (bcoin$FullNode | bcoin$SPVNode) + node : bcoin$Node db : TrustDB fakePubKeyArray : Array @@ -27,7 +27,7 @@ class TrustIsRisk { compressedFakeKeyRing : KeyRing compressedTag : Buffer - constructor(node : (bcoin$FullNode | bcoin$SPVNode)) { + constructor(node : bcoin$Node) { this.fakePubKeyArray = [0x04, // constant 0x04 prefix 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate From 013c7062cec108c987b2af0d666a738ad9071b3f Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:18:09 +0100 Subject: [PATCH 098/113] Align with other comments --- src/trust_is_risk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index a85a399..b010852 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -28,7 +28,7 @@ class TrustIsRisk { compressedTag : Buffer constructor(node : bcoin$Node) { - this.fakePubKeyArray = [0x04, // constant 0x04 prefix + this.fakePubKeyArray = [0x04, // constant 0x04 prefix 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" From 3869c2b4da7d7e82db115c3540a325ab044e9d10 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:19:22 +0100 Subject: [PATCH 099/113] Remove compressed version of tag --- src/trust_is_risk.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index b010852..68527b8 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -22,11 +22,6 @@ class TrustIsRisk { fakeKeyRing : KeyRing tag : Buffer - compressedFakePubKeyArray : Array - compressedFakePubKey : Buffer - compressedFakeKeyRing : KeyRing - compressedTag : Buffer - constructor(node : bcoin$Node) { this.fakePubKeyArray = [0x04, // constant 0x04 prefix 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, @@ -43,17 +38,6 @@ class TrustIsRisk { this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); - - this.compressedFakePubKeyArray = [0x02, // 0x02 prefix for even y values - 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // only x is given in short version - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]; - - this.compressedFakePubKey = Buffer.from(this.compressedFakePubKeyArray); - this.compressedFakeKeyRing = KeyRing.fromPublic(this.compressedFakePubKey); - this.compressedTag = Buffer.from(this.compressedFakeKeyRing.getAddress("base58")); - this.node = node; this.db = new TrustDB(); From 6fa62ab12bf96762a533dc3ab27373525f157540 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:29:34 +0100 Subject: [PATCH 100/113] Put comments in their own lines --- src/trust_is_risk.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 68527b8..ff0799c 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -23,15 +23,19 @@ class TrustIsRisk { tag : Buffer constructor(node : bcoin$Node) { - this.fakePubKeyArray = [0x04, // constant 0x04 prefix + // constant 0x04 prefix + this.fakePubKeyArray = [0x04, + // secp256k1 curve: y^2 = x^3 + 7 + // 32 bytes with the x coordinate + // containing ASCII "Trust is Risk" 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, // 32 bytes with the x coordinate - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // containing ASCII "Trust is Risk" + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - // secp256k1 curve: y^2 = x^3 + 7 + // 32 bytes with the y coordinate 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, - 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, // 32 bytes with the y coordinate + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; this.fakePubKey = Buffer.from(this.fakePubKeyArray); From d2715304556847e16b406f1b269756f3e92120ad Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:30:35 +0100 Subject: [PATCH 101/113] Replace tag with fakePubKey --- test/helpers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index 4a21a82..fe90dae 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,9 +82,9 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { - tag = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).fakePubKey; + fakePubKey = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).fakePubKey; return new bcoin.primitives.Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, tag]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, fakePubKey]), value }); }, From fc206316c6848fdb8c26ae7dd459a520b7167d06 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:33:04 +0100 Subject: [PATCH 102/113] Move to etc --- {test => etc}/tag-generator.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {test => etc}/tag-generator.py (100%) diff --git a/test/tag-generator.py b/etc/tag-generator.py similarity index 100% rename from test/tag-generator.py rename to etc/tag-generator.py From 14fdf5602e62f25bd9eccc269de7cb0d39f5cbd6 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:33:50 +0100 Subject: [PATCH 103/113] Refer to etc/tag-generator.py --- src/trust_is_risk.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index ff0799c..e5028cf 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -33,6 +33,7 @@ class TrustIsRisk { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // 32 bytes with the y coordinate + // as generated by etc/tag-generator.py 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, From ed5f986928f5405b02fb193f2cc411e91c5939bc Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 12:39:07 +0100 Subject: [PATCH 104/113] Stop using assert() --- test/trust_is_risk.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 43bb468..3c7e519 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -11,7 +11,6 @@ var secp256k1 = require("bcoin/lib/crypto/ec-secp256k1"); var sinon = require("sinon"); var should = require("should"); var fixtures = require("./fixtures"); -var assert = require("assert"); require("should-sinon"); const COIN = bcoin.consensus.COIN; @@ -70,7 +69,7 @@ describe("TrustIsRisk", () => { }); it("is a valid bitcoin address", () => { - assert(bcoin.primitives.Address.fromBase58(tir.tag.toString("ascii"))); + bcoin.primitives.Address.fromBase58(tir.tag.toString("ascii")).should.be.ok; }); }); From 9f01cf90831fa42977bfc4023ec22d57984765d9 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 13:24:33 +0100 Subject: [PATCH 105/113] Add tag stuff out of class --- src/trust_is_risk.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index e5028cf..7e404b9 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -13,6 +13,27 @@ var helpers = require("./helpers"); var TrustDB = require("./trust_db"); var DirectTrust = require("./direct_trust"); +//Handcrafted public key for "Trust is Risk" tag +//constant 0x04 prefix +const fakePubKeyArray : Array = [0x04, + // secp256k1 curve: y^2 = x^3 + 7 + // 32 bytes with the x coordinate + // containing ASCII "Trust is Risk" + 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, + 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + // 32 bytes with the y coordinate + // as generated by etc/tag-generator.py + 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, + 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, + 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, + 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; + +const fakePubKey : Buffer = Buffer.from(fakePubKeyArray); +const fakeKeyRing : KeyRing = KeyRing.fromPublic(fakePubKey); +const tag : Buffer = Buffer.from(fakeKeyRing.getAddress("base58")); + class TrustIsRisk { node : bcoin$Node db : TrustDB From 1e436e5ba7eba46db7614dd4441567cf381ce432 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 13:25:54 +0100 Subject: [PATCH 106/113] Use fakePubKey outside class --- src/trust_is_risk.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 7e404b9..6f555f4 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -128,7 +128,7 @@ class TrustIsRisk { var mtx = new MTX({ outputs: [ new Output({ - script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, this.fakePubKey]), + script: bcoin.script.fromMultisig(1, 3, [originPubKey, dest, fakePubKey]), value: trustAmount }) ] @@ -210,7 +210,7 @@ class TrustIsRisk { var remainingTrustAmount = directTrust.amount - decreaseAmount; if (remainingTrustAmount > 0) { mtx.addOutput(new Output({ - script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, this.fakePubKey]), + script: bcoin.script.fromMultisig(1, 3, [directTrust.origin, directTrust.dest, fakePubKey]), value: remainingTrustAmount })); } From a079369b96a40aea43d4e02c6feeab3f5f276a8f Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 18:59:38 +0100 Subject: [PATCH 107/113] Export fakePubKey and tag --- src/trust_is_risk.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 6f555f4..6947d93 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -326,4 +326,6 @@ class TrustIsRisk { } } -module.exports = TrustIsRisk; +module.exports.Tir = TrustIsRisk; +module.exports.fakePubKey = fakePubKey; +module.exports.tag = tag; From f41b005f58b1fceba35550330c6d69684551e55c Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 19:01:04 +0100 Subject: [PATCH 108/113] Use ".Tir" to refer to TrustIsRisk --- src/full_node.js | 4 ++-- test/full_node.js | 2 +- test/trust_is_risk.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/full_node.js b/src/full_node.js index 93e664d..b947f95 100644 --- a/src/full_node.js +++ b/src/full_node.js @@ -3,11 +3,11 @@ var bcoin = require("bcoin"); var TrustIsRisk = require("./trust_is_risk"); class FullNode extends bcoin.fullnode { - trust : TrustIsRisk + trust : TrustIsRisk.Tir constructor(options : Object) { super(options); - this.trust = new TrustIsRisk(this); + this.trust = new TrustIsRisk.Tir(this); } } diff --git a/test/full_node.js b/test/full_node.js index a3260ba..b52b56e 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -23,7 +23,7 @@ describe("FullNode", () => { var walletDB = null; var NodeWatcher = null; var watcher = null; - sinon.spy(Trust.TrustIsRisk.prototype, "addTX"); + sinon.spy(Trust.TrustIsRisk.Tir.prototype, "addTX"); beforeEach("get node", async () => { node = await testHelpers.getNode(); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 3c7e519..f8d6d3f 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -36,7 +36,7 @@ describe("TrustIsRisk", () => { var node, tir, trustIncreasingMTX, trustDecreasingMTX, trustIncreasingTX; beforeEach(() => { node = new bcoin.fullnode({}); - tir = new Trust.TrustIsRisk(node); + tir = new Trust.TrustIsRisk.Tir(node); trustIncreasingMTX = testHelpers.getTrustIncreasingMTX(addr.alice.pubKey, addr.bob.pubKey, 42 * COIN); trustIncreasingTX = trustIncreasingMTX.toTX(); From 5cfacdc774ba9b48bd2c4e12c906111f4e049652 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 19:01:43 +0100 Subject: [PATCH 109/113] Use exported fakePubKey and tag --- test/helpers.js | 2 +- test/trust_is_risk.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index fe90dae..5d9232f 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -82,7 +82,7 @@ var testHelpers = { }, getOneOfThreeMultisigOutput: (originPubKey, destPubKey, value) => { - fakePubKey = (new TrustIsRisk.TrustIsRisk(new bcoin.fullnode({}))).fakePubKey; + fakePubKey = TrustIsRisk.TrustIsRisk.fakePubKey; return new bcoin.primitives.Output({ script: bcoin.script.fromMultisig(1, 3, [originPubKey, destPubKey, fakePubKey]), value diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index f8d6d3f..8fba43b 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -64,12 +64,12 @@ describe("TrustIsRisk", () => { describe("tag", () => { it("corresponds to a valid public key", () => { - Buffer.isBuffer(tir.fakePubKey).should.equal(true); - secp256k1.publicKeyVerify(tir.fakePubKey).should.equal(true); + Buffer.isBuffer(Trust.TrustIsRisk.fakePubKey).should.equal(true); + secp256k1.publicKeyVerify(Trust.TrustIsRisk.fakePubKey).should.equal(true); }); it("is a valid bitcoin address", () => { - bcoin.primitives.Address.fromBase58(tir.tag.toString("ascii")).should.be.ok; + bcoin.primitives.Address.fromBase58(Trust.TrustIsRisk.tag.toString("ascii")).should.be.ok; }); }); @@ -215,7 +215,7 @@ describe("TrustIsRisk", () => { trustOutput.getType().should.equal("multisig"); [1, 2].map((i) => helpers.pubKeyToEntity(trustOutput.script.get(i))).sort() .should.deepEqual([alice, bob].sort()); - trustOutput.script.get(3).should.deepEqual(tir.fakePubKey); + trustOutput.script.get(3).should.deepEqual(Trust.TrustIsRisk.fakePubKey); trustOutput.value.should.equal(100 * COIN); var changeOutput = mtx.outputs[1]; From b2bc8b60452e0e3ee288df448bae6602ed754159 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Wed, 27 Sep 2017 19:02:16 +0100 Subject: [PATCH 110/113] Remove tag definitions from TrustIsRisk class --- src/trust_is_risk.js | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index 6947d93..a4af96e 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -38,32 +38,7 @@ class TrustIsRisk { node : bcoin$Node db : TrustDB - fakePubKeyArray : Array - fakePubKey : Buffer - fakeKeyRing : KeyRing - tag : Buffer - constructor(node : bcoin$Node) { - // constant 0x04 prefix - this.fakePubKeyArray = [0x04, - // secp256k1 curve: y^2 = x^3 + 7 - // 32 bytes with the x coordinate - // containing ASCII "Trust is Risk" - 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x69, 0x73, - 0x20, 0x52, 0x69, 0x73, 0x6b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - // 32 bytes with the y coordinate - // as generated by etc/tag-generator.py - 0x05, 0x5d, 0x5f, 0x28, 0x5e, 0xd7, 0x9d, 0x0c, - 0x6f, 0x61, 0xc3, 0x0e, 0xfc, 0x9d, 0x21, 0x91, - 0x65, 0x82, 0x80, 0x59, 0xa6, 0x01, 0x25, 0x0c, - 0x8e, 0xce, 0x18, 0x00, 0x14, 0xde, 0x48, 0x1a]; - - this.fakePubKey = Buffer.from(this.fakePubKeyArray); - this.fakeKeyRing = KeyRing.fromPublic(this.fakePubKey); - this.tag = Buffer.from(this.fakeKeyRing.getAddress("base58")); - this.node = node; this.db = new TrustDB(); From 67b294cbe9fd7a4a62241641b9f012ebfe8677d0 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Fri, 29 Sep 2017 15:55:13 +0100 Subject: [PATCH 111/113] Rename "Tir" to "TIR" --- src/full_node.js | 4 ++-- src/trust_is_risk.js | 2 +- test/full_node.js | 2 +- test/trust_is_risk.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/full_node.js b/src/full_node.js index b947f95..f571daa 100644 --- a/src/full_node.js +++ b/src/full_node.js @@ -3,11 +3,11 @@ var bcoin = require("bcoin"); var TrustIsRisk = require("./trust_is_risk"); class FullNode extends bcoin.fullnode { - trust : TrustIsRisk.Tir + trust : TrustIsRisk.TIR constructor(options : Object) { super(options); - this.trust = new TrustIsRisk.Tir(this); + this.trust = new TrustIsRisk.TIR(this); } } diff --git a/src/trust_is_risk.js b/src/trust_is_risk.js index a4af96e..c585a7a 100644 --- a/src/trust_is_risk.js +++ b/src/trust_is_risk.js @@ -301,6 +301,6 @@ class TrustIsRisk { } } -module.exports.Tir = TrustIsRisk; +module.exports.TIR = TrustIsRisk; module.exports.fakePubKey = fakePubKey; module.exports.tag = tag; diff --git a/test/full_node.js b/test/full_node.js index b52b56e..e6a6e87 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -23,7 +23,7 @@ describe("FullNode", () => { var walletDB = null; var NodeWatcher = null; var watcher = null; - sinon.spy(Trust.TrustIsRisk.Tir.prototype, "addTX"); + sinon.spy(Trust.TrustIsRisk.TIR.prototype, "addTX"); beforeEach("get node", async () => { node = await testHelpers.getNode(); diff --git a/test/trust_is_risk.js b/test/trust_is_risk.js index 8fba43b..a434a2c 100644 --- a/test/trust_is_risk.js +++ b/test/trust_is_risk.js @@ -36,7 +36,7 @@ describe("TrustIsRisk", () => { var node, tir, trustIncreasingMTX, trustDecreasingMTX, trustIncreasingTX; beforeEach(() => { node = new bcoin.fullnode({}); - tir = new Trust.TrustIsRisk.Tir(node); + tir = new Trust.TrustIsRisk.TIR(node); trustIncreasingMTX = testHelpers.getTrustIncreasingMTX(addr.alice.pubKey, addr.bob.pubKey, 42 * COIN); trustIncreasingTX = trustIncreasingMTX.toTX(); From 43a5e69da3285d2a06985be5572ec5ca99b8af39 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 1 Oct 2017 18:56:13 +0100 Subject: [PATCH 112/113] Remove redundant "NodeWatcher" definition --- test/full_node.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/full_node.js b/test/full_node.js index e6a6e87..4df2d2f 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -21,7 +21,6 @@ const COIN = consensus.COIN; describe("FullNode", () => { var node = null; var walletDB = null; - var NodeWatcher = null; var watcher = null; sinon.spy(Trust.TrustIsRisk.TIR.prototype, "addTX"); From 247c8b182f5bb4bed11df0d3b9136a3e27848798 Mon Sep 17 00:00:00 2001 From: Orfeas Stefanos Thyfronitis Litos Date: Sun, 1 Oct 2017 20:40:30 +0100 Subject: [PATCH 113/113] Fix comment appearance and typo --- test/full_node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/full_node.js b/test/full_node.js index 4df2d2f..90a6f1b 100644 --- a/test/full_node.js +++ b/test/full_node.js @@ -88,8 +88,8 @@ describe("FullNode", () => { sendAmount * consensus.COIN); }); - // We have to use a change output, because transaction with too large a fee are considered - // invalid. + // We have to use a change output, because transactions with too large + // a fee are considered invalid. var fee = 0.01; var changeAmount = 50 * blockCount - sendAmount * fixtures.names.length - fee; if (changeAmount >= 0.01) {