Merge pull request #6 from vivekteega/master

Update intro page
This commit is contained in:
Vivek Teega 2020-07-20 15:42:42 +05:30 committed by GitHub
commit 3a8df87ad0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,15 +100,18 @@
.svgpath { .svgpath {
stroke-dasharray: 1000; stroke-dasharray: 1000;
stroke-dashoffset: 0; stroke-dashoffset: 0;
&.svgcircle { &.svgcircle {
-webkit-animation: dash .9s ease-in-out; -webkit-animation: dash .9s ease-in-out;
animation: dash .9s ease-in-out; animation: dash .9s ease-in-out;
} }
&.svgline { &.svgline {
stroke-dashoffset: 1000; stroke-dashoffset: 1000;
-webkit-animation: dash .9s .35s ease-in-out forwards; -webkit-animation: dash .9s .35s ease-in-out forwards;
animation: dash .9s .35s ease-in-out forwards; animation: dash .9s .35s ease-in-out forwards;
} }
&.svgcheck { &.svgcheck {
stroke-dashoffset: -100; stroke-dashoffset: -100;
-webkit-animation: dash-check .9s .35s ease-in-out forwards; -webkit-animation: dash-check .9s .35s ease-in-out forwards;
@ -120,9 +123,11 @@
text-align: center; text-align: center;
margin: 20px 0 60px; margin: 20px 0 60px;
font-size: 1.25em; font-size: 1.25em;
&.svgsuccess { &.svgsuccess {
color: #73AF55; color: #73AF55;
} }
&.svgerror { &.svgerror {
color: #D06079; color: #D06079;
} }
@ -133,6 +138,7 @@
0% { 0% {
stroke-dashoffset: 1000; stroke-dashoffset: 1000;
} }
100% { 100% {
stroke-dashoffset: 0; stroke-dashoffset: 0;
} }
@ -142,6 +148,7 @@
0% { 0% {
stroke-dashoffset: 1000; stroke-dashoffset: 1000;
} }
100% { 100% {
stroke-dashoffset: 0; stroke-dashoffset: 0;
} }
@ -151,6 +158,7 @@
0% { 0% {
stroke-dashoffset: -100; stroke-dashoffset: -100;
} }
100% { 100% {
stroke-dashoffset: 900; stroke-dashoffset: 900;
} }
@ -160,12 +168,11 @@
0% { 0% {
stroke-dashoffset: -100; stroke-dashoffset: -100;
} }
100% { 100% {
stroke-dashoffset: 900; stroke-dashoffset: 900;
} }
} }
</style> </style>
</head> </head>
@ -213,13 +220,65 @@
<article id="intro"> <article id="intro">
<h2 class="major">Intro</h2> <h2 class="major">Intro</h2>
<span class="image main"><img src="images/pic04.jpg" alt="" /></span> <span class="image main"><img src="images/pic04.jpg" alt="" /></span>
<p>Apply for Internship Projects in RanchiMall</p> <p>RanchiMall invites applications for Internship for Projects listed here. All applicants will need to generate their blockchain ID, and then store the private key safely to
access our:
<ul>
<li><a href="https://ranchimall.github.io/internapply" target="_blank">Application Portal @ <em>ranchimall.github.io/internapply</em></a></li>
<li><a href="https://ranchimall.github.io/RIBC" target="_blank">Internship Portal @ <em>ranchimall.github.io/RIBC</em></a></li>
</ul>
The process of applying and Internship is:
</p>
<p>You will create FLO Blockchain ID, and its attached private key. </p> <h3>INTERN SELECTION PROCESS</h3>
<p>Your details will be linked to your FLO ID</p> <h4>EVALUATION PHASE</h4>
<ol>
<li>Inital Training on Marketing, Actual Project Skills and Blockchain</li>
<li>Applicants have to undergo a test on training</li>
<li>First Task on Marketing, Actual Project Skills and Blockchain</li>
<li>Evaluator Feedback on first task; repeat of first task if standards not met</li>
<li>Second Task on Marketing, Actual Project Skills and Blockchain</li>
<li>Evaluator and Consumer Feedback on second task; repeat of second task if standards not met</li>
<li>Third Task on Marketing, Actual Project Skills and Blockchain</li>
<li>Consumer Feedback on task: In this phase the feedback will come from general users on Social Media; if feedback is not good, repeat the third task</li>
<li>Issuance of Competency Certificates to those whose complete third task</li>
<li>Stipend phase .. to be selected among certificate holders - Four levels of stipend: Starter, Motivated, Passionate, Self Realized</li>
<li>Anyone who drops out .. can get participation certificate .. and details till what round he reached</li>
</ol>
<p>Keep the Private Key very safe. Do not share with anyone.</p> <h4>INTERNSHIP PHASE</h4>
<p>Internship phase will begin with regular work on Marketing and Project related assignments</p>
<h4>STIPEND PAYMENT BY LEVEL</h4>
<ul>
<div class="table-wrapper">
<table>
<tbody>
<tr>
<td>Starter</td>
<td>Rs 2000 per month</td>
</tr>
<tr>
<td>Motivated</td>
<td>Rs 5000 per month</td>
</tr>
<tr>
<td>Passionate</td>
<td>Rs 10000 per month</td>
</tr>
<tr>
<td>Self Realized</td>
<td>Rs 30000 per month</td>
</tr>
</tbody>
</table>
</div>
</ul>
<p><em>Keep the Private Key very safe. Do not share with anyone.</em>
<br><br>
For any more details, tweet us at <a href="https://twitter.com/ranchimallflo" target="_blank">@ranchimallflo</a> and we will respond immediately</p>
</article> </article>
<!-- Project List & information --> <!-- Project List & information -->
@ -339,9 +398,12 @@
<section id="svgsectionfailure"> <section id="svgsectionfailure">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2" class="svgsvg"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2" class="svgsvg">
<circle class="svgpath svgcircle" fill="none" stroke="#D06079" stroke-width="6" stroke-miterlimit="10" cx="65.1" cy="65.1" r="62.1"/> <circle class="svgpath svgcircle" fill="none" stroke="#D06079" stroke-width="6"
<line class="svgpath svgline" fill="none" stroke="#D06079" stroke-width="6" stroke-linecap="round" stroke-miterlimit="10" x1="34.4" y1="37.9" x2="95.8" y2="92.3"/> stroke-miterlimit="10" cx="65.1" cy="65.1" r="62.1" />
<line class="svgpath svgline" fill="none" stroke="#D06079" stroke-width="6" stroke-linecap="round" stroke-miterlimit="10" x1="95.8" y1="38" x2="34.4" y2="92.2"/> <line class="svgpath svgline" fill="none" stroke="#D06079" stroke-width="6"
stroke-linecap="round" stroke-miterlimit="10" x1="34.4" y1="37.9" x2="95.8" y2="92.3" />
<line class="svgpath svgline" fill="none" stroke="#D06079" stroke-width="6"
stroke-linecap="round" stroke-miterlimit="10" x1="95.8" y1="38" x2="34.4" y2="92.2" />
</svg> </svg>
<p class="svgerror svgp">Bummer!</p> <p class="svgerror svgp">Bummer!</p>
</section> </section>
@ -431,8 +493,7 @@
<div id="genprivkey" style="display:none"> <div id="genprivkey" style="display:none">
<section> <section>
<span id="signingoback" style="cursor: pointer;"><span> <span id="signingoback" style="cursor: pointer;"><span>
< </span> < </span> <h2 class="major" style="display:inline"> Sign In</h2>
<h2 class="major" style="display:inline"> Sign In</h2>
</span> </span>
<p></p> <p></p>
<label for="newfloid">FLO ID</label> <label for="newfloid">FLO ID</label>
@ -630,7 +691,8 @@
for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) { for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) {
if (imod4 == 0) continue; if (imod4 == 0) continue;
bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2)) | bytes.push(((base64map.indexOf(base64.charAt(i - 1)) & (Math.pow(2, -2 * imod4 + 8) -
1)) << (imod4 * 2)) |
(base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2))); (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
} }
@ -1154,7 +1216,9 @@
window.crypto.getRandomValues(ua); window.crypto.getRandomValues(ua);
for (t = 0; t < sr.poolSize; ++t) for (t = 0; t < sr.poolSize; ++t)
sr.pool[sr.pptr++] = ua[t]; sr.pool[sr.pptr++] = ua[t];
} catch (e) { alert(e); } } catch (e) {
alert(e);
}
} }
while (sr.pptr < sr.poolSize) { // extract some randomness from Math.random() while (sr.pptr < sr.poolSize) { // extract some randomness from Math.random()
t = Math.floor(65536 * Math.random()); t = Math.floor(65536 * Math.random());
@ -1177,11 +1241,13 @@
// browser plugin details: ~16.2 to ~21.8 bits // browser plugin details: ~16.2 to ~21.8 bits
var pluginsStr = ""; var pluginsStr = "";
for (var i = 0; i < navigator.plugins.length; i++) { for (var i = 0; i < navigator.plugins.length; i++) {
pluginsStr += navigator.plugins[i].name + " " + navigator.plugins[i].filename + " " + navigator.plugins[i].description + " " + navigator.plugins[i].version + ", "; pluginsStr += navigator.plugins[i].name + " " + navigator.plugins[i].filename + " " + navigator
.plugins[i].description + " " + navigator.plugins[i].version + ", ";
} }
var mimeTypesStr = ""; var mimeTypesStr = "";
for (var i = 0; i < navigator.mimeTypes.length; i++) { for (var i = 0; i < navigator.mimeTypes.length; i++) {
mimeTypesStr += navigator.mimeTypes[i].description + " " + navigator.mimeTypes[i].type + " " + navigator.mimeTypes[i].suffixes + ", "; mimeTypesStr += navigator.mimeTypes[i].description + " " + navigator.mimeTypes[i].type + " " +
navigator.mimeTypes[i].suffixes + ", ";
} }
entropyStr += pluginsStr + mimeTypesStr; entropyStr += pluginsStr + mimeTypesStr;
// cookies and storage: 1 bit // cookies and storage: 1 bit
@ -1193,7 +1259,9 @@
// location // location
entropyStr += window.location; entropyStr += window.location;
var entropyBytes = Crypto.SHA256(entropyStr, { asBytes: true }); var entropyBytes = Crypto.SHA256(entropyStr, {
asBytes: true
});
for (var i = 0; i < entropyBytes.length; i++) { for (var i = 0; i < entropyBytes.length; i++) {
sr.seedInt8(entropyBytes[i]); sr.seedInt8(entropyBytes[i]);
} }
@ -4495,7 +4563,8 @@
// x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3) // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q); var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q);
// y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3 // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply( var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u))
.multiply(
b.z).add(u.multiply(v3)).mod(this.curve.q); b.z).add(u.multiply(v3)).mod(this.curve.q);
// z3 = v^3 * z1 * z2 // z3 = v^3 * z1 * z2
var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q); var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q);
@ -4598,7 +4667,8 @@
ec.PointFp.prototype.getEncoded = function (compressed) { ec.PointFp.prototype.getEncoded = function (compressed) {
var x = this.getX().toBigInteger(); var x = this.getX().toBigInteger();
var y = this.getY().toBigInteger(); var y = this.getY().toBigInteger();
var len = 32; // integerToBytes will zero pad if integer is less than 32 bytes. 32 bytes length is required by the Bitcoin protocol. var len =
32; // integerToBytes will zero pad if integer is less than 32 bytes. 32 bytes length is required by the Bitcoin protocol.
var enc = ec.integerToBytes(x, len); var enc = ec.integerToBytes(x, len);
// when compressed prepend byte depending if y point is even or odd // when compressed prepend byte depending if y point is even or odd
@ -4610,7 +4680,8 @@
} }
} else { } else {
enc.unshift(0x04); enc.unshift(0x04);
enc = enc.concat(ec.integerToBytes(y, len)); // uncompressed public key appends the bytes of the y point enc = enc.concat(ec.integerToBytes(y,
len)); // uncompressed public key appends the bytes of the y point
} }
return enc; return enc;
}; };
@ -5074,7 +5145,8 @@
btrx.addflodata = function (txcomments) { // flochange - this whole function needs to be done btrx.addflodata = function (txcomments) { // flochange - this whole function needs to be done
this.floData = txcomments; this.floData = txcomments;
return this.floData; //flochange .. returning the txcomments -- check if the function return will assign return this
.floData; //flochange .. returning the txcomments -- check if the function return will assign
} }
@ -5379,13 +5451,15 @@
} else if (floDataCount <= 1023) { } else if (floDataCount <= 1023) {
floDataCountAdjusted = (floDataCount - 253) + parseInt("0xfd00fd"); floDataCountAdjusted = (floDataCount - 253) + parseInt("0xfd00fd");
floDataCountStringAdjusted = floDataCountAdjusted.toString(16); floDataCountStringAdjusted = floDataCountAdjusted.toString(16);
floDataCountString = floDataCountStringAdjusted.substr(0, 2) + floDataCountStringAdjusted.substr(4, 2) + floDataCountStringAdjusted.substr(2, 2); floDataCountString = floDataCountStringAdjusted.substr(0, 2) + floDataCountStringAdjusted
.substr(4, 2) + floDataCountStringAdjusted.substr(2, 2);
} else { } else {
floDataCountString = "Character Limit Exceeded"; floDataCountString = "Character Limit Exceeded";
} }
return Crypto.util.bytesToHex(buffer) + floDataCountString + flohex; // flochange -- Addition of floDataCountString and floData in serialization return Crypto.util.bytesToHex(buffer) + floDataCountString +
flohex; // flochange -- Addition of floDataCountString and floData in serialization
} }
@ -5615,7 +5689,8 @@
this.hash = bytes; this.hash = bytes;
}; };
Bitcoin.Address.networkVersion = 0x23; // (FLO mainnet 0x23, 35D), (Bitcoin Mainnet, 0x00, 0D) // *this has no effect * Bitcoin.Address.networkVersion =
0x23; // (FLO mainnet 0x23, 35D), (Bitcoin Mainnet, 0x00, 0D) // *this has no effect *
/** /**
* Serialize this object as a standard Bitcoin address. * Serialize this object as a standard Bitcoin address.
@ -5628,7 +5703,11 @@
// Version // Version
hash.unshift(this.version); hash.unshift(this.version);
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true }); var checksum = Crypto.SHA256(Crypto.SHA256(hash, {
asBytes: true
}), {
asBytes: true
});
var bytes = hash.concat(checksum.slice(0, 4)); var bytes = hash.concat(checksum.slice(0, 4));
return Bitcoin.Base58.encode(bytes); return Bitcoin.Base58.encode(bytes);
}; };
@ -5643,7 +5722,11 @@
Bitcoin.Address.decodeString = function (string, version) { Bitcoin.Address.decodeString = function (string, version) {
var bytes = Bitcoin.Base58.decode(string); var bytes = Bitcoin.Base58.decode(string);
var hash = bytes.slice(0, 21); var hash = bytes.slice(0, 21);
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true }); var checksum = Crypto.SHA256(Crypto.SHA256(hash, {
asBytes: true
}), {
asBytes: true
});
if (checksum[0] != bytes[21] || if (checksum[0] != bytes[21] ||
checksum[1] != bytes[22] || checksum[1] != bytes[22] ||
@ -5958,7 +6041,8 @@
// prevent duplicates from being added to the array // prevent duplicates from being added to the array
for (var index in this.keyArray) { for (var index in this.keyArray) {
var currentItem = this.keyArray[index]; var currentItem = this.keyArray[index];
if (currentItem != null && currentItem.priv != null && item.getBitcoinAddress() == currentItem.getBitcoinAddress()) { if (currentItem != null && currentItem.priv != null && item.getBitcoinAddress() ==
currentItem.getBitcoinAddress()) {
doAdd = false; doAdd = false;
break; break;
} }
@ -5990,7 +6074,8 @@
var item = pool[index]; var item = pool[index];
if (Bitcoin.Util.hasMethods(item, 'getBitcoinAddress', 'toString')) { if (Bitcoin.Util.hasMethods(item, 'getBitcoinAddress', 'toString')) {
if (item != null) { if (item != null) {
keyPoolString += "\"" + item.getBitcoinAddress() + "\"" + ", \"" + item.toString("wif") + "\"\n"; keyPoolString += "\"" + item.getBitcoinAddress() + "\"" + ", \"" + item
.toString("wif") + "\"\n";
} }
} }
} }
@ -6043,8 +6128,12 @@
try { try {
// This part is edited for FLO. FLO WIF are always compressed WIF. FLO WIF (private key) starts with R for mainnet and c for testnet. // This part is edited for FLO. FLO WIF are always compressed WIF. FLO WIF (private key) starts with R for mainnet and c for testnet.
if (((floGlobals.blockchain == "FLO") && /^R[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(input)) || if (((floGlobals.blockchain == "FLO") &&
((floGlobals.blockchain == "FLO_TEST") && /^c[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(input))) { /^R[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(input)
) ||
((floGlobals.blockchain == "FLO_TEST") &&
/^c[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(input))
) {
bytes = ECKey.decodeCompressedWalletImportFormat(input); bytes = ECKey.decodeCompressedWalletImportFormat(input);
this.compressed = true; this.compressed = true;
} else if (ECKey.isHexFormat(input)) { } else if (ECKey.isHexFormat(input)) {
@ -6083,12 +6172,14 @@
this.compressed = (this.compressed == undefined) ? !!ECKey.compressByDefault : this.compressed; this.compressed = (this.compressed == undefined) ? !!ECKey.compressByDefault : this.compressed;
try { try {
// check not zero // check not zero
if (this.priv != null && BigInteger.ZERO.compareTo(this.priv) == 0) this.setError("Error: BigInteger equal to zero."); if (this.priv != null && BigInteger.ZERO.compareTo(this.priv) == 0) this.setError(
"Error: BigInteger equal to zero.");
// valid range [0x1, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140]) // valid range [0x1, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140])
var hexKeyRangeLimit = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140"; var hexKeyRangeLimit = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140";
var rangeLimitBytes = Crypto.util.hexToBytes(hexKeyRangeLimit); var rangeLimitBytes = Crypto.util.hexToBytes(hexKeyRangeLimit);
var limitBigInt = BigInteger.fromByteArrayUnsigned(rangeLimitBytes); var limitBigInt = BigInteger.fromByteArrayUnsigned(rangeLimitBytes);
if (this.priv != null && limitBigInt.compareTo(this.priv) < 0) this.setError("Error: BigInteger outside of curve range.") if (this.priv != null && limitBigInt.compareTo(this.priv) < 0) this.setError(
"Error: BigInteger outside of curve range.")
if (this.priv != null) { if (this.priv != null) {
KeyPool.push(this); KeyPool.push(this);
@ -6202,7 +6293,11 @@
if (bytes == null) return ""; if (bytes == null) return "";
bytes.unshift(ECKey.privateKeyPrefix); // prepend 0x80 byte bytes.unshift(ECKey.privateKeyPrefix); // prepend 0x80 byte
if (this.compressed) bytes.push(0x01); // append 0x01 byte for compressed format if (this.compressed) bytes.push(0x01); // append 0x01 byte for compressed format
var checksum = Crypto.SHA256(Crypto.SHA256(bytes, { asBytes: true }), { asBytes: true }); var checksum = Crypto.SHA256(Crypto.SHA256(bytes, {
asBytes: true
}), {
asBytes: true
});
bytes = bytes.concat(checksum.slice(0, 4)); bytes = bytes.concat(checksum.slice(0, 4));
var privWif = Bitcoin.Base58.encode(bytes); var privWif = Bitcoin.Base58.encode(bytes);
return privWif; return privWif;
@ -6235,8 +6330,7 @@
// Wallet Import Format // Wallet Import Format
else if (format.toString().toLowerCase() == "wif") { else if (format.toString().toLowerCase() == "wif") {
return this.getBitcoinWalletImportFormat(); return this.getBitcoinWalletImportFormat();
} } else {
else {
return this.getBitcoinHexFormat(); return this.getBitcoinHexFormat();
} }
}; };
@ -6255,7 +6349,11 @@
ECKey.decodeWalletImportFormat = function (privStr) { ECKey.decodeWalletImportFormat = function (privStr) {
var bytes = Bitcoin.Base58.decode(privStr); var bytes = Bitcoin.Base58.decode(privStr);
var hash = bytes.slice(0, 33); var hash = bytes.slice(0, 33);
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true }); var checksum = Crypto.SHA256(Crypto.SHA256(hash, {
asBytes: true
}), {
asBytes: true
});
if (checksum[0] != bytes[33] || if (checksum[0] != bytes[33] ||
checksum[1] != bytes[34] || checksum[1] != bytes[34] ||
checksum[2] != bytes[35] || checksum[2] != bytes[35] ||
@ -6276,7 +6374,11 @@
ECKey.decodeCompressedWalletImportFormat = function (privStr) { ECKey.decodeCompressedWalletImportFormat = function (privStr) {
var bytes = Bitcoin.Base58.decode(privStr); var bytes = Bitcoin.Base58.decode(privStr);
var hash = bytes.slice(0, 34); var hash = bytes.slice(0, 34);
var checksum = Crypto.SHA256(Crypto.SHA256(hash, { asBytes: true }), { asBytes: true }); var checksum = Crypto.SHA256(Crypto.SHA256(hash, {
asBytes: true
}), {
asBytes: true
});
if (checksum[0] != bytes[34] || if (checksum[0] != bytes[34] ||
checksum[1] != bytes[35] || checksum[1] != bytes[35] ||
checksum[2] != bytes[36] || checksum[2] != bytes[36] ||
@ -6328,12 +6430,18 @@
// 22, 26 or 30 characters, always starts with an 'S' // 22, 26 or 30 characters, always starts with an 'S'
ECKey.isMiniFormat = function (key) { ECKey.isMiniFormat = function (key) {
key = key.toString(); key = key.toString();
var validChars22 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21}$/.test(key); var validChars22 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{21}$/.test(
var validChars26 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25}$/.test(key); key);
var validChars30 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}$/.test(key); var validChars26 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{25}$/.test(
var testBytes = Crypto.SHA256(key + "?", { asBytes: true }); key);
var validChars30 = /^S[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{29}$/.test(
key);
var testBytes = Crypto.SHA256(key + "?", {
asBytes: true
});
return ((testBytes[0] === 0x00 || testBytes[0] === 0x01) && (validChars22 || validChars26 || validChars30)); return ((testBytes[0] === 0x00 || testBytes[0] === 0x01) && (validChars22 || validChars26 ||
validChars30));
}; };
return ECKey; return ECKey;
@ -6436,15 +6544,24 @@
* array. * array.
*/ */
sha256ripe160: function (data) { sha256ripe160: function (data) {
return ripemd160(Crypto.SHA256(data, { asBytes: true }), { asBytes: true }); return ripemd160(Crypto.SHA256(data, {
asBytes: true
}), {
asBytes: true
});
}, },
// double sha256 // double sha256
dsha256: function (data) { dsha256: function (data) {
return Crypto.SHA256(Crypto.SHA256(data, { asBytes: true }), { asBytes: true }); return Crypto.SHA256(Crypto.SHA256(data, {
asBytes: true
}), {
asBytes: true
});
}, },
// duck typing method // duck typing method
hasMethods: function (obj /*, method list as strings */ ) { hasMethods: function (obj /*, method list as strings */ ) {
var i = 1, methodName; var i = 1,
methodName;
while ((methodName = arguments[i++])) { while ((methodName = arguments[i++])) {
if (typeof obj[methodName] != 'function') { if (typeof obj[methodName] != 'function') {
return false; return false;
@ -6846,7 +6963,8 @@
warn(); warn();
} }
secret = '1' + hex2bin(secret); // append a 1 so that we can preserve the correct number of leading zeros in our secret secret = '1' + hex2bin(
secret); // append a 1 so that we can preserve the correct number of leading zeros in our secret
secret = split(secret, padLength); secret = split(secret, padLength);
var x = new Array(numShares), var x = new Array(numShares),
y = new Array(numShares); y = new Array(numShares);
@ -7040,15 +7158,19 @@
if (i === j) { if (i === j) {
continue; continue;
} }
if (at === x[j]) { // happens when computing a share that is in the list of shares used to compute it if (at === x[
product = -1; // fix for a zero product term, after which the sum should be sum^0 = sum, not sum^1 j]) { // happens when computing a share that is in the list of shares used to compute it
product = -
1; // fix for a zero product term, after which the sum should be sum^0 = sum, not sum^1
break; break;
} }
product = (product + config.logs[at ^ x[j]] - config.logs[x[i] ^ x[j]] + config.max /* to make sure it's not negative */) % product = (product + config.logs[at ^ x[j]] - config.logs[x[i] ^ x[j]] + config
.max /* to make sure it's not negative */ ) %
config.max; config.max;
} }
sum = product === -1 ? sum : sum ^ config.exps[product]; // though exps[-1]= undefined and undefined ^ anything = anything in chrome, this behavior may not hold everywhere, so do the check sum = product === -1 ? sum : sum ^ config.exps[
product]; // though exps[-1]= undefined and undefined ^ anything = anything in chrome, this behavior may not hold everywhere, so do the check
} }
return sum; return sum;
}; };
@ -7119,7 +7241,8 @@
if (typeof bytesPerChar !== 'number' || bytesPerChar % 1 !== 0 || bytesPerChar < 1 || if (typeof bytesPerChar !== 'number' || bytesPerChar % 1 !== 0 || bytesPerChar < 1 ||
bytesPerChar > defaults.maxBytesPerChar) { bytesPerChar > defaults.maxBytesPerChar) {
throw new Error('Bytes per character must be an integer between 1 and ' + defaults.maxBytesPerChar + throw new Error('Bytes per character must be an integer between 1 and ' + defaults
.maxBytesPerChar +
', inclusive.') ', inclusive.')
} }
@ -7153,7 +7276,8 @@
if (typeof bytesPerChar !== 'number' || bytesPerChar % 1 !== 0 || bytesPerChar < 1 || if (typeof bytesPerChar !== 'number' || bytesPerChar % 1 !== 0 || bytesPerChar < 1 ||
bytesPerChar > defaults.maxBytesPerChar) { bytesPerChar > defaults.maxBytesPerChar) {
throw new Error('Bytes per character must be an integer between 1 and ' + defaults.maxBytesPerChar + throw new Error('Bytes per character must be an integer between 1 and ' + defaults
.maxBytesPerChar +
', inclusive.') ', inclusive.')
} }
@ -7185,7 +7309,9 @@
const isDate = d => d instanceof Date; const isDate = d => d instanceof Date;
const isEmpty = o => Object.keys(o).length === 0; const isEmpty = o => Object.keys(o).length === 0;
const isObject = o => o != null && typeof o === 'object'; const isObject = o => o != null && typeof o === 'object';
const properObject = o => isObject(o) && !o.hasOwnProperty ? { ...o } : o; const properObject = o => isObject(o) && !o.hasOwnProperty ? {
...o
} : o;
const getLargerArray = (l, r) => l.length > r.length ? l : r; const getLargerArray = (l, r) => l.length > r.length ? l : r;
@ -7205,7 +7331,9 @@
...acc, ...acc,
[key]: array.reduce((acc2, item, index) => { [key]: array.reduce((acc2, item, index) => {
if (diff[key].hasOwnProperty(index)) { if (diff[key].hasOwnProperty(index)) {
acc2[index] = preserve(diff[key][index], leftArray[index], rightArray[index]); // diff recurse and check for nested arrays acc2[index] = preserve(diff[key][index], leftArray[index],
rightArray[index]
); // diff recurse and check for nested arrays
return acc2; return acc2;
} }
@ -7244,7 +7372,10 @@
if (isObject(difference) && isEmpty(difference) && !isDate(difference)) return acc; if (isObject(difference) && isEmpty(difference) && !isDate(difference)) return acc;
return { ...acc, [key]: difference }; return {
...acc,
[key]: difference
};
} }
return acc; return acc;
@ -7261,7 +7392,10 @@
const r = properObject(rhs); const r = properObject(rhs);
const deletedValues = Object.keys(l).reduce((acc, key) => { const deletedValues = Object.keys(l).reduce((acc, key) => {
return r.hasOwnProperty(key) ? acc : { ...acc, [key]: null }; return r.hasOwnProperty(key) ? acc : {
...acc,
[key]: null
};
}, {}); }, {});
if (isDate(l) || isDate(r)) { if (isDate(l) || isDate(r)) {
@ -7270,13 +7404,20 @@
} }
return Object.keys(r).reduce((acc, key) => { return Object.keys(r).reduce((acc, key) => {
if (!l.hasOwnProperty(key)) return { ...acc, [key]: r[key] }; // return added r key if (!l.hasOwnProperty(key)) return {
...acc,
[key]: r[key]
}; // return added r key
const difference = diff(l[key], r[key]); const difference = diff(l[key], r[key]);
if (isObject(difference) && isEmpty(difference) && !isDate(difference)) return acc; // return no diff if (isObject(difference) && isEmpty(difference) && !isDate(difference))
return acc; // return no diff
return { ...acc, [key]: difference }; // return updated key return {
...acc,
[key]: difference
}; // return updated key
}, deletedValues); }, deletedValues);
}; };
@ -7293,10 +7434,16 @@
if (isObject(difference) && isEmpty(difference)) return acc; if (isObject(difference) && isEmpty(difference)) return acc;
return { ...acc, [key]: difference }; return {
...acc,
[key]: difference
};
} }
return { ...acc, [key]: r[key] }; return {
...acc,
[key]: r[key]
};
}, {}); }, {});
}; };
@ -7310,7 +7457,10 @@
const r = properObject(rhs); const r = properObject(rhs);
const deletedValues = Object.keys(l).reduce((acc, key) => { const deletedValues = Object.keys(l).reduce((acc, key) => {
return r.hasOwnProperty(key) ? acc : { ...acc, [key]: null }; return r.hasOwnProperty(key) ? acc : {
...acc,
[key]: null
};
}, {}); }, {});
if (isDate(l) || isDate(r)) { if (isDate(l) || isDate(r)) {
@ -7336,18 +7486,26 @@
return acc; // return no diff return acc; // return no diff
} }
return acc.slice(0, index).concat(rightItem).concat(acc.slice(index + 1)); // return updated key return acc.slice(0, index).concat(rightItem).concat(acc.slice(index +
1)); // return updated key
}, deletedValues); }, deletedValues);
} }
return Object.keys(r).reduce((acc, key) => { return Object.keys(r).reduce((acc, key) => {
if (!l.hasOwnProperty(key)) return { ...acc, [key]: r[key] }; // return added r key if (!l.hasOwnProperty(key)) return {
...acc,
[key]: r[key]
}; // return added r key
const difference = diff(l[key], r[key]); const difference = diff(l[key], r[key]);
if (isObject(difference) && isEmpty(difference) && !isDate(difference)) return acc; // return no diff if (isObject(difference) && isEmpty(difference) && !isDate(difference))
return acc; // return no diff
return { ...acc, [key]: difference }; // return updated key return {
...acc,
[key]: difference
}; // return updated key
}, deletedValues); }, deletedValues);
}; };
@ -7363,10 +7521,16 @@
if (isObject(difference) && isEmpty(difference)) return acc; if (isObject(difference) && isEmpty(difference)) return acc;
return { ...acc, [key]: difference }; return {
...acc,
[key]: difference
};
} }
return { ...acc, [key]: null }; return {
...acc,
[key]: null
};
}, {}); }, {});
}; };
@ -7387,8 +7551,7 @@
// obj1[p] = []; // obj1[p] = [];
if (obj2[p].length < 1) { if (obj2[p].length < 1) {
obj1[p] = obj2[p]; obj1[p] = obj2[p];
} } else {
else {
obj1[p] = mergeRecursive(obj1[p], obj2[p]); obj1[p] = mergeRecursive(obj1[p], obj2[p]);
} }
@ -7426,8 +7589,7 @@
if (!Object.keys(value).length) { if (!Object.keys(value).length) {
delete obj[key] delete obj[key]
} }
} } else if (value === null) {
else if (value === null) {
// null, remove it // null, remove it
delete obj[key]; delete obj[key];
@ -7923,7 +8085,8 @@
sendTxMultiple: function (senderPrivKeys, receivers, floData = '') { sendTxMultiple: function (senderPrivKeys, receivers, floData = '') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let senders = {}, preserveRatio; let senders = {},
preserveRatio;
//check for argument validations //check for argument validations
try { try {
let invalids = { let invalids = {
@ -7932,7 +8095,8 @@
InvalidReceiverIDs: [], InvalidReceiverIDs: [],
InvalidReceiveAmountFor: [] InvalidReceiveAmountFor: []
} }
let inputVal = 0, outputVal = 0; let inputVal = 0,
outputVal = 0;
//Validate sender privatekeys (and send amount if passed) //Validate sender privatekeys (and send amount if passed)
//conversion when only privateKeys are passed (preserveRatio mode) //conversion when only privateKeys are passed (preserveRatio mode)
if (Array.isArray(senderPrivKeys)) { if (Array.isArray(senderPrivKeys)) {
@ -7941,7 +8105,8 @@
if (!key) if (!key)
invalids.InvalidSenderPrivKeys.push(key); invalids.InvalidSenderPrivKeys.push(key);
else { else {
let floID = floCrypto.getFloIDfromPubkeyHex(floCrypto.getPubKeyHex(key)); let floID = floCrypto.getFloIDfromPubkeyHex(floCrypto
.getPubKeyHex(key));
senders[floID] = { senders[floID] = {
wif: key wif: key
} }
@ -7959,11 +8124,13 @@
if (!key) if (!key)
invalids.InvalidSenderPrivKeys.push(key); invalids.InvalidSenderPrivKeys.push(key);
else { else {
if (typeof senderPrivKeys[key] !== 'number' || senderPrivKeys[key] <= 0) if (typeof senderPrivKeys[key] !== 'number' || senderPrivKeys[key] <=
0)
invalids.InvalidSenderAmountFor.push(key) invalids.InvalidSenderAmountFor.push(key)
else else
inputVal += senderPrivKeys[key]; inputVal += senderPrivKeys[key];
let floID = floCrypto.getFloIDfromPubkeyHex(floCrypto.getPubKeyHex(key)); let floID = floCrypto.getFloIDfromPubkeyHex(floCrypto.getPubKeyHex(
key));
senders[floID] = { senders[floID] = {
wif: key, wif: key,
coins: senderPrivKeys[key] coins: senderPrivKeys[key]
@ -7992,7 +8159,8 @@
return reject(invalids); return reject(invalids);
//Reject if given inputVal and outputVal are not equal //Reject if given inputVal and outputVal are not equal
if (!preserveRatio && inputVal != outputVal) if (!preserveRatio && inputVal != outputVal)
return reject(`Input Amount (${inputVal}) not equal to Output Amount (${outputVal})`) return reject(
`Input Amount (${inputVal}) not equal to Output Amount (${outputVal})`)
} catch (error) { } catch (error) {
return reject(error) return reject(error)
} }
@ -8011,12 +8179,16 @@
let insufficient = []; let insufficient = [];
for (let floID in senders) { for (let floID in senders) {
balance[floID] = parseFloat(results.shift()); balance[floID] = parseFloat(results.shift());
if (isNaN(balance[floID]) || (preserveRatio && balance[floID] <= totalFee) || (!preserveRatio && balance[floID] < senders[floID].coins + dividedFee)) if (isNaN(balance[floID]) || (preserveRatio && balance[floID] <=
totalFee) || (!preserveRatio && balance[floID] < senders[floID]
.coins + dividedFee))
insufficient.push(floID) insufficient.push(floID)
totalBalance += balance[floID]; totalBalance += balance[floID];
} }
if (insufficient.length) if (insufficient.length)
return reject({ InsufficientBalance: insufficient }) return reject({
InsufficientBalance: insufficient
})
//Calculate totalSentAmount and check if totalBalance is sufficient //Calculate totalSentAmount and check if totalBalance is sufficient
let totalSendAmt = totalFee; let totalSendAmt = totalFee;
for (floID in receivers) for (floID in receivers)
@ -8828,8 +9000,7 @@
idb.onupgradeneeded = (event) => { idb.onupgradeneeded = (event) => {
var db = event.target.result; var db = event.target.result;
for (let obs in objectStores) { for (let obs in objectStores) {
var objectStore = db.createObjectStore(obs, objectStores[obs].options || var objectStore = db.createObjectStore(obs, objectStores[obs].options || {});
{});
if (objectStores[obs].indexes && typeof objectStores[obs].indexes === if (objectStores[obs].indexes && typeof objectStores[obs].indexes ===
'object') 'object')
for (let i in objectStores[obs].indexes) for (let i in objectStores[obs].indexes)
@ -9540,7 +9711,8 @@
let shares = floCrypto.createShamirsSecretShares(encryptedKey, threshold, threshold) let shares = floCrypto.createShamirsSecretShares(encryptedKey, threshold, threshold)
let promises = []; let promises = [];
for (var i = 0; i < threshold; i++) for (var i = 0; i < threshold; i++)
promises.push(compactIDB.writeData("credentials", shares[i], indexArr[i], floGlobals.application)); promises.push(compactIDB.writeData("credentials", shares[i], indexArr[i], floGlobals
.application));
Promise.all(promises) Promise.all(promises)
.then(results => resolve("Private Key Secured")) .then(results => resolve("Private Key Secured"))
.catch(error => reject(error)) .catch(error => reject(error))
@ -9577,7 +9749,6 @@
<script> <script>
/*async function loadRIBC() { /*async function loadRIBC() {
floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' }) floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' })
}*/ }*/
@ -9593,8 +9764,7 @@
var phoneno = /^\d{10}$/; var phoneno = /^\d{10}$/;
if ((inputtxt.value.match(phoneno))) { if ((inputtxt.value.match(phoneno))) {
return true; return true;
} } else {
else {
alert("You have entered an invalid phone number!"); alert("You have entered an invalid phone number!");
return false; return false;
} }
@ -9628,7 +9798,8 @@
setTimeout(function () { setTimeout(function () {
document.getElementById('applytabsuccessful').style.display = 'none'; document.getElementById('applytabsuccessful').style.display = 'none';
document.getElementById('applytabmain').style.display = 'initial'; document.getElementById('applytabmain').style.display = 'initial';
window.location.href = "#list"; }, 2500) window.location.href = "#list";
}, 2500)
// disable project from apply list and other list // disable project from apply list and other list
let projectlistchildren = document.getElementById('projectlist').children let projectlistchildren = document.getElementById('projectlist').children
@ -9654,14 +9825,14 @@
</tr>` + projectlisttablebody.innerHTML </tr>` + projectlisttablebody.innerHTML
} } else {
else {
document.getElementById('applytabwaiting').style.display = 'none' document.getElementById('applytabwaiting').style.display = 'none'
document.getElementById('applytabfailure').style.display = 'initial' document.getElementById('applytabfailure').style.display = 'initial'
setTimeout(function () { setTimeout(function () {
document.getElementById('applytabfailure').style.display = 'none'; document.getElementById('applytabfailure').style.display = 'none';
document.getElementById('applytabmain').style.display = 'initial' }, 2500) document.getElementById('applytabmain').style.display = 'initial'
}, 2500)
} }
}) })
} }
@ -9766,8 +9937,7 @@
if (checkeditem == null) { if (checkeditem == null) {
alert("No project selected") alert("No project selected")
} } else {
else {
let applicationform_projectlist = document.getElementById('formprojectlist').children let applicationform_projectlist = document.getElementById('formprojectlist').children
for (let i = 0; i < applicationform_projectlist.length; i++) { for (let i = 0; i < applicationform_projectlist.length; i++) {
if (applicationform_projectlist[i].value == checkeditem) { if (applicationform_projectlist[i].value == checkeditem) {
@ -9778,8 +9948,7 @@
if (myFloID_isApplicant) { if (myFloID_isApplicant) {
document.getElementById('applyactionlist_apply').click() document.getElementById('applyactionlist_apply').click()
} } else {
else {
// redirect to applypage // redirect to applypage
window.location.href = "#apply" window.location.href = "#apply"
} }
@ -9817,12 +9986,12 @@
// do either resolve to take in private key, or reject to do guest login // do either resolve to take in private key, or reject to do guest login
document.getElementById('privkey_signin_btn').addEventListener('click', (ev) => { document.getElementById('privkey_signin_btn').addEventListener('click', (ev) => {
console.log('Test message to check if on click listener is working inside the Promise') console.log(
'Test message to check if on click listener is working inside the Promise')
let priv_key_field = document.getElementById('priv_key_field') let priv_key_field = document.getElementById('priv_key_field')
if (priv_key_field.value.trim().length > 40) { if (priv_key_field.value.trim().length > 40) {
resolve(priv_key_field.value.trim()) resolve(priv_key_field.value.trim())
} } else {
else {
alert('Please enter correct private key.') alert('Please enter correct private key.')
} }
@ -9830,14 +9999,13 @@
document.getElementById('privkey_signin_btn_alt').addEventListener('click', (ev) => { document.getElementById('privkey_signin_btn_alt').addEventListener('click', (ev) => {
alert('Please store your Private Key safely') alert('Please store your Private Key safely')
document.getElementById('priv_key_field').value = document.getElementById("newprivatekey").value document.getElementById('priv_key_field').value = document.getElementById(
"newprivatekey").value
document.getElementById('privkey_signin_btn').click() document.getElementById('privkey_signin_btn').click()
}) })
}) })
} }
</script> </script>
@ -9862,7 +10030,11 @@
//App functions.... //App functions....
let ribcAppdata = floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' }) let ribcAppdata = floCloudAPI.requestObjectData('RIBC', options = {
senderIDs: false,
receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE",
application: 'RIBC'
})
let ribcGendata = floCloudAPI.requestGeneralData('test4') let ribcGendata = floCloudAPI.requestGeneralData('test4')
Promise.all([ribcAppdata, ribcGendata]).then((values) => { Promise.all([ribcAppdata, ribcGendata]).then((values) => {
@ -9870,7 +10042,8 @@
console.log(values) console.log(values)
// User list related operations // User list related operations
let applicants_InformationArray = floGlobals.generalData['{"application":"TEST_MODE","type":"test4"}'] let applicants_InformationArray = floGlobals.generalData[
'{"application":"TEST_MODE","type":"test4"}']
let applicantsIDarray = [] let applicantsIDarray = []
let projectlisttablebody = document.getElementById('projectlisttablebody') let projectlisttablebody = document.getElementById('projectlisttablebody')
for (let i = 0; i < applicants_InformationArray.length; i++) { for (let i = 0; i < applicants_InformationArray.length; i++) {
@ -9915,8 +10088,7 @@
} }
} }
} }
} } else {
else {
window.myFloID_isApplicant = false window.myFloID_isApplicant = false
} }
@ -9935,7 +10107,8 @@
let disabledtext = '' let disabledtext = ''
let radionametext = 'projectlistitem' let radionametext = 'projectlistitem'
let checkedtext = '' let checkedtext = ''
if (myFloID_isApplicant == true && myFloID_Projects.includes(projectDetails[projectDetailsKeys[i]].projectName)) { if (myFloID_isApplicant == true && myFloID_Projects.includes(projectDetails[
projectDetailsKeys[i]].projectName)) {
disabledtext = 'disabled' disabledtext = 'disabled'
radionametext = `${radionametext}${i}` radionametext = `${radionametext}${i}`
checkedtext = 'checked' checkedtext = 'checked'
@ -9950,8 +10123,10 @@
projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml
// Apply form // Apply form
applicationformHtml = `<option value="${projectDetails[projectDetailsKeys[i]].projectName}" ${disabledtext}>${projectDetails[projectDetailsKeys[i]].projectName}</option>` applicationformHtml =
formprojectlistContainer.innerHTML = formprojectlistContainer.innerHTML + applicationformHtml `<option value="${projectDetails[projectDetailsKeys[i]].projectName}" ${disabledtext}>${projectDetails[projectDetailsKeys[i]].projectName}</option>`
formprojectlistContainer.innerHTML = formprojectlistContainer.innerHTML +
applicationformHtml
} }
debugger debugger
@ -9963,7 +10138,6 @@
}).catch(error => console.error(error)) }).catch(error => console.error(error))
} }
</script> </script>
</body> </body>