Skip to content

Commit aeabc1a

Browse files
committed
data submission actually working with correct masks
1 parent 33ceafb commit aeabc1a

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

client/app/controllers/analyticsController.js

Whitespace-only changes.

client/app/controllers/clientController.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
2525
discrepancies: SEMANTIC_CELLS
2626
};
2727

28+
var MOUSE_PRECISION = 64;
29+
2830

2931
let analytics = {
3032
validation_errors: {},
@@ -40,9 +42,9 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
4042
*/
4143

4244
// define mouse_positions as 100x1000 array
43-
for (var i = 0; i < 100; i++) {
45+
for (var i = 0; i < MOUSE_PRECISION; i++) {
4446
analytics.mouse_positions.push([]);
45-
for (var k = 0; k < 1000; k++) {
47+
for (var k = 0; k < MOUSE_PRECISION; k++) {
4648
analytics.mouse_positions[i].push(0)
4749
}
4850
}
@@ -78,8 +80,8 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
7880
// to account for difference in x, y page size
7981

8082
var pos = getPos(event);
81-
var x = Math.floor(pos[0] * 100);
82-
var y = Math.floor(pos[1] * 1000);
83+
var x = Math.floor(pos[0] * MOUSE_PRECISION);
84+
var y = Math.floor(pos[1] * MOUSE_PRECISION);
8385
//each array stores # of hits at this area
8486
analytics.mouse_positions[x][y]++;
8587
}
@@ -432,14 +434,11 @@ define(['jquery', 'controllers/tableController', 'helper/mpc', 'alertify', 'aler
432434

433435
beforeunload(); // updates time analytic
434436
analytics.time_ms = Math.floor(analytics.time_ms / 1000);
435-
console.log("analytics", analytics);
436437

437438
var analytic_shares = mpc.secretShareValues(analytics);
438439
var analytic_data = analytic_shares['data'];
439440
var analytic_mask = analytic_shares['mask'];
440441

441-
console.log('analytic data', analytic_data);
442-
console.log('analytic masks', analytic_mask);
443442
// Correlation using modified small pairwise 'hypercubes'. (one cube for each pair of questions)
444443
// For every pair of questions, compute and encrypt the two chosen answers.
445444
var pairwise_hypercubes = {};

client/app/controllers/unmaskController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define(['helper/mpc', 'controllers/tableController', 'filesaver'], function (mpc
1717
console.log('analytics mask',aMOut);
1818

1919
mOut = JSON.parse(mOut.data);
20-
console.log(mOut);
20+
// console.log(mOut);
2121
// Questions Public is the public answers to questions.
2222
var questions_public = [];
2323
for (var i = 0; i < mOut.length; i++) {

client/app/helper/mpc.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ define(['forge'], function (forge) {
8686
for (var key in obj) {
8787
if (obj.hasOwnProperty(key)) {
8888
var value = obj[key];
89-
if (typeof(value) === 'number') {
90-
console.log("secretsharevalue:",value);
89+
if (typeof(value) === 'number' && !(isNaN(value))) {
9190
var shares = _secretShare(value, 2);
9291

9392
dataTuples[key] = shares[0];

client/unmask.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h2 class="text-center">Unmask Aggregate Data</h2>
133133
<form>
134134
<div class="form-group">
135135
<label class="control-label" for="session">Session Key</label>
136-
<input type="text" id="session" value="3wcd7hgekettex9qmk55h6t798" class="form-control" placeholder="Session Key" pattern="^[a-zA-Z0-9]{26}$" autocomplete="off" required/>
136+
<input type="text" id="session" value="a1nyre0b5t924c7ng94pye75k4" class="form-control" placeholder="Session Key" pattern="^[a-zA-Z0-9]{26}$" autocomplete="off" required/>
137137
<span id="session-success" class="success-icon glyphicon glyphicon-ok form-control-feedback hidden"
138138
aria-hidden="true"></span>
139139
<span id="session-fail" class="fail-icon glyphicon glyphicon-remove form-control-feedback hidden"
@@ -145,7 +145,7 @@ <h2 class="text-center">Unmask Aggregate Data</h2>
145145
</div>
146146
<div class="form-group">
147147
<label class="control-label" for="session-password">Session Password</label>
148-
<input type="text" value="2ywayksw257g56xrdrza1yszrw" id="session-password" class="form-control" placeholder="Session Password"
148+
<input type="text" value="tpb27h476v2tf49sm1z8y0fz58" id="session-password" class="form-control" placeholder="Session Password"
149149
pattern="^[a-zA-Z0-9]{26}$"
150150
autocomplete="off" required>
151151
<span id="session-password-success" class="success-icon glyphicon glyphicon-ok form-control-feedback hidden" aria-hidden="true"></span>

server/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ app.post('/', function (req, res) {
303303
user = body.user,
304304
ID = session + user, // will use concat of user + session for now
305305
analytics = body.analytic_data,
306-
analyticsMask = body.analytics_mask;
306+
analyticsMask = body.analytic_mask;
307+
308+
console.log('BODY!!!', analyticsMask);
307309

308310
// Ensure user key exists.
309311
UserKey.findOne({_id: ID}, function (err, data) {

0 commit comments

Comments
 (0)