aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/combined/index.js20
-rwxr-xr-x[-rw-r--r--]libs/combined/package.json3
-rw-r--r--src/index.html1
-rw-r--r--src/js/fio-util.js19
-rw-r--r--src/js/index.js13
-rw-r--r--tests/spec/tests.js9
6 files changed, 65 insertions, 0 deletions
diff --git a/libs/combined/index.js b/libs/combined/index.js
index a9b716a..43524ef 100644
--- a/libs/combined/index.js
+++ b/libs/combined/index.js
@@ -88,4 +88,24 @@ module.exports.unorm = require('unorm')
88 88
89module.exports.zxcvbn = require('zxcvbn') 89module.exports.zxcvbn = require('zxcvbn')
90 90
91/* handshake */
91module.exports.handshake = require('handshake-util') 92module.exports.handshake = require('handshake-util')
93
94/* bs58 */
95try {
96 module.exports.bs58 = require('bs58')
97}
98catch (e) {
99 console.warn("Error loading bs58 library");
100 console.warn(e);
101};
102
103/* create-hash */
104try {
105 module.exports.createHash = require('create-hash')
106}
107catch (e) {
108 console.warn("Error loading create-hash library");
109 console.warn(e);
110};
111
diff --git a/libs/combined/package.json b/libs/combined/package.json
index de0badc..76d908d 100644..100755
--- a/libs/combined/package.json
+++ b/libs/combined/package.json
@@ -11,7 +11,9 @@
11 "bip38": "2.0.2", 11 "bip38": "2.0.2",
12 "bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151", 12 "bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
13 "bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit", 13 "bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
14 "bs58": "^4.0.1",
14 "buffer": "5.4.3", 15 "buffer": "5.4.3",
16 "create-hash": "^1.2.0",
15 "ed25519-hd-key": "^1.0.0", 17 "ed25519-hd-key": "^1.0.0",
16 "elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06", 18 "elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
17 "ethereumjs-util": "6.0.0", 19 "ethereumjs-util": "6.0.0",
@@ -19,6 +21,7 @@
19 "fast-levenshtein": "2.0.6", 21 "fast-levenshtein": "2.0.6",
20 "groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2", 22 "groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
21 "javascript-biginteger": "0.9.2", 23 "javascript-biginteger": "0.9.2",
24 "jsrsasign": "^8.0.15",
22 "kjua": "0.6.0", 25 "kjua": "0.6.0",
23 "nebulas": "0.5.6", 26 "nebulas": "0.5.6",
24 "stellar-base": "^0.10.0", 27 "stellar-base": "^0.10.0",
diff --git a/src/index.html b/src/index.html
index ae39c11..4e685a5 100644
--- a/src/index.html
+++ b/src/index.html
@@ -966,6 +966,7 @@
966 <script src="js/jingtum-util.js"></script> 966 <script src="js/jingtum-util.js"></script>
967 <script src="js/casinocoin-util.js"></script> 967 <script src="js/casinocoin-util.js"></script>
968 <script src="js/eos-util.js"></script> 968 <script src="js/eos-util.js"></script>
969 <script src="js/fio-util.js"></script>
969 <script src="js/sjcl-bip39.js"></script> 970 <script src="js/sjcl-bip39.js"></script>
970 <script src="js/wordlist_english.js"></script> 971 <script src="js/wordlist_english.js"></script>
971 <script src="js/wordlist_japanese.js"></script> 972 <script src="js/wordlist_japanese.js"></script>
diff --git a/src/js/fio-util.js b/src/js/fio-util.js
new file mode 100644
index 0000000..35cb1ba
--- /dev/null
+++ b/src/js/fio-util.js
@@ -0,0 +1,19 @@
1function FIObufferToPublic(pubBuf) {
2 const Buffer = libs.buffer.Buffer;
3 const FIO_PUBLIC_PREFIX = "FIO";
4
5 let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8);
6 pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]);
7 return FIO_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf));
8}
9
10function FIObufferToPrivate(privBuf) {
11 const Buffer = libs.buffer.Buffer;
12 const FIO_PRIVATE_PREFIX = "80";
13
14 privBuf = Buffer.concat([Buffer.from(FIO_PRIVATE_PREFIX, "hex"), privBuf]);
15 let tmp = libs.createHash("sha256").update(privBuf).digest();
16 let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8);
17 privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]);
18 return libs.bs58.encode(privBuf);
19} \ No newline at end of file
diff --git a/src/js/index.js b/src/js/index.js
index 32825b2..e8072e4 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -1241,6 +1241,12 @@
1241 privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32)); 1241 privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32));
1242 } 1242 }
1243 1243
1244 if (networks[DOM.network.val()].name == "FIO - Foundation for Interwallet Operability") {
1245 address = ""
1246 pubkey = FIObufferToPublic(keyPair.getPublicKeyBuffer());
1247 privkey = FIObufferToPrivate(keyPair.d.toBuffer(32));
1248 }
1249
1244 //Groestlcoin Addresses are different 1250 //Groestlcoin Addresses are different
1245 if(isGRS()) { 1251 if(isGRS()) {
1246 1252
@@ -2499,6 +2505,13 @@
2499 }, 2505 },
2500 }, 2506 },
2501 { 2507 {
2508 name: "FIO - Foundation for Interwallet Operability",
2509 onSelect: function() {
2510 network = libs.bitcoin.networks.bitcoin;
2511 setHdCoin(235);
2512 },
2513 },
2514 {
2502 name: "FIX - FIX", 2515 name: "FIX - FIX",
2503 onSelect: function() { 2516 onSelect: function() {
2504 network = libs.bitcoin.networks.fix; 2517 network = libs.bitcoin.networks.fix;
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index 15a52b3..dc6e4b5 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -1205,6 +1205,15 @@ it('Allows selection of Feathercoin', function(done) {
1205 }; 1205 };
1206 testNetwork(done, params); 1206 testNetwork(done, params);
1207}); 1207});
1208it('Allows selection of FIO', function(done) {
1209 var params = {
1210 selectText: "FIO - Foundation for Interwallet Operability",
1211 phrase: "valley alien library bread worry brother bundle hammer loyal barely dune brave",
1212 firstPubKey: "FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o",
1213 firstPrivKey: "5Kbb37EAqQgZ9vWUHoPiC2uXYhyGSFNbL6oiDp24Ea1ADxV1qnu",
1214 };
1215 testNetwork(done, params);
1216});
1208it('Allows selection of Firstcoin', function(done) { 1217it('Allows selection of Firstcoin', function(done) {
1209 var params = { 1218 var params = {
1210 selectText: "FRST - Firstcoin", 1219 selectText: "FRST - Firstcoin",