@@ -2418,10 +2460,18 @@ background-color: transparent;
},
withdrawComplaint(userData, cashierData, udc) {
let card = document.createElement('div'),
- { withdrawnAmount, customMsg, sender, vectorClock } = userData,
+ {
+ withdrawnAmount,
+ customMsg,
+ sender,
+ vectorClock
+ } = userData,
composition = ``;
card.classList.add('request', 'complaint')
- setAttributes(card, { 'data-type': 'withdraw', 'data-udc': JSON.stringify(udc) })
+ setAttributes(card, {
+ 'data-type': 'withdraw',
+ 'data-udc': JSON.stringify(udc)
+ })
composition = `
`
if (cashierData.processed) {
- let { time, floTxId } = cashierData
+ let {
+ time,
+ floTxId
+ } = cashierData
composition += `
Cashier processed the request on ${formatedTime(time)}
@@ -2477,10 +2530,19 @@ background-color: transparent;
},
payCashierComplaint(userData, cashierData, udc) {
let card = document.createElement('div'),
- { amount, customMsg, sender, receiver, vectorClock } = userData,
+ {
+ amount,
+ customMsg,
+ sender,
+ receiver,
+ vectorClock
+ } = userData,
composition = ``;
card.classList.add('request', 'complaint')
- setAttributes(card, { 'data-type': 'withdraw', 'data-udc': JSON.stringify(udc) })
+ setAttributes(card, {
+ 'data-type': 'withdraw',
+ 'data-udc': JSON.stringify(udc)
+ })
composition = `
Sender
@@ -2511,7 +2573,10 @@ background-color: transparent;
`
if (cashierData.processed) {
- let { time, floTxId } = cashierData
+ let {
+ time,
+ floTxId
+ } = cashierData
composition += `
Cashier processed the request on ${formatedTime(time)}
@@ -2569,11 +2634,12 @@ background-color: transparent;
//Checks for internet connection status
if (!navigator.onLine)
- notify('There seems to be a problem connecting to the internet.', 'error', true, true)
+ notify('There seems to be a problem connecting to the internet.', 'error', '', true)
window.addEventListener('offline', () => {
notify('There seems to be a problem connecting to the internet.', 'error', true, true)
})
window.addEventListener('online', () => {
+ notifications.clearAll()
notify('We are back online.', '', '', true)
})
// function required for popups or modals to appear
@@ -2597,10 +2663,14 @@ background-color: transparent;
zIndex = 10;
function showPopup(popup, permission) {
+ document.body.setAttribute('style', `overflow: hidden; top: -${window.scrollY}px`)
let thisPopup = document.getElementById(popup);
thisPopup.parentNode.classList.remove('hide');
thisPopup.classList.add('no-transformations');
- popupStack.push({ popup, permission })
+ popupStack.push({
+ popup,
+ permission
+ })
zIndex++;
thisPopup.parentNode.setAttribute('style', `z-index: ${zIndex}`)
document.getElementById('main_page')
@@ -2621,9 +2691,17 @@ background-color: transparent;
// hides the popup or modal
function hidePopup() {
+ const scrollY = document.body.style.top;
+ window.scrollTo(0, parseInt(scrollY || '0') * -1);
+ setTimeout(() => {
+ document.body.setAttribute('style', `overflow: auto; top: initial`)
+ }, 300);
if (popupStack.peek() === undefined)
return;
- let { popup, permission } = popupStack.pop();
+ let {
+ popup,
+ permission
+ } = popupStack.pop();
thisPopup = document.getElementById(popup);
thisPopup.closest('.popup-container').classList.add('hide');
thisPopup.closest('.popup').classList.remove('no-transformations');
@@ -2648,11 +2726,21 @@ background-color: transparent;
}
if (popup === 'cash_transfer') {
payingRequested = false;
+ tokenReceiver.disabled = false
+ tokenAmount.disabled = false
+ }
+ if (popup === 'deposit_rupee') {
+ depositRequested = 0;
+ document.getElementById('upi_txId_section').classList.add('hide-completely')
+ document.getElementById('deposit_amount_section').classList.remove('hide-completely')
+ depositedRupeeTxId.disabled = true
+ document.getElementById('request_tokens_btn').children[0].textContent = 'Continue'
}
}
addEventListener('mousedown', e => {
- if (e.target.classList.contains('popup-container') && popupStack.peek() !== undefined && popupStack.peek().permission !== 'no') {
+ if (e.target.classList.contains('popup-container') && popupStack.peek() !== undefined && popupStack
+ .peek().permission !== 'no') {
hidePopup()
}
})
@@ -2693,13 +2781,13 @@ background-color: transparent;
let notifications = document.getElementById('show_message');
//Function for displaying toast notifications. pass in error for mode param if you want to show an error.
- function notify(message, mode, behavior, sound) {
+ function notify(message, mode, pinned, sound) {
if (mode === 'error')
console.error(message)
else
console.log(message)
- notifications.push(message, mode, behavior)
+ notifications.push(message, mode, pinned)
if (navigator.onLine && sound) {
notificationSound.currentTime = 0;
notificationSound.play();
@@ -2756,10 +2844,11 @@ background-color: transparent;
month = timeFrag[1],
date = timeFrag[2],
year = timeFrag[3],
- hours = timeFrag[4].slice(0, timeFrag[4].lastIndexOf(':')),
- finalTime = '';
- parseInt(hours.split(':')[0]) > 12 ? finalTime = 'PM' : finalTime = 'AM'
- return `${hours} ${finalTime} ${day} ${date} ${month} ${year}`;
+ minutes = new Date(parseInt(time)).getMinutes(),
+ hours = new Date(parseInt(time)).getHours()
+ minutes = minutes.length === 1 ? `0${minutes}` : minutes
+ let finalHours = hours - 12 > 0 ? `${hours - 12}:${minutes} pm` : `${hours}:${minutes} am`
+ return `${finalHours} ${month} ${date} ${year}`;
} catch (e) {
console.error(e);
return time;
@@ -2784,7 +2873,7 @@ background-color: transparent;
}
function areInputsEmpty(parent) {
- let allInputs = parent.querySelectorAll(".input input");
+ let allInputs = parent.querySelectorAll(".input input:not(:disabled)");
return [...allInputs].every(input => input.checkValidity())
}
@@ -2817,6 +2906,8 @@ background-color: transparent;
let allForms = document.querySelectorAll('form'),
payingRequested = false,
currentPaymentRequest;
+ const tokenReceiver = document.getElementById('token_receiver'),
+ tokenAmount = document.getElementById('token_amount')
window.addEventListener('load', () => {
allForms.forEach((form) => {
form.addEventListener('input', (e) => {
@@ -2829,7 +2920,8 @@ background-color: transparent;
form.addEventListener('keyup', (e) => {
if (e.target.closest('.input')) {
if (e.key === 'Enter') {
- e.target.closest('.popup').querySelector("button[type='submit']").click();
+ e.target.closest('.popup').querySelector("button[type='submit']")
+ .click();
}
}
})
@@ -2849,7 +2941,8 @@ background-color: transparent;
if (e.target.closest('.confirm-deposit-btn'))
if (await confirmation('Confirm this deposit request?')) {
let depositRequest = e.target.closest('.request'),
- status = await transfer_token(depositRequest.dataset.userFloId, depositRequest.dataset.txid)
+ status = await transfer_token(depositRequest.dataset.userFloId,
+ depositRequest.dataset.txid)
if (status) {
refresh_balance()
depositRequest.remove()
@@ -2862,7 +2955,8 @@ background-color: transparent;
if (e.target.closest('.confirm-withdraw-btn'))
if (await confirmation('Confirm this withdraw request?')) {
let withdrawRequest = e.target.closest('.request'),
- status = await cash_sent(withdrawRequest.dataset.txid, withdrawRequest.dataset.userFloId, withdrawRequest.dataset.upi)
+ status = await cash_sent(withdrawRequest.dataset.txid, withdrawRequest
+ .dataset.userFloId, withdrawRequest.dataset.upi)
if (status) {
refresh_balance()
withdrawRequest.remove()
@@ -2874,7 +2968,9 @@ background-color: transparent;
if (e.target.closest('.confirm-pay-btn'))
if (await confirmation('Confirm this pay request?')) {
let payRequest = e.target.closest('.request'),
- status = await pay_as_cashier(payRequest.dataset.sender, payRequest.dataset.receiverFloId, payRequest.dataset.txid, payRequest.dataset.amount)
+ status = await pay_as_cashier(payRequest.dataset.sender, payRequest
+ .dataset.receiverFloId, payRequest.dataset.txid, payRequest.dataset
+ .amount)
if (status) {
refresh_balance()
payRequest.remove()
@@ -2891,17 +2987,21 @@ background-color: transparent;
// Function for reporting complain
document.getElementById('report_btn').addEventListener('click', async (e) => {
let customMsg = document.getElementById('complaint_field').value
- if (await confirmation('It may take upto 12hrs to complete your request, are you sure to report this issue?')) {
- file_complaint(currentRequest.dataset.type, currentRequest.dataset.vectorClock, customMsg)
+ if (await confirmation(
+ 'It may take upto 12hrs to complete your request, are you sure to report this issue?'
+ )) {
+ file_complaint(currentRequest.dataset.type, currentRequest.dataset.vectorClock,
+ customMsg)
}
})
// Function for requesting rupee
document.getElementById('request_rupee_btn').addEventListener('click', (e) => {
let requestedAddress = document.getElementById('requested_address').value,
requestedAmount = document.getElementById('requested_amount').value
-
+ btnLoading('request_rupee_btn', 'start')
request_payment(requestedAddress, requestedAmount)
})
+
// Function for accepting payment request
document.getElementById('payment_request_container').addEventListener('click', async (e) => {
if (e.target.closest('.send-rupee')) {
@@ -2915,20 +3015,24 @@ background-color: transparent;
paymentRequest: parent,
requestId: paymentRequestId
}
- popup.querySelector('#token_receiver').value = senderAddress;
- popup.querySelector('#token_amount').value = amount;
+ tokenReceiver.value = senderAddress;
+ tokenAmount.value = amount;
+ tokenReceiver.disabled = true
+ tokenAmount.disabled = true
}
if (e.target.closest('.decline-request')) {
let parent = e.target.closest('.request'),
paymentRequestId = parent.dataset.paymentRequestId;
- if (await confirmation(`Do want to decline this request? This will remove the request.`)) {
+ if (await confirmation(
+ `Do want to decline this request? This will remove the request.`)) {
payment_request_status(paymentRequestId, 'DECLINED')
e.target.closest('.request').remove()
}
}
})
document.getElementById('select_cashier').addEventListener('change', async function (e) {
- await Promise.all([load_deposit_complaints(this.value), load_withdraw_complaints(this.value), load_pay_thru_cashier_complaints(this.value)])
+ await Promise.all([load_deposit_complaints(this.value), load_withdraw_complaints(
+ this.value), load_pay_thru_cashier_complaints(this.value)])
})
document.getElementById('helpline_page').addEventListener('click', async e => {
@@ -2986,7 +3090,8 @@ background-color: transparent;
compactIDB.deleteDB().then((message) => {
delete token_app.master_configurations;
onLoadStartUp()
- notify('You have logged out successfully.')
+ notifications.clearAll()
+ notify('Logged out')
}).catch((error) => {
console.log(error)
})
@@ -3143,7 +3248,8 @@ background-color: transparent;
for (var bytes = [], i = 0, imod4 = 0; i < base64.length; imod4 = ++i % 4) {
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)));
}
@@ -3215,7 +3321,7 @@ background-color: transparent;
var digestbytes = util.wordsToBytes(SHA1._sha1(message));
return options && options.asBytes ? digestbytes :
options && options.asString ? Binary.bytesToString(digestbytes) :
- util.bytesToHex(digestbytes);
+ util.bytesToHex(digestbytes);
};
// The core
@@ -3256,9 +3362,9 @@ background-color: transparent;
var t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (
j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :
- j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :
- j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :
- (H1 ^ H2 ^ H3) - 899497514);
+ j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :
+ j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :
+ (H1 ^ H2 ^ H3) - 899497514);
H4 = H3;
H3 = H2;
@@ -3332,7 +3438,7 @@ background-color: transparent;
return options && options.asBytes ? hmacbytes :
options && options.asString ? Binary.bytesToString(hmacbytes) :
- util.bytesToHex(hmacbytes);
+ util.bytesToHex(hmacbytes);
};
@@ -3405,8 +3511,8 @@ background-color: transparent;
for (var b = b.replace(/[^A-Z0-9+\/]/ig, ""), a = [], c = 0, e = 0; c < b.length; e = ++c %
4) e != 0 && a.push(("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
.indexOf(b.charAt(c - 1)) & Math.pow(2, -2 * e + 8) - 1) << e * 2 |
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(b.charAt(
- c)) >>> 6 - e * 2);
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(b.charAt(
+ c)) >>> 6 - e * 2);
return a
}
},
@@ -3473,7 +3579,7 @@ background-color: transparent;
for (h = 0; h < 64; h++) {
h < 16 ? d[h] = e[h + t] : (l = d[h - 15], j = d[h - 2], d[h] = ((l << 25 | l >>> 7) ^
(l << 14 | l >>> 18) ^ l >>> 3) + (d[h - 7] >>> 0) + ((j << 15 | j >>> 17) ^
- (j << 13 | j >>> 19) ^ j >>> 10) + (d[h - 16] >>> 0));
+ (j << 13 | j >>> 19) ^ j >>> 10) + (d[h - 16] >>> 0));
j = f & g ^ f & m ^ g & m;
var u = (f << 30 | f >>> 2) ^ (f << 19 | f >>> 13) ^ (f << 10 | f >>> 22);
l = (s >>> 0) + ((i << 26 | i >>> 6) ^ (i << 21 | i >>> 11) ^ (i << 7 | i >>> 25)) +
@@ -3539,7 +3645,7 @@ background-color: transparent;
(function () {
// Constructor function of Global SecureRandom object
- var sr = window.SecureRandom = function () {};
+ var sr = window.SecureRandom = function () { };
// Properties
sr.state;
@@ -3667,9 +3773,11 @@ background-color: transparent;
window.crypto.getRandomValues(ua);
for (t = 0; t < sr.poolSize; ++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());
sr.pool[sr.pptr++] = t >>> 8;
sr.pool[sr.pptr++] = t & 255;
@@ -3690,11 +3798,13 @@ background-color: transparent;
// browser plugin details: ~16.2 to ~21.8 bits
var pluginsStr = "";
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 = "";
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;
// cookies and storage: 1 bit
@@ -3706,7 +3816,9 @@ background-color: transparent;
// 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++) {
sr.seedInt8(entropyBytes[i]);
}
@@ -3922,16 +4034,16 @@ background-color: transparent;
// Follows 'jsbn' on Github: https://github.com/jasondavies/jsbn
// Review and Testing: https://github.com/cryptocoinjs/bigi/
/*!
- * Basic JavaScript BN library - subset useful for RSA encryption. v1.4
- *
- * Copyright (c) 2005 Tom Wu
- * All Rights Reserved.
- * BSD License
- * http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
- *
- * Copyright Stephan Thomas
- * Copyright pointbiz
- */
+ * Basic JavaScript BN library - subset useful for RSA encryption. v1.4
+ *
+ * Copyright (c) 2005 Tom Wu
+ * All Rights Reserved.
+ * BSD License
+ * http://www-cs-students.stanford.edu/~tjw/jsbn/LICENSE
+ *
+ * Copyright Stephan Thomas
+ * Copyright pointbiz
+ */
(function () {
@@ -5217,11 +5329,11 @@ background-color: transparent;
BigInteger.valueOf = nbv;
/**
- * Returns a byte array representation of the big integer.
- *
- * This returns the absolute of the contained value in big endian
- * form. A value of zero results in an empty array.
- */
+ * Returns a byte array representation of the big integer.
+ *
+ * This returns the absolute of the contained value in big endian
+ * form. A value of zero results in an empty array.
+ */
BigInteger.prototype.toByteArrayUnsigned = function () {
var ba = this.abs().toByteArray();
if (ba.length) {
@@ -5238,11 +5350,11 @@ background-color: transparent;
};
/**
- * Turns a byte array into a big integer.
- *
- * This function will interpret a byte array as a big integer in big
- * endian notation and ignore leading zeros.
- */
+ * Turns a byte array into a big integer.
+ *
+ * This function will interpret a byte array as a big integer in big
+ * endian notation and ignore leading zeros.
+ */
BigInteger.fromByteArrayUnsigned = function (ba) {
if (!ba.length) {
return ba.valueOf(0);
@@ -5256,29 +5368,29 @@ background-color: transparent;
};
/**
- * Converts big integer to signed byte representation.
- *
- * The format for this value uses a the most significant bit as a sign
- * bit. If the most significant bit is already occupied by the
- * absolute value, an extra byte is prepended and the sign bit is set
- * there.
- *
- * Examples:
- *
- * 0 => 0x00
- * 1 => 0x01
- * -1 => 0x81
- * 127 => 0x7f
- * -127 => 0xff
- * 128 => 0x0080
- * -128 => 0x8080
- * 255 => 0x00ff
- * -255 => 0x80ff
- * 16300 => 0x3fac
- * -16300 => 0xbfac
- * 62300 => 0x00f35c
- * -62300 => 0x80f35c
- */
+ * Converts big integer to signed byte representation.
+ *
+ * The format for this value uses a the most significant bit as a sign
+ * bit. If the most significant bit is already occupied by the
+ * absolute value, an extra byte is prepended and the sign bit is set
+ * there.
+ *
+ * Examples:
+ *
+ * 0 => 0x00
+ * 1 => 0x01
+ * -1 => 0x81
+ * 127 => 0x7f
+ * -127 => 0xff
+ * 128 => 0x0080
+ * -128 => 0x8080
+ * 255 => 0x00ff
+ * -255 => 0x80ff
+ * 16300 => 0x3fac
+ * -16300 => 0xbfac
+ * 62300 => 0x00f35c
+ * -62300 => 0x80f35c
+ */
BigInteger.prototype.toByteArraySigned = function () {
var val = this.abs().toByteArrayUnsigned();
var neg = this.compareTo(BigInteger.ZERO) < 0;
@@ -5299,10 +5411,10 @@ background-color: transparent;
};
/**
- * Parse a signed big integer byte representation.
- *
- * For details on the format please see BigInteger.toByteArraySigned.
- */
+ * Parse a signed big integer byte representation.
+ *
+ * For details on the format please see BigInteger.toByteArraySigned.
+ */
BigInteger.fromByteArraySigned = function (ba) {
// Check for negative value
if (ba[0] & 0x80) {
@@ -5379,7 +5491,8 @@ background-color: transparent;
for (var i = 0; i < this.m.t; ++i) {
// faster way of calculating u0 = x[i]*mp mod DV
var j = x[i] & 0x7fff;
- var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM;
+ var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x
+ .DM;
// use am to combine the multiply-shift-add into one call
j = i + this.m.t;
x[j] += this.m.am(0, u0, x, i, 0, this.m.t);
@@ -5564,7 +5677,8 @@ background-color: transparent;
// p mod 4 == 3
if (this.q.testBit(1)) {
// z = g^(u+1) + p, p = 4u + 3
- var z = new ec.FieldElementFp(this.q, this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),
+ var z = new ec.FieldElementFp(this.q, this.x.modPow(this.q.shiftRight(2).add(BigInteger
+ .ONE),
this.q));
return z.square().equals(this) ? z : null;
}
@@ -5606,9 +5720,9 @@ background-color: transparent;
return null;
};
/*!
- * Crypto-JS 2.5.4 BlockModes.js
- * contribution from Simon Greatrix
- */
+ * Crypto-JS 2.5.4 BlockModes.js
+ * contribution from Simon Greatrix
+ */
(function (C) {
@@ -5692,7 +5806,8 @@ background-color: transparent;
var b = message.pop();
if (b == 0x80) return;
if (b != 0x00) {
- throw new Error("ISO-7816 padding byte must be 0, not 0x" + b.toString(16) +
+ throw new Error("ISO-7816 padding byte must be 0, not 0x" + b.toString(
+ 16) +
". Wrong cipher specification or key used?");
}
}
@@ -5760,8 +5875,8 @@ background-color: transparent;
var C_mode = C.mode = {};
/**
- * Mode base "class".
- */
+ * Mode base "class".
+ */
var Mode = C_mode.Mode = function (padding) {
if (padding) {
this._padding = padding;
@@ -5785,12 +5900,12 @@ background-color: transparent;
/**
- * Electronic Code Book mode.
- *
- * ECB applies the cipher directly against each block of the input.
- *
- * ECB does not require an initialization vector.
- */
+ * Electronic Code Book mode.
+ *
+ * ECB applies the cipher directly against each block of the input.
+ *
+ * ECB does not require an initialization vector.
+ */
var ECB = C_mode.ECB = function () {
// Call parent constructor
Mode.apply(this, arguments);
@@ -5822,11 +5937,11 @@ background-color: transparent;
/**
- * Cipher block chaining
- *
- * The first block is XORed with the IV. Subsequent blocks are XOR with the
- * previous cipher output.
- */
+ * Cipher block chaining
+ *
+ * The first block is XORed with the IV. Subsequent blocks are XOR with the
+ * previous cipher output.
+ */
var CBC = C_mode.CBC = function () {
// Call parent constructor
Mode.apply(this, arguments);
@@ -5876,14 +5991,14 @@ background-color: transparent;
/**
- * Cipher feed back
- *
- * The cipher output is XORed with the plain text to produce the cipher output,
- * which is then fed back into the cipher to produce a bit pattern to XOR the
- * next block with.
- *
- * This is a stream cipher mode and does not require padding.
- */
+ * Cipher feed back
+ *
+ * The cipher output is XORed with the plain text to produce the cipher output,
+ * which is then fed back into the cipher to produce a bit pattern to XOR the
+ * next block with.
+ *
+ * This is a stream cipher mode and does not require padding.
+ */
var CFB = C_mode.CFB = function () {
// Call parent constructor
Mode.apply(this, arguments);
@@ -5928,13 +6043,13 @@ background-color: transparent;
/**
- * Output feed back
- *
- * The cipher repeatedly encrypts its own output. The output is XORed with the
- * plain text to produce the cipher text.
- *
- * This is a stream cipher mode and does not require padding.
- */
+ * Output feed back
+ *
+ * The cipher repeatedly encrypts its own output. The output is XORed with the
+ * plain text to produce the cipher text.
+ *
+ * This is a stream cipher mode and does not require padding.
+ */
var OFB = C_mode.OFB = function () {
// Call parent constructor
Mode.apply(this, arguments);
@@ -6070,7 +6185,7 @@ background-color: transparent;
return options && options.asBytes ? derivedKeyBytes :
options && options.asString ? Binary.bytesToString(derivedKeyBytes) :
- util.bytesToHex(derivedKeyBytes);
+ util.bytesToHex(derivedKeyBytes);
};
@@ -6538,11 +6653,11 @@ background-color: transparent;
// Inner state
var state = [
- [],
- [],
- [],
- []
- ],
+ [],
+ [],
+ [],
+ []
+ ],
keylength,
nrounds,
keyschedule;
@@ -6568,8 +6683,8 @@ background-color: transparent;
// Convert to bytes if message is a string
m = (
message.constructor == String ?
- UTF8.stringToBytes(message) :
- message
+ UTF8.stringToBytes(message) :
+ message
),
// Generate random IV
@@ -6578,12 +6693,12 @@ background-color: transparent;
// Generate key
k = (
password.constructor == String ?
- // Derive key from pass-phrase
- C.PBKDF2(password, iv, 32, {
- asBytes: true
- }) :
- // else, assume byte array representing cryptographic key
- password
+ // Derive key from pass-phrase
+ C.PBKDF2(password, iv, 32, {
+ asBytes: true
+ }) :
+ // else, assume byte array representing cryptographic key
+ password
);
// Encrypt
@@ -6611,8 +6726,8 @@ background-color: transparent;
// Convert to bytes if ciphertext is a string
c = (
ciphertext.constructor == String ?
- util.base64ToBytes(ciphertext) :
- ciphertext
+ util.base64ToBytes(ciphertext) :
+ ciphertext
),
// Separate IV and message
@@ -6621,12 +6736,12 @@ background-color: transparent;
// Generate key
k = (
password.constructor == String ?
- // Derive key from pass-phrase
- C.PBKDF2(password, iv, 32, {
- asBytes: true
- }) :
- // else, assume byte array representing cryptographic key
- password
+ // Derive key from pass-phrase
+ C.PBKDF2(password, iv, 32, {
+ asBytes: true
+ }) :
+ // else, assume byte array representing cryptographic key
+ password
);
// Decrypt
@@ -7117,7 +7232,7 @@ background-color: transparent;
var x = this.getX().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.
+ 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);
// when compressed prepend byte depending if y point is even or odd
@@ -7130,7 +7245,7 @@ background-color: transparent;
} else {
enc.unshift(0x04);
enc = enc.concat(ec.integerToBytes(y,
- len)); // uncompressed public key appends the bytes of the y point
+ len)); // uncompressed public key appends the bytes of the y point
}
return enc;
};
@@ -7234,7 +7349,7 @@ background-color: transparent;
ec.PointFp.prototype.toString = function () {
return '(' + this.getX().toBigInteger().toString() + ',' + this.getY().toBigInteger()
- .toString() +
+ .toString() +
')';
};
@@ -7451,7 +7566,7 @@ background-color: transparent;
//bitTrx.js
(function () {
- var bitjs = window.bitjs = function () {};
+ var bitjs = window.bitjs = function () { };
/* public vars */
bitjs.pub = 0x23; // flochange - changed the prefix to FLO Mainnet PublicKey Prefix 0x23
@@ -7596,7 +7711,7 @@ background-color: transparent;
btrx.addflodata = function (txcomments) { // flochange - this whole function needs to be done
this.floData = txcomments;
return this
- .floData; //flochange .. returning the txcomments -- check if the function return will assign
+ .floData; //flochange .. returning the txcomments -- check if the function return will assign
}
@@ -7910,7 +8025,7 @@ background-color: transparent;
return Crypto.util.bytesToHex(buffer) + floDataCountString +
- flohex; // flochange -- Addition of floDataCountString and floData in serialization
+ flohex; // flochange -- Addition of floDataCountString and floData in serialization
}
@@ -8141,7 +8256,7 @@ background-color: transparent;
};
Bitcoin.Address.networkVersion =
- 0x23; // (FLO mainnet 0x23, 35D), (Bitcoin Mainnet, 0x00, 0D) // *this has no effect *
+ 0x23; // (FLO mainnet 0x23, 35D), (Bitcoin Mainnet, 0x00, 0D) // *this has no effect *
/**
* Serialize this object as a standard Bitcoin address.
@@ -8474,7 +8589,7 @@ background-color: transparent;
if (pubkey.getBitcoinAddress().toString() == address) {
return i;
}
- } catch (e) {}
+ } catch (e) { }
}
throw "Unable to find valid recovery factor";
}
@@ -8493,7 +8608,7 @@ background-color: transparent;
for (var index in this.keyArray) {
var currentItem = this.keyArray[index];
if (currentItem != null && currentItem.priv != null && item
- .getBitcoinAddress() == currentItem.getBitcoinAddress()) {
+ .getBitcoinAddress() == currentItem.getBitcoinAddress()) {
doAdd = false;
break;
}
@@ -8580,8 +8695,8 @@ background-color: transparent;
// 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)) ||
+ /^R[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(
+ input)) ||
((floGlobals.blockchain == "FLO_TEST") &&
/^c[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{51}$/.test(
input))) {
@@ -8761,7 +8876,7 @@ background-color: transparent;
// Private Key Hex Format
ECKey.prototype.getBitcoinHexFormat = function () {
return Crypto.util.bytesToHex(this.getBitcoinPrivateKeyByteArray()).toString()
- .toUpperCase();
+ .toUpperCase();
};
// Private Key Base64 Format
@@ -9017,7 +9132,7 @@ background-color: transparent;
});
},
// duck typing method
- hasMethods: function (obj /*, method list as strings */ ) {
+ hasMethods: function (obj /*, method list as strings */) {
var i = 1,
methodName;
while ((methodName = arguments[i++])) {
@@ -9033,7 +9148,7 @@ background-color: transparent;
(function (ellipticCurveType) {
//Defining Elliptic Encryption Object
- var ellipticEncryption = window.ellipticCurveEncryption = function () {};
+ var ellipticEncryption = window.ellipticCurveEncryption = function () { };
ellipticEncryption.rng = new SecureRandom();
@@ -9208,7 +9323,7 @@ background-color: transparent;
function init(bits) {
if (bits && (typeof bits !== 'number' || bits % 1 !== 0 || bits < defaults.minBits || bits >
- defaults.maxBits)) {
+ defaults.maxBits)) {
throw new Error('Number of bits must be an integer between ' + defaults.minBits + ' and ' +
defaults.maxBits + ', inclusive.')
}
@@ -9272,7 +9387,7 @@ background-color: transparent;
// node.js crypto.randomBytes()
if (typeof require === 'function' && (crypto = require('crypto')) && (randomBits = crypto[
- 'randomBytes'])) {
+ 'randomBytes'])) {
return function (bits) {
var bytes = Math.ceil(bits / 8),
str = null;
@@ -9286,7 +9401,7 @@ background-color: transparent;
// browsers with window.crypto.getRandomValues()
if (global['crypto'] && typeof global['crypto']['getRandomValues'] === 'function' && typeof global[
- 'Uint32Array'] === 'function') {
+ 'Uint32Array'] === 'function') {
crypto = global['crypto'];
return function (bits) {
var elems = Math.ceil(bits / 32),
@@ -9343,8 +9458,8 @@ background-color: transparent;
// test the RNG (5 times)
if (typeof rng !== 'function' || typeof rng(config.bits) !== 'string' || !parseInt(rng(config
- .bits),
- 2) || rng(config.bits).length > config.bits || rng(config.bits).length < config.bits) {
+ .bits),
+ 2) || rng(config.bits).length > config.bits || rng(config.bits).length < config.bits) {
throw new Error(
"Random number generator is invalid. Supply an RNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's."
)
@@ -9426,7 +9541,7 @@ background-color: transparent;
}
secret = '1' + hex2bin(
- secret); // append a 1 so that we can preserve the correct number of leading zeros in our secret
+ secret); // append a 1 so that we can preserve the correct number of leading zeros in our secret
secret = split(secret, padLength);
var x = new Array(numShares),
y = new Array(numShares);
@@ -9503,7 +9618,7 @@ background-color: transparent;
var bits = parseInt(share[0], 36);
if (bits && (typeof bits !== 'number' || bits % 1 !== 0 || bits < defaults.minBits || bits >
- defaults.maxBits)) {
+ defaults.maxBits)) {
throw new Error('Number of bits must be an integer between ' + defaults.minBits + ' and ' +
defaults.maxBits + ', inclusive.')
}
@@ -9623,16 +9738,16 @@ background-color: transparent;
if (at === x[
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
+ 1; // fix for a zero product term, after which the sum should be sum^0 = sum, not sum^1
break;
}
product = (product + config.logs[at ^ x[j]] - config.logs[x[i] ^ x[j]] + config
- .max /* to make sure it's not negative */ ) %
+ .max /* to make sure it's not negative */) %
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
+ product]; // though exps[-1]= undefined and undefined ^ anything = anything in chrome, this behavior may not hold everywhere, so do the check
}
return sum;
};
@@ -9795,7 +9910,7 @@ background-color: transparent;
if (diff[key].hasOwnProperty(index)) {
acc2[index] = preserve(diff[key][index], leftArray[index],
rightArray[index]
- ); // diff recurse and check for nested arrays
+ ); // diff recurse and check for nested arrays
return acc2;
}
@@ -9833,7 +9948,7 @@ background-color: transparent;
const difference = updatedDiff(l[key], r[key]);
if (isObject(difference) && isEmpty(difference) && !isDate(difference))
- return acc;
+ return acc;
return {
...acc,
@@ -9875,7 +9990,7 @@ background-color: transparent;
const difference = diff(l[key], r[key]);
if (isObject(difference) && isEmpty(difference) && !isDate(difference))
- return acc; // return no diff
+ return acc; // return no diff
return {
...acc,
@@ -9950,7 +10065,7 @@ background-color: transparent;
}
return acc.slice(0, index).concat(rightItem).concat(acc.slice(index +
- 1)); // return updated key
+ 1)); // return updated key
}, deletedValues);
}
@@ -9963,7 +10078,7 @@ background-color: transparent;
const difference = diff(l[key], r[key]);
if (isObject(difference) && isEmpty(difference) && !isDate(difference))
- return acc; // return no diff
+ return acc; // return no diff
return {
...acc,
@@ -10138,7 +10253,7 @@ background-color: transparent;
deriveSharedKeySender: function (receiverCompressedPublicKey, senderPrivateKey) {
try {
let receiverPublicKeyString = this.getUncompressedPublicKey(
- receiverCompressedPublicKey);
+ receiverCompressedPublicKey);
var senderDerivedKey = ellipticCurveEncryption.senderSharedKeyDerivation(
receiverPublicKeyString.x, receiverPublicKeyString.y, senderPrivateKey);
return senderDerivedKey;
@@ -10209,7 +10324,7 @@ background-color: transparent;
var senderECKeyData = this.util.getSenderPublicKeyString();
var senderDerivedKey = this.util.deriveSharedKeySender(receiverCompressedPublicKey,
senderECKeyData
- .privateKey);
+ .privateKey);
let senderKey = senderDerivedKey.XValue + senderDerivedKey.YValue;
let secret = Crypto.AES.encrypt(data, senderKey);
return {
@@ -10230,7 +10345,7 @@ background-color: transparent;
var receiverDerivedKey = this.util.deriveReceiverSharedKey(data.senderPublicKeyString,
receiverECKeyData
- .privateKey);
+ .privateKey);
let receiverKey = receiverDerivedKey.XValue + receiverDerivedKey.YValue;
let decryptMsg = Crypto.AES.decrypt(data.secret, receiverKey);
@@ -10591,7 +10706,7 @@ background-color: transparent;
invalids.InvalidSenderPrivKeys.push(key);
else {
if (typeof senderPrivKeys[key] !== 'number' || senderPrivKeys[
- key] <= 0)
+ key] <= 0)
invalids.InvalidSenderAmountFor.push(key)
else
inputVal += senderPrivKeys[key];
@@ -10627,7 +10742,7 @@ background-color: transparent;
if (!preserveRatio && inputVal != outputVal)
return reject(
`Input Amount (${inputVal}) not equal to Output Amount (${outputVal})`
- )
+ )
} catch (error) {
return reject(error)
}
@@ -10647,7 +10762,7 @@ background-color: transparent;
for (let floID in senders) {
balance[floID] = parseFloat(results.shift());
if (isNaN(balance[floID]) || (preserveRatio && balance[floID] <=
- totalFee) || (!preserveRatio && balance[floID] < senders[
+ totalFee) || (!preserveRatio && balance[floID] < senders[
floID].coins + dividedFee))
insufficient.push(floID)
totalBalance += balance[floID];
@@ -10684,7 +10799,7 @@ background-color: transparent;
if (utxos[i].confirmations) {
trx.addinput(utxos[i].txid, utxos[i].vout,
utxos[i]
- .scriptPubKey)
+ .scriptPubKey)
wifSeq.push(wif);
utxoAmt += utxos[i].amount;
}
@@ -10748,7 +10863,7 @@ background-color: transparent;
return new Promise((resolve, reject) => {
this.promisedAPI(`api/addrs/${addr}/txs?from=0&to=1`).then(response => {
this.promisedAPI(
- `api/addrs/${addr}/txs?from=0&to=${response.totalItems}0`)
+ `api/addrs/${addr}/txs?from=0&to=${response.totalItems}0`)
.then(response => resolve(response.items))
.catch(error => reject(error));
}).catch(error => reject(error))
@@ -10785,14 +10900,14 @@ background-color: transparent;
if (options.pattern && !response.items[i].floData
.startsWith(options.pattern, 0) && !response.items[
i]
- .floData.startsWith(options.pattern, 2))
+ .floData.startsWith(options.pattern, 2))
continue;
if (options.contains && !response.items[i].floData
.includes(
options.contains))
continue;
if (options.filter && !options.filter(response.items[i]
- .floData))
+ .floData))
continue;
filteredData.push(response.items[i].floData);
}
@@ -10801,8 +10916,8 @@ background-color: transparent;
data: filteredData
});
}).catch(error => {
- reject(error);
- });
+ reject(error);
+ });
}).catch(error => {
reject(error);
});
@@ -11474,7 +11589,7 @@ background-color: transparent;
var db = event.target.result;
for (let obs in objectStores) {
var objectStore = db.createObjectStore(obs, objectStores[obs].options ||
- {});
+ {});
if (objectStores[obs].indexes && typeof objectStores[obs].indexes ===
'object')
for (let i in objectStores[obs].indexes)
@@ -11655,7 +11770,7 @@ background-color: transparent;
floGlobals.vectorClock[message.object] = vc
compactIDB.writeData("appObjects", floGlobals.appObjects[message.object],
message
- .object)
+ .object)
compactIDB.writeData("vectorClock", vc, message.object)
}
}
@@ -11675,7 +11790,7 @@ background-color: transparent;
message.object], message.diff)
compactIDB.writeData("appObjects", floGlobals.appObjects[message.object],
message
- .object)
+ .object)
}
floGlobals.vectorClock[message.object] = vc
compactIDB.writeData("vectorClock", vc, message.object)
@@ -11765,7 +11880,7 @@ background-color: transparent;
})
options.type = type
options.lowerVectorClock = options.lowerVectorClock || floGlobals.generalVC[
- filterStr] +
+ filterStr] +
1
this.requestApplicationData(options).then(dataSet => {
this.util.storeGeneralData(filterStr, dataSet)
@@ -11831,7 +11946,7 @@ background-color: transparent;
vectorClock: floGlobals.vectorClock[objectName],
diff: findDifference(JSON.parse(this.util.lastCommit[objectName]),
floGlobals
- .appObjects[objectName])
+ .appObjects[objectName])
}
this.sendApplicationData(message, `${objectName}@Update`, options).then(result => {
this.util.lastCommit[objectName] = JSON.stringify(floGlobals.appObjects[
@@ -11906,16 +12021,16 @@ background-color: transparent;
compactIDB.writeData("lastTx", result.totalTxs,
floGlobals.SNStorageID);
compactIDB.readAllData("supernodes").then(
- result => {
- floGlobals.supernodes = result;
+ result => {
+ floGlobals.supernodes = result;
- floSupernode.kBucket.launch(Object.keys(
- floGlobals.supernodes),
+ floSupernode.kBucket.launch(Object.keys(
+ floGlobals.supernodes),
floGlobals.SNStorageID)
- .then(result => resolve(
- "Loaded Supernode list\n" +
- result))
- })
+ .then(result => resolve(
+ "Loaded Supernode list\n" +
+ result))
+ })
})
}).catch(error => reject(error))
})
@@ -11932,13 +12047,13 @@ background-color: transparent;
for (var i = result.data.length - 1; i >= 0; i--) {
var content = JSON.parse(result.data[i])[
floGlobals
- .application];
+ .application];
if (Array.isArray(content.removeSubAdmin))
for (var j = 0; j < content.removeSubAdmin
.length; j++)
compactIDB.removeData("subAdmins",
content
- .removeSubAdmin[j]);
+ .removeSubAdmin[j]);
if (Array.isArray(content.addSubAdmin))
for (var k = 0; k < content.addSubAdmin
.length; k++)
@@ -12049,25 +12164,25 @@ background-color: transparent;
writeSharesToIDB(floCrypto
.createShamirsSecretShares(
privKey, threshold, threshold)).then(
- resultIndexes => {
- //store index keys in localStorage
- localStorage.setItem(
- `${floGlobals.application}#privKey`,
- JSON.stringify(resultIndexes))
- //also add a dummy privatekey to the IDB
- var randomPrivKey = floCrypto
- .generateNewID().privKey
- var randomThreshold = floCrypto.randInt(
- 10,
- 20)
- writeSharesToIDB(floCrypto
- .createShamirsSecretShares(
- randomPrivKey,
- randomThreshold,
- randomThreshold))
- //resolve private Key
- resolve(privKey)
- }).catch(error => reject(error))
+ resultIndexes => {
+ //store index keys in localStorage
+ localStorage.setItem(
+ `${floGlobals.application}#privKey`,
+ JSON.stringify(resultIndexes))
+ //also add a dummy privatekey to the IDB
+ var randomPrivKey = floCrypto
+ .generateNewID().privKey
+ var randomThreshold = floCrypto.randInt(
+ 10,
+ 20)
+ writeSharesToIDB(floCrypto
+ .createShamirsSecretShares(
+ randomPrivKey,
+ randomThreshold,
+ randomThreshold))
+ //resolve private Key
+ resolve(privKey)
+ }).catch(error => reject(error))
})
}
})
@@ -12184,8 +12299,8 @@ background-color: transparent;
reject('Access Denied for Admin privilege')
else
floBlockchainAPI.writeData(floID, JSON.stringify(floData), adminPrivKey)
- .then(result => resolve(['Updated SubAdmin List', result]))
- .catch(error => reject(error))
+ .then(result => resolve(['Updated SubAdmin List', result]))
+ .catch(error => reject(error))
})
},
@@ -12251,7 +12366,7 @@ background-color: transparent;
-
+ }
+