diff options
author | Shawn Arney <shawn@arneyconsulting.com> | 2020-04-29 16:48:00 -0600 |
---|---|---|
committer | Ian Coleman <ian@iancoleman.io> | 2020-05-11 08:43:55 +1000 |
commit | d1d8699fc4f1599de39e643acc1d8be52114dd58 (patch) | |
tree | 45cf5b16dfae38f37380ea20ddeb88d0990ab68b /src/js | |
parent | e284827677b7f9fa591e86c74f7310bd00308654 (diff) | |
download | BIP39-d1d8699fc4f1599de39e643acc1d8be52114dd58.tar.gz BIP39-d1d8699fc4f1599de39e643acc1d8be52114dd58.tar.zst BIP39-d1d8699fc4f1599de39e643acc1d8be52114dd58.zip |
Adding FIO -Foundation for Interwallet Operability
FIO - Foundation for Interwallet Operability.
https://fioprotocol.io
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/fio-util.js | 19 | ||||
-rw-r--r-- | src/js/index.js | 13 |
2 files changed, 32 insertions, 0 deletions
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 @@ | |||
1 | function 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 | |||
10 | function 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; |