]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
Adding FIO -Foundation for Interwallet Operability
authorShawn Arney <shawn@arneyconsulting.com>
Wed, 29 Apr 2020 22:48:00 +0000 (16:48 -0600)
committerIan Coleman <ian@iancoleman.io>
Sun, 10 May 2020 22:43:55 +0000 (08:43 +1000)
FIO - Foundation for Interwallet Operability.

https://fioprotocol.io

libs/combined/index.js
libs/combined/package.json [changed mode: 0644->0755]
src/index.html
src/js/fio-util.js [new file with mode: 0644]
src/js/index.js
tests/spec/tests.js

index a9b716a0a5b03b06f2a28d2c2ae55b9e72f4b9a7..43524efbc9b07470b9daf0957d699932d9b1c6e6 100644 (file)
@@ -88,4 +88,24 @@ module.exports.unorm = require('unorm')
 
 module.exports.zxcvbn = require('zxcvbn')
 
+/* handshake */
 module.exports.handshake = require('handshake-util')
+
+/* bs58 */
+try {
+    module.exports.bs58 = require('bs58')
+}
+catch (e) {
+    console.warn("Error loading bs58 library");
+    console.warn(e);
+};
+
+/* create-hash */
+try {
+    module.exports.createHash = require('create-hash')
+}
+catch (e) {
+    console.warn("Error loading create-hash library");
+    console.warn(e);
+};
+
old mode 100644 (file)
new mode 100755 (executable)
index de0badc..76d908d
@@ -11,7 +11,9 @@
     "bip38": "2.0.2",
     "bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
     "bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
+    "bs58": "^4.0.1",
     "buffer": "5.4.3",
+    "create-hash": "^1.2.0",
     "ed25519-hd-key": "^1.0.0",
     "elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
     "ethereumjs-util": "6.0.0",
@@ -19,6 +21,7 @@
     "fast-levenshtein": "2.0.6",
     "groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
     "javascript-biginteger": "0.9.2",
+    "jsrsasign": "^8.0.15",
     "kjua": "0.6.0",
     "nebulas": "0.5.6",
     "stellar-base": "^0.10.0",
index ae39c1110f4dee739c4068c468711268720098d1..4e685a5fa65095cecf1d5b945c79f3f27697643e 100644 (file)
         <script src="js/jingtum-util.js"></script>
         <script src="js/casinocoin-util.js"></script>
         <script src="js/eos-util.js"></script>
+        <script src="js/fio-util.js"></script>
         <script src="js/sjcl-bip39.js"></script>
         <script src="js/wordlist_english.js"></script>
         <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 (file)
index 0000000..35cb1ba
--- /dev/null
@@ -0,0 +1,19 @@
+function FIObufferToPublic(pubBuf) {
+  const Buffer = libs.buffer.Buffer;
+  const FIO_PUBLIC_PREFIX = "FIO";
+
+  let checksum = libs.createHash("rmd160").update(pubBuf).digest("hex").slice(0, 8);
+  pubBuf = Buffer.concat([pubBuf, Buffer.from(checksum, "hex")]);
+  return FIO_PUBLIC_PREFIX.concat(libs.bs58.encode(pubBuf));
+}
+
+function FIObufferToPrivate(privBuf) {
+  const Buffer = libs.buffer.Buffer;
+  const FIO_PRIVATE_PREFIX = "80";
+
+  privBuf = Buffer.concat([Buffer.from(FIO_PRIVATE_PREFIX, "hex"), privBuf]);
+  let tmp = libs.createHash("sha256").update(privBuf).digest();
+  let checksum = libs.createHash("sha256").update(tmp).digest("hex").slice(0, 8);
+  privBuf = Buffer.concat([privBuf, Buffer.from(checksum, "hex")]);
+  return libs.bs58.encode(privBuf);
+}
\ No newline at end of file
index 32825b2bb2ac282fdbbe699cf24bd5b80360f015..e8072e4df2780d3b7b5911ab2b73ae274d45206f 100644 (file)
                     privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32));
                 }
 
+                if (networks[DOM.network.val()].name == "FIO - Foundation for Interwallet Operability") {
+                    address = ""
+                    pubkey = FIObufferToPublic(keyPair.getPublicKeyBuffer());
+                    privkey = FIObufferToPrivate(keyPair.d.toBuffer(32));
+                }
+
                 //Groestlcoin Addresses are different
                 if(isGRS()) {
 
                 setHdCoin(40);
             },
         },
+        {
+            name: "FIO - Foundation for Interwallet Operability",
+            onSelect: function() {
+                network = libs.bitcoin.networks.bitcoin;
+                setHdCoin(235);
+            },
+        },  
         {
             name: "FIX - FIX",
             onSelect: function() {
index 15a52b30c9824ee2cd62dee62fe79e11bb741340..dc6e4b5c690ceb901d3e66572358329f977e4176 100644 (file)
@@ -1205,6 +1205,15 @@ it('Allows selection of Feathercoin', function(done) {
     };
     testNetwork(done, params);
 });
+it('Allows selection of FIO', function(done) {
+    var params = {
+        selectText: "FIO - Foundation for Interwallet Operability",
+        phrase: "valley alien library bread worry brother bundle hammer loyal barely dune brave",
+        firstPubKey: "FIO5kJKNHwctcfUM5XZyiWSqSTM5HTzznJP9F3ZdbhaQAHEVq575o",
+        firstPrivKey: "5Kbb37EAqQgZ9vWUHoPiC2uXYhyGSFNbL6oiDp24Ea1ADxV1qnu",
+    };
+    testNetwork(done, params);
+});
 it('Allows selection of Firstcoin', function(done) {
     var params = {
         selectText: "FRST - Firstcoin",