mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-05 18:43:47 +00:00
Adding FIO -Foundation for Interwallet Operability
FIO - Foundation for Interwallet Operability. https://fioprotocol.io
This commit is contained in:
@@ -88,4 +88,24 @@ module.exports.unorm = require('unorm')
|
|||||||
|
|
||||||
module.exports.zxcvbn = require('zxcvbn')
|
module.exports.zxcvbn = require('zxcvbn')
|
||||||
|
|
||||||
|
/* handshake */
|
||||||
module.exports.handshake = require('handshake-util')
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
3
libs/combined/package.json
Normal file → Executable file
3
libs/combined/package.json
Normal file → Executable file
@@ -11,7 +11,9 @@
|
|||||||
"bip38": "2.0.2",
|
"bip38": "2.0.2",
|
||||||
"bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
|
"bip38grs": "git://github.com/Groestlcoin/bip38grs.git#091975b01679b74dc0a4136bb743fe17791b0151",
|
||||||
"bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
|
"bitcoinjs-lib": "git://github.com/iancoleman/bitcoinjs-lib.git#v3.3.2_16bit",
|
||||||
|
"bs58": "^4.0.1",
|
||||||
"buffer": "5.4.3",
|
"buffer": "5.4.3",
|
||||||
|
"create-hash": "^1.2.0",
|
||||||
"ed25519-hd-key": "^1.0.0",
|
"ed25519-hd-key": "^1.0.0",
|
||||||
"elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
|
"elastos-wallet-js": "git://github.com/johnnynanjiang/Elastos.SDK.Keypair.Javascript.git#491dc51b64efaf0a8aae62028b68e2c8e38fde06",
|
||||||
"ethereumjs-util": "6.0.0",
|
"ethereumjs-util": "6.0.0",
|
||||||
@@ -19,6 +21,7 @@
|
|||||||
"fast-levenshtein": "2.0.6",
|
"fast-levenshtein": "2.0.6",
|
||||||
"groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
|
"groestlcoinjs-lib": "git://github.com/Groestlcoin/groestlcoinjs-lib.git#3.3.2",
|
||||||
"javascript-biginteger": "0.9.2",
|
"javascript-biginteger": "0.9.2",
|
||||||
|
"jsrsasign": "^8.0.15",
|
||||||
"kjua": "0.6.0",
|
"kjua": "0.6.0",
|
||||||
"nebulas": "0.5.6",
|
"nebulas": "0.5.6",
|
||||||
"stellar-base": "^0.10.0",
|
"stellar-base": "^0.10.0",
|
||||||
|
|||||||
@@ -966,6 +966,7 @@
|
|||||||
<script src="js/jingtum-util.js"></script>
|
<script src="js/jingtum-util.js"></script>
|
||||||
<script src="js/casinocoin-util.js"></script>
|
<script src="js/casinocoin-util.js"></script>
|
||||||
<script src="js/eos-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/sjcl-bip39.js"></script>
|
||||||
<script src="js/wordlist_english.js"></script>
|
<script src="js/wordlist_english.js"></script>
|
||||||
<script src="js/wordlist_japanese.js"></script>
|
<script src="js/wordlist_japanese.js"></script>
|
||||||
|
|||||||
19
src/js/fio-util.js
Normal file
19
src/js/fio-util.js
Normal file
@@ -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);
|
||||||
|
}
|
||||||
@@ -1241,6 +1241,12 @@
|
|||||||
privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32));
|
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
|
//Groestlcoin Addresses are different
|
||||||
if(isGRS()) {
|
if(isGRS()) {
|
||||||
|
|
||||||
@@ -2498,6 +2504,13 @@
|
|||||||
setHdCoin(40);
|
setHdCoin(40);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "FIO - Foundation for Interwallet Operability",
|
||||||
|
onSelect: function() {
|
||||||
|
network = libs.bitcoin.networks.bitcoin;
|
||||||
|
setHdCoin(235);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "FIX - FIX",
|
name: "FIX - FIX",
|
||||||
onSelect: function() {
|
onSelect: function() {
|
||||||
|
|||||||
@@ -1205,6 +1205,15 @@ it('Allows selection of Feathercoin', function(done) {
|
|||||||
};
|
};
|
||||||
testNetwork(done, params);
|
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) {
|
it('Allows selection of Firstcoin', function(done) {
|
||||||
var params = {
|
var params = {
|
||||||
selectText: "FRST - Firstcoin",
|
selectText: "FRST - Firstcoin",
|
||||||
|
|||||||
Reference in New Issue
Block a user