mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-05 18:43:47 +00:00
Merge branch 'master' into feat/rsk-network
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
* Add FIO - Foundation for Interwallet Operability
|
||||
* Add Argoneum
|
||||
|
||||
# 0.4.2
|
||||
|
||||
* Fix ethereum private key format
|
||||
|
||||
@@ -87,3 +87,25 @@ module.exports.unorm = require('unorm')
|
||||
/* zxcvbn */
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
4
libs/combined/package.json
Normal file → Executable file
4
libs/combined/package.json
Normal file → Executable file
@@ -11,13 +11,17 @@
|
||||
"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",
|
||||
"handshake-util": "1.2.0",
|
||||
"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",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="form-group">
|
||||
<div class="col-sm-2"></div>
|
||||
<div class="col-sm-10">
|
||||
<p>You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word is a checksum).</p>
|
||||
<p>You can enter an existing BIP39 mnemonic, or generate a new random one. Typing your own twelve words will probably not work how you expect, since the words require a particular structure (the last word contains a checksum).</p>
|
||||
<p>
|
||||
For more info see the
|
||||
<a href="https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki" target="_blank">BIP39 spec</a>.
|
||||
@@ -966,6 +966,7 @@
|
||||
<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>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1764,6 +1764,28 @@ libs.bitcoin.networks.elastos = {
|
||||
wif: 0xef // TODO set this correctly, same as BTC for now
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchain = {
|
||||
messagePrefix: '\x18Sugarchain Signed Message:\n',
|
||||
bip32: {
|
||||
public: 0x0488B21E,
|
||||
private: 0x0488ADE4,
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x7d,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchaintestnet = {
|
||||
messagePrefix: '\x18Sugarchain Signed Message:\n',
|
||||
bip32: {
|
||||
public: 0x045f1cf6,
|
||||
private: 0x045f18bc,
|
||||
},
|
||||
pubKeyHash: 0x42,
|
||||
scriptHash: 0x80,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
// https://github.com/libs.bitcoinjs-lib/blob/3f6f5ef97a1ee1b8337865209282c0095e22b2e7/src/networks.js
|
||||
libs.bitcoin.networks.regtest = {
|
||||
messagePrefix: '\x18Bitcoin Signed Message:\n',
|
||||
@@ -1776,3 +1798,14 @@ libs.bitcoin.networks.regtest = {
|
||||
scriptHash: 0xc4,
|
||||
wif: 0xef,
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.argoneum = {
|
||||
messagePrefix: 'unused',
|
||||
bip32: {
|
||||
public: 0x0488b21e,
|
||||
private: 0x0488ade4
|
||||
},
|
||||
pubKeyHash: 0x32,
|
||||
scriptHash: 0x61,
|
||||
wif: 0xbf
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1168,6 +1168,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Handshake values are different
|
||||
if (networks[DOM.network.val()].name == "HNS - Handshake") {
|
||||
var ring = libs.handshake.KeyRing.fromPublic(keyPair.getPublicKeyBuffer())
|
||||
address = ring.getAddress().toString();
|
||||
}
|
||||
|
||||
// Stellar is different
|
||||
if (networks[DOM.network.val()].name == "XLM - Stellar") {
|
||||
var purpose = parseIntNoNaN(DOM.bip44purpose.val(), 44);
|
||||
@@ -1264,6 +1270,12 @@
|
||||
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()) {
|
||||
|
||||
@@ -2064,6 +2076,13 @@
|
||||
setHdCoin(161);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "AGM - Argoneum",
|
||||
onSelect: function() {
|
||||
network = libs.bitcoin.networks.argoneum;
|
||||
setHdCoin(421);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ARYA - Aryacoin",
|
||||
onSelect: function() {
|
||||
@@ -2520,6 +2539,13 @@
|
||||
setHdCoin(40);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "FIO - Foundation for Interwallet Operability",
|
||||
onSelect: function() {
|
||||
network = libs.bitcoin.networks.bitcoin;
|
||||
setHdCoin(235);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "FIX - FIX",
|
||||
onSelect: function() {
|
||||
@@ -2604,6 +2630,12 @@
|
||||
setHdCoin(1);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "HNS - Handshake",
|
||||
onSelect: function() {
|
||||
setHdCoin(5353);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "HNC - Helleniccoin",
|
||||
onSelect: function() {
|
||||
@@ -3125,6 +3157,20 @@
|
||||
setHdCoin(105);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "SUGAR - Sugarchain",
|
||||
onSelect: function() {
|
||||
network = libs.bitcoin.networks.sugarchain;
|
||||
setHdCoin(408);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "TUGAR - Sugarchain Testnet",
|
||||
onSelect: function() {
|
||||
network = libs.bitcoin.networks.sugarchaintestnet;
|
||||
setHdCoin(408);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "SWTC - Jingtum",
|
||||
onSelect: function() {
|
||||
|
||||
@@ -683,4 +683,56 @@ libs.bitcoin.networks.deeponion.p2wpkhInP2sh = {
|
||||
wif: 0x9f
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchain.p2wpkh = {
|
||||
baseNetwork: "sugarchain",
|
||||
messagePrefix: '\x1DSugarchain Signed Message:\n',
|
||||
bech32: 'sugar',
|
||||
bip32: {
|
||||
public: 0x04b24746,
|
||||
private: 0x04b2430c
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x7d,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchain.p2wpkhInP2sh = {
|
||||
baseNetwork: "sugarchain",
|
||||
messagePrefix: '\x1DSugarchain Signed Message:\n',
|
||||
bech32: 'sugar',
|
||||
bip32: {
|
||||
public: 0x049d7cb2,
|
||||
private: 0x049d7878
|
||||
},
|
||||
pubKeyHash: 0x3f,
|
||||
scriptHash: 0x7d,
|
||||
wif: 0x80
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchaintestnet.p2wpkh = {
|
||||
baseNetwork: "sugarchaintestnet",
|
||||
messagePrefix: '\x18Sugarchain Signed Message:\n',
|
||||
bech32: 'tugar',
|
||||
bip32: {
|
||||
public: 0x045f1cf6,
|
||||
private: 0x045f18bc
|
||||
},
|
||||
pubKeyHash: 0x42,
|
||||
scriptHash: 0x80,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
libs.bitcoin.networks.sugarchaintestnet.p2wpkhInP2sh = {
|
||||
baseNetwork: "sugarchaintestnet",
|
||||
messagePrefix: '\x18Sugarchain Signed Message:\n',
|
||||
bech32: 'tugar',
|
||||
bip32: {
|
||||
public: 0x044a5262,
|
||||
private: 0x044a4e28
|
||||
},
|
||||
pubKeyHash: 0x42,
|
||||
scriptHash: 0x80,
|
||||
wif: 0xef
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -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",
|
||||
@@ -1675,6 +1684,26 @@ it('Allows selection of Stratis Test', function(done) {
|
||||
};
|
||||
testNetwork(done, params);
|
||||
});
|
||||
it('Allows selection of Sugarchain', function(done) {
|
||||
var params = {
|
||||
selectText: "SUGAR - Sugarchain",
|
||||
phrase: "abandon abandon ability",
|
||||
firstAddress: "SYnd31fYr39VgKju87Vz1sYBmEeHg5cudk",
|
||||
firstPubKey: "035bc9fa22eff2246ec07bb09c9e32f5f9fee517b4f49a8f117508f8fb41905b25",
|
||||
firstPrivKey: "L2G3axGdZv5EV8osAsBPMese74i4dTHaGvxDh7DsRF5Ky6hKkPDY",
|
||||
};
|
||||
testNetwork(done, params);
|
||||
});
|
||||
it('Allows selection of Sugarchain Testnet', function(done) {
|
||||
var params = {
|
||||
selectText: "TUGAR - Sugarchain Testnet",
|
||||
phrase: "abandon abandon ability",
|
||||
firstAddress: "TkoRzLZQyaY88dAACNVwUFMYekR7pv6CbY",
|
||||
firstPubKey: "035bc9fa22eff2246ec07bb09c9e32f5f9fee517b4f49a8f117508f8fb41905b25",
|
||||
firstPrivKey: "cSd33sGUzymVeaH8ZGzWiyNhjJ1UHuPGLy6goXgNvMjLDqioARWW",
|
||||
};
|
||||
testNetwork(done, params);
|
||||
});
|
||||
it('Allows selection of Syscoin', function(done) {
|
||||
var params = {
|
||||
selectText: "SYS - Syscoin",
|
||||
@@ -2216,6 +2245,16 @@ it('Allows selection of tRBTC - RSK Testnet', function(done) {
|
||||
};
|
||||
testNetwork(done, params);
|
||||
});
|
||||
it('Allows selection of Argoneum', function(done) {
|
||||
var params = {
|
||||
selectText: "AGM - Argoneum",
|
||||
phrase: "abandon abandon ability",
|
||||
firstAddress: "MWgLPvJkaJwH6hrXFs1MimAC4FwC1kYRhe",
|
||||
firstPubKey: "0348e5252045fee1d3b1e5bce25dbc16284d5b6c3bfff9c305d4ffa6078c16f3f8",
|
||||
firstPrivKey: "VJXpuMEFnK8USLyo5tgF7M4cBXU44U8MUor1KRTQ6t9DVno9AAgg",
|
||||
};
|
||||
testNetwork(done, params);
|
||||
});
|
||||
|
||||
// BIP39 seed is set from phrase
|
||||
it('Sets the bip39 seed from the prhase', function(done) {
|
||||
|
||||
Reference in New Issue
Block a user