mirror of
https://github.com/arnaucube/blockchainIDsystem.git
synced 2026-02-07 11:06:41 +01:00
updated to the same stage than darkID project, but with own blockchain
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var urlapi = "http://127.0.0.1:3130/";
|
||||
|
||||
var clientapi = "http://127.0.0.1:4100/";
|
||||
|
||||
// Declare app level module which depends on views, and components
|
||||
@@ -10,15 +10,18 @@ angular.module('app', [
|
||||
'angularBootstrapMaterial',
|
||||
'ui.bootstrap',
|
||||
'toastr',
|
||||
'chart.js',
|
||||
'app.navbar',
|
||||
'app.main',
|
||||
'app.signup',
|
||||
'app.login'
|
||||
'app.login',
|
||||
'app.id',
|
||||
'app.stats'
|
||||
]).
|
||||
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
||||
$locationProvider.hashPrefix('!');
|
||||
|
||||
if ((localStorage.getItem('blid_token'))) {
|
||||
if ((localStorage.getItem('old_darkID_token'))) {
|
||||
console.log(window.location.hash);
|
||||
if ((window.location.hash === '#!/login') || (window.location.hash === '#!/signup')) {
|
||||
window.location = '#!/main';
|
||||
@@ -31,8 +34,8 @@ config(['$locationProvider', '$routeProvider', function($locationProvider, $rout
|
||||
if ((window.location !== '#!/login') || (window.location !== '#!/signup')) {
|
||||
console.log('app, user no logged');
|
||||
|
||||
localStorage.removeItem('blid_token');
|
||||
localStorage.removeItem('blid_userdata');
|
||||
localStorage.removeItem('old_darkID_token');
|
||||
localStorage.removeItem('old_darkID_userdata');
|
||||
window.location = '#!/login';
|
||||
$routeProvider.otherwise({
|
||||
redirectTo: '/login'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "angular-seed",
|
||||
"description": "A starter project for AngularJS",
|
||||
"name": "darkID-clientApp",
|
||||
"description": "",
|
||||
"version": "0.0.0",
|
||||
"homepage": "",
|
||||
"license": "MIT",
|
||||
@@ -13,6 +13,7 @@
|
||||
"angular-bootstrap": "^2.5.0",
|
||||
"components-font-awesome": "^4.7.0",
|
||||
"angular-toastr": "^2.1.1",
|
||||
"cssMaterialColors": "*"
|
||||
"cssMaterialColors": "*",
|
||||
"angular-chart.js": "^1.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,32 @@
|
||||
@font-face {
|
||||
font-family: Elianto;
|
||||
src: url('../fonts/Elianto/Elianto.otf');
|
||||
}
|
||||
|
||||
body {
|
||||
/*background: #15191e!important;*/
|
||||
background: #000000!important;
|
||||
color: #ffffff!important;
|
||||
font-family: 'Open Sans', sans-serif!important;
|
||||
}
|
||||
|
||||
.card {
|
||||
/*background: #1f262d!important;*/
|
||||
background: #1f262d!important;
|
||||
/*background: #15191e!important;
|
||||
color: #ffffff!important;*/
|
||||
/*border: 1px solid #ffffff!important;*/
|
||||
|
||||
background: #000000!important;
|
||||
color: #ffffff!important;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
/*font-family: 'Raleway', sans-serif!important;*/
|
||||
font-family: 'Overpass Mono', monospace!important;
|
||||
}
|
||||
|
||||
.navbar-brand, .card-title, .navbar-nav {
|
||||
font-family: 'Overpass Mono', monospace!important;
|
||||
}
|
||||
.btn {
|
||||
font-family: 'Overpass Mono', monospace!important;
|
||||
}
|
||||
|
||||
BIN
clientApp/GUI/fonts/Blanka/Blanka-Regular.otf
Normal file
BIN
clientApp/GUI/fonts/Blanka/Blanka-Regular.otf
Normal file
Binary file not shown.
15
clientApp/GUI/fonts/Blanka/Please Read This.rtf
Normal file
15
clientApp/GUI/fonts/Blanka/Please Read This.rtf
Normal file
@@ -0,0 +1,15 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf190
|
||||
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\f0\fs24 \cf0 Thanks for downloading BLANKA FONT !\
|
||||
\
|
||||
You can use it for free and commercial.\
|
||||
\
|
||||
Feedbacks are welcome !\
|
||||
\
|
||||
\'97\
|
||||
Emmeran RICHARD.\
|
||||
www.emmeranrichard.fr}
|
||||
BIN
clientApp/GUI/fonts/Elianto/Elianto-Regular.otf
Normal file
BIN
clientApp/GUI/fonts/Elianto/Elianto-Regular.otf
Normal file
Binary file not shown.
BIN
clientApp/GUI/fonts/Elianto/Elianto-Regular.ttf
Normal file
BIN
clientApp/GUI/fonts/Elianto/Elianto-Regular.ttf
Normal file
Binary file not shown.
BIN
clientApp/GUI/img/darkID-logo-black.png
Normal file
BIN
clientApp/GUI/img/darkID-logo-black.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
clientApp/GUI/img/darkID-logo-white.png
Normal file
BIN
clientApp/GUI/img/darkID-logo-white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
clientApp/GUI/img/darkID-logo.xcf
Normal file
BIN
clientApp/GUI/img/darkID-logo.xcf
Normal file
Binary file not shown.
BIN
clientApp/GUI/img/darkID-logo01.png
Normal file
BIN
clientApp/GUI/img/darkID-logo01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 458 KiB |
BIN
clientApp/GUI/img/darkID-logo01_transparent.png
Normal file
BIN
clientApp/GUI/img/darkID-logo01_transparent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 223 KiB |
BIN
clientApp/GUI/img/darkID-logo02.png
Normal file
BIN
clientApp/GUI/img/darkID-logo02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 456 KiB |
@@ -3,10 +3,16 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>blockchainIDsystem</title>
|
||||
<title>darkID</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<link rel="icon" type="image/png" href="img/blockchainIDsystem-logo-black.png">
|
||||
<link rel="icon" type="image/png" href="img/darkID-logo-black.png">
|
||||
|
||||
<!-- Fonts -->
|
||||
<!-- in development I use googlefonts to go faster, but for the final app, I'll use downloaded fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans|Overpass+Mono:700|Raleway:700" rel="stylesheet">
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="bower_components/components-font-awesome/css/font-awesome.min.css">
|
||||
|
||||
@@ -18,7 +24,7 @@
|
||||
|
||||
<body ng-app="webapp">
|
||||
<div ng-include="'views/navbar.html'"></div>
|
||||
<br><br><br><br><br>
|
||||
<br><br><br><br>
|
||||
<div ng-view></div>
|
||||
|
||||
|
||||
@@ -48,6 +54,10 @@ Works for both browser and electron with the same code -->
|
||||
<!-- jQuery for Bootstrap -->
|
||||
<script src="bower_components/jquery/dist/jquery.min.js"></script>
|
||||
|
||||
<!-- Angular Chart -->
|
||||
<script src="bower_components/chart.js/dist/Chart.min.js"></script>
|
||||
<script src="bower_components/angular-chart.js/dist/angular-chart.min.js"></script>
|
||||
|
||||
<!-- toastr -->
|
||||
<link rel="stylesheet" type="text/css" href="bower_components/angular-toastr/dist/angular-toastr.css" />
|
||||
<script type="text/javascript" src="bower_components/angular-toastr/dist/angular-toastr.tpls.js"></script>
|
||||
@@ -58,6 +68,8 @@ Works for both browser and electron with the same code -->
|
||||
<script src="views/main/main.js"></script>
|
||||
<script src="views/signup/signup.js"></script>
|
||||
<script src="views/login/login.js"></script>
|
||||
<script src="views/id/id.js"></script>
|
||||
<script src="views/stats/stats.js"></script>
|
||||
|
||||
|
||||
<!-- ELECTRON
|
||||
|
||||
@@ -17,9 +17,9 @@ function createWindow () {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 850,
|
||||
height: 600,
|
||||
icon: 'img/blockchainIDsystem-logo-white.png'
|
||||
icon: 'img/darkID-logo-white.png'
|
||||
})
|
||||
tray = new Tray('img/blockchainIDsystem-logo-white.png')
|
||||
tray = new Tray('img/darkID-logo-white.png')
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{label: 'Obre la finestra', type: 'radio'},
|
||||
{label: 'javascript madness', type: 'radio'},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "blockchainIDsystem-clientApp",
|
||||
"name": "darkID-clientApp",
|
||||
"version": "1.0.0",
|
||||
"description": "frontend desktop app for blockchainIDsystem",
|
||||
"description": "frontend desktop app for darkID",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"postinstall": "bower install",
|
||||
|
||||
56
clientApp/GUI/views/id/id.html
Normal file
56
clientApp/GUI/views/id/id.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4>ID: {{id.id}}</h4>
|
||||
|
||||
<span class="pull-right">{{id.date | date: "dd.MM.y, HH:mm:ss"}}h</span>
|
||||
|
||||
<span class="badge c_o_red300" ng-show="!id.verified">Not verified</span>
|
||||
<span class="badge c_o_green300" ng-show="id.verified">Verified</span>
|
||||
<span class="badge c_o_orange300" ng-show="!id.unblindedsig">Not signed</span>
|
||||
<span class="badge c_o_blue300" ng-show="id.unblindedsig">Signed</span>
|
||||
<span class="badge c_o_deepPurple300" ng-show="id.blockchainref">in Blockchain</span>
|
||||
<div class="row">
|
||||
<textarea style="color:#000000;width:100%;" rows="4"
|
||||
ng-model="decryptData.c"
|
||||
placeholder="Enter here the proof-of-decrypt..."
|
||||
></textarea>
|
||||
</div>
|
||||
<h5 ng-show="decryptData.m">PoD:</h5>
|
||||
{{decryptData.m}}
|
||||
<div ng-click="decrypt()" ng-show="id.blockchainref" class="btn btn-raised pull-right c_o_pink300">
|
||||
Proof of decrypt
|
||||
</div>
|
||||
|
||||
<br><br><br><br><br>
|
||||
<hr>
|
||||
<h5>Testing only:</h5>
|
||||
<div class="row">
|
||||
<textarea style="color:#000000;width:100%;" rows="4"
|
||||
ng-model="encryptData.m"
|
||||
placeholder="Enter here the unencrypted..."
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="row">
|
||||
<textarea style="backgroud:grey;color:#000000;width:100%;" rows="4"
|
||||
ng-model="encryptData.c"
|
||||
placeholder="Encrypted data..."
|
||||
></textarea>
|
||||
</div>
|
||||
<div ng-click="encrypt()" ng-show="id.blockchainref" class="btn btn-raised pull-right c_o_orange300">
|
||||
Encrypt
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
76
clientApp/GUI/views/id/id.js
Normal file
76
clientApp/GUI/views/id/id.js
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.id', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/id/:keyid', {
|
||||
templateUrl: 'views/id/id.html',
|
||||
controller: 'IdCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('IdCtrl', function($scope, $rootScope, $http, $routeParams) {
|
||||
$scope.keyid = $routeParams.keyid;
|
||||
$scope.decryptData = {
|
||||
m:"",
|
||||
c:""
|
||||
};
|
||||
$scope.encryptData = {
|
||||
m:"",
|
||||
c:""
|
||||
};
|
||||
|
||||
$rootScope.server = JSON.parse(localStorage.getItem("old_darkID_server"));
|
||||
|
||||
$scope.id = {};
|
||||
$scope.clientApp = function(route, param) {
|
||||
$http.get(clientapi + route + '/' + param)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.id = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
$scope.clientApp('id', $routeParams.keyid);
|
||||
|
||||
|
||||
$scope.decrypt = function() {
|
||||
$http({
|
||||
url: clientapi + 'decrypt/' + $routeParams.keyid,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.decryptData
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
$scope.decryptData = data.data;
|
||||
},
|
||||
function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
};
|
||||
$scope.encrypt = function() {
|
||||
$http({
|
||||
url: clientapi + 'encrypt/' + $routeParams.keyid,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.encryptData
|
||||
})
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
$scope.encryptData = data.data;
|
||||
},
|
||||
function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -1,20 +1,20 @@
|
||||
<div class="container" style="margin-top: -80px;">
|
||||
<div class="container" style="margin-top: -60px;">
|
||||
<div class="row">
|
||||
<div class="col-sm-3">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="card">
|
||||
<img src="img/blockchainIDsystem-logo01.png" class="img-responsive" />
|
||||
<img src="img/darkID-logo01.png" class="img-responsive" />
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">
|
||||
blockchainIDsystem
|
||||
darkID
|
||||
</h4>
|
||||
<input ng-model="user.email" class="form-control" placeholder="Email" type="text">
|
||||
<input ng-model="user.password" class="form-control" placeholder="Password" type="password">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div href="#!/signup" class="btn btn-raised btn-block c_o_pink300">Signup</div>
|
||||
<a href="#!/signup" class="btn btn-raised btn-block c_o_pink300">Signup</a>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div ng-click="login()" class="btn btn-raised btn-block c_o_cyan300 pull-right">Login</div>
|
||||
|
||||
@@ -9,13 +9,32 @@ angular.module('app.login', ['ngRoute'])
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('LoginCtrl', function($scope, $http, $routeParams, toastr) {
|
||||
.controller('LoginCtrl', function($scope, $rootScope, $http, $routeParams, toastr) {
|
||||
$rootScope.server = "";
|
||||
$scope.user = {};
|
||||
//set server in goclient
|
||||
$http.get(clientapi + 'getserver')
|
||||
.then(function(data) {
|
||||
console.log("data server: ");
|
||||
console.log(data.data + "/");
|
||||
$rootScope.server = "http://" + data.data.replace("\n", "") + "/";
|
||||
console.log($rootScope.server + "/");
|
||||
localStorage.setItem("old_darkID_server", JSON.stringify($rootScope.server));
|
||||
console.log("server", $rootScope.server + "/");
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
|
||||
$scope.login = function() {
|
||||
|
||||
console.log('Doing login', $scope.user);
|
||||
console.log(urlapi + "login");
|
||||
console.log($rootScope.server + "/login");
|
||||
|
||||
|
||||
|
||||
//
|
||||
$http({
|
||||
url: urlapi + 'login',
|
||||
url: $rootScope.server + 'login',
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
@@ -26,12 +45,12 @@ angular.module('app.login', ['ngRoute'])
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
if (data.data.token) {
|
||||
localStorage.setItem("blid_token", data.data.token);
|
||||
localStorage.setItem("blid_user", JSON.stringify(data.data));
|
||||
localStorage.setItem("old_darkID_token", data.data.token);
|
||||
localStorage.setItem("old_darkID_user", JSON.stringify(data.data));
|
||||
window.location.reload();
|
||||
} else {
|
||||
console.log("login failed");
|
||||
toastr.error('Login failed');
|
||||
toastr.error('Login failed, ' + data.data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,40 +4,49 @@
|
||||
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div ng-click="newID()" class="btn btn-raised c_o_pink300">Create new ID</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="card-body">
|
||||
<div ng-click="newID()" class="btn btn-raised pull-right c_o_pink300">Create new ID</div>
|
||||
<h4 class="card-title">
|
||||
My IDs
|
||||
</h4>
|
||||
<div class="row" style="height:200px;" ng-repeat="id in ids">
|
||||
<div class="col-sm-6">
|
||||
Public Key: {{id.pubK}}
|
||||
<!--<br> Private Key: {{id.privK}}-->
|
||||
<br> Date of creation: {{id.date}}
|
||||
<!--<br> {{id.pubKSigned}}-->
|
||||
<br>
|
||||
<br><br>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="pull-right">
|
||||
<div class="card" ng-repeat="id in ids" style="overflow-x:hidden;">
|
||||
<div class="card-body">
|
||||
<h4>{{id.pubK}}</h4>
|
||||
<span class="pull-right">{{id.date | date: "dd.MM.y, HH:mm:ss"}}h</span>
|
||||
|
||||
<span class="badge c_o_red300" ng-show="!id.verified">Not verified</span>
|
||||
<span class="badge c_o_green300" ng-show="id.verified">Verified</span>
|
||||
<span class="badge c_o_orange300" ng-show="!id.unblindedsig">Not signed</span>
|
||||
<span class="badge c_o_blue300" ng-show="id.unblindedsig">Signed</span>
|
||||
<span class="badge c_o_deepPurple300" ng-show="id.blockchainref">in Blockchain</span>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div ng-click="clientApp('blindandsendtosign', id.pubK)" ng-show="!id.unblindedsig" class="btn btn-raised btn-sm c_o_cyan300">
|
||||
Send to serverIDsigner
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<span class="badge c_o_orange300" ng-show="!id.pubKSigned">Not signed</span>
|
||||
<span class="badge c_o_green300" ng-show="id.pubKSigned">Signed</span>
|
||||
<div ng-click="clientApp('addtoblockchain', id.pubK)" ng-show="id.unblindedsig && !id.blockchainref" class="btn btn-raised btn-sm c_o_deepPurple300">
|
||||
<i title="" class="fa fa-chain"></i> Add to blockchain
|
||||
</div>
|
||||
<div ng-click="blindAndSendToSign(id.pubK)" ng-show="!id.pubKSigned" class="btn btn-sm btn-raised c_o_cyan300 pull-right">Send to serverIDsigner</div>
|
||||
<a ng-href="#!/id/{{id.pubK}}" ng-show="id.blockchainref" class="btn btn-raised btn-sm c_o_green300">
|
||||
Use ID
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<!--<div ng-click="verify(id.pubK)" ng-show="!id.verified"class="btn btn-sm btn-raised c_o_deepPurple300 pull-right">Verify</div>-->
|
||||
|
||||
<div ng-click="clientApp('delete', id.pubK)" class="btn btn-raised pull-right btn-sm c_o_red300">
|
||||
<i title="Delete" class="fa fa-trash fa-1x"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="progress progress-striped" ng-show="generatingID">
|
||||
<div class="progress-bar progress-bar-success active" style="width: 100%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,11 @@ angular.module('app.main', ['ngRoute'])
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('MainCtrl', function($scope, $http) {
|
||||
.controller('MainCtrl', function($scope, $rootScope, $http) {
|
||||
|
||||
$rootScope.server = JSON.parse(localStorage.getItem("old_darkID_server"));
|
||||
|
||||
$scope.generatingID = false;
|
||||
$scope.ids = [];
|
||||
$http.get(clientapi + 'ids')
|
||||
.then(function(data) {
|
||||
@@ -22,19 +26,21 @@ angular.module('app.main', ['ngRoute'])
|
||||
});
|
||||
|
||||
$scope.newID = function() {
|
||||
$scope.generatingID = true;
|
||||
$http.get(clientapi + 'newid')
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
$scope.generatingID = false;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.blindAndSendToSign = function(pubK) {
|
||||
$http.get(clientapi + 'blindandsendtosign/' + pubK)
|
||||
$scope.blindAndSendToSign = function(id) {
|
||||
$http.get(clientapi + 'blindandsendtosign/' + id)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
@@ -44,8 +50,19 @@ angular.module('app.main', ['ngRoute'])
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
$scope.verify = function(pubK) {
|
||||
$http.get(clientapi + 'verify/' + pubK)
|
||||
$scope.verify = function(id) {
|
||||
$http.get(clientapi + 'verify/' + id)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
$scope.clientApp = function(route, param) {
|
||||
$http.get(clientapi + route + '/' + param)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
|
||||
@@ -7,12 +7,29 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/" title="blockchainIDsystem">
|
||||
<img src="img/blockchainIDsystem-logo-white.png" style="width:30px;height:30px;display:inline;" alt=""> <b>blockchainIDsystem</b>
|
||||
<a class="navbar-brand" href="#!/" title="darkID">
|
||||
<img src="img/darkID-logo-white.png" style="width:30px;height:30px;display:inline;" alt=""> darkID
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="#!/stats" title="Stats">
|
||||
<i title="Server" class="fa fa-bar-chart fa-1x"></i> Stats
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://127.0.0.1:3080" target="_blank" title="Blockchain Explorer">
|
||||
<i title="Server" class="fa fa-link fa-1x"></i> Blockchain Explorer
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a title="serverIDsigner">
|
||||
<i title="Server" class="fa fa-server fa-1x"></i> {{server}}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="">
|
||||
<i title="User" class="fa fa-user fa-1x"></i> {{user.email}}
|
||||
|
||||
@@ -9,13 +9,15 @@ angular.module('app.navbar', ['ngRoute'])
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('NavbarCtrl', function($scope, $http, $routeParams, $location) {
|
||||
.controller('NavbarCtrl', function($scope, $rootScope, $http, $routeParams, $location) {
|
||||
$rootScope.server = JSON.parse(localStorage.getItem("old_darkID_server"));
|
||||
|
||||
$scope.user = JSON.parse(localStorage.getItem("blid_user"));
|
||||
$scope.user = JSON.parse(localStorage.getItem("old_darkID_user"));
|
||||
|
||||
$scope.logout = function() {
|
||||
localStorage.removeItem("blid_token");
|
||||
localStorage.removeItem("blid_user");
|
||||
localStorage.removeItem("old_darkID_token");
|
||||
localStorage.removeItem("old_darkID_user");
|
||||
localStorage.removeItem("old_darkID_server");
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,40 +1,32 @@
|
||||
<div class="container">
|
||||
<div class="container" style="margin-top: -80px;">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="col-sm-3">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<h3 class="panel-title">Signup</h3>
|
||||
<div class="col-sm-6">
|
||||
<div class="card">
|
||||
<img src="img/darkID-logo01.png" class="img-responsive" />
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">
|
||||
darkID
|
||||
</h4>
|
||||
<input ng-model="user.email" class="form-control" placeholder="Email" type="text">
|
||||
<input ng-model="user.password" class="form-control" placeholder="Password" type="password">
|
||||
<input ng-model="user.phone" class="form-control" placeholder="Phone" type="text">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<a href="#!/login" class="btn btn-raised btn-block c_o_blue300">Cancel</a>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.username" abmFormControl class="form-control" id="inputUsername" placeholder="Username" type="text">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input ng-model="user.password" abmFormControl class="form-control" id="inputPassword" placeholder="Password" type="password">
|
||||
</div>
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.email" abmFormControl class="form-control" id="inputEmail" placeholder="Email" type="text">
|
||||
</div>
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.phone" abmFormControl class="form-control" id="inputPhone" placeholder="Phone" type="text">
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-1 col-form-label">@</label>
|
||||
<div class="col-sm-10">
|
||||
<input ng-model="user.telegram" abmFormControl class="form-control" id="inputTelegram" placeholder="Telegram" type="text">
|
||||
<div class="col-sm-6">
|
||||
<div ng-click="signup()" class="btn btn-raised btn-block c_o_pink300 pull-right">Signup</div>
|
||||
</div>
|
||||
</div>
|
||||
<a ng-href="#!/login" class="btn btn-raised c_grey500">Back</a>
|
||||
<div ng-click="doSignup()" class="btn btn-raised c_deepPurple300 pull-right">Signup</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-4">
|
||||
<div class="col-sm-3">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,34 +9,26 @@ angular.module('app.signup', ['ngRoute'])
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('SignupCtrl', function($scope, $http, $routeParams) {
|
||||
.controller('SignupCtrl', function($scope, $http, $routeParams, $rootScope) {
|
||||
$scope.user = {};
|
||||
$scope.doSignup = function() {
|
||||
console.log('Doing login', $scope.user);
|
||||
|
||||
$scope.signup = function() {
|
||||
console.log('Doing signup', $scope.user);
|
||||
$http({
|
||||
url: urlapi + 'signup',
|
||||
url: $rootScope.server + 'signup',
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": undefined
|
||||
},
|
||||
data: $scope.user
|
||||
})
|
||||
.then(function(response) {
|
||||
console.log("response: ");
|
||||
console.log(response.data);
|
||||
if (response.data.success == true)
|
||||
{
|
||||
localStorage.setItem("cr_webapp_token", response.data.token);
|
||||
localStorage.setItem("cr_webapp_userdata", JSON.stringify(response.data.user));
|
||||
window.location.reload();
|
||||
}else{
|
||||
console.log("signup failed");
|
||||
toastr.error('Signup failed');
|
||||
}
|
||||
|
||||
.then(function(data) {
|
||||
console.log("data: ");
|
||||
console.log(data.data);
|
||||
window.location="/";
|
||||
|
||||
},
|
||||
function(response) { // optional
|
||||
// failed
|
||||
console.log(response);
|
||||
function(data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
39
clientApp/GUI/views/stats/stats.html
Normal file
39
clientApp/GUI/views/stats/stats.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<h4 class="card-title">
|
||||
Stats
|
||||
</h4>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<canvas id="line" class="chart chart-line" chart-data="chart1.data"
|
||||
chart-labels="chart1.labels"
|
||||
chart-colors="chart1.colours">
|
||||
</canvas>
|
||||
</div>
|
||||
<div class="row">
|
||||
<canvas id="line" class="chart chart-pie" chart-data="chart2.data"
|
||||
chart-labels="chart2.labels"
|
||||
chart-colors="chart2.colours">
|
||||
</canvas>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="progress progress-striped" ng-show="generatingID">
|
||||
<div class="progress-bar progress-bar-success active" style="width: 100%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
136
clientApp/GUI/views/stats/stats.js
Normal file
136
clientApp/GUI/views/stats/stats.js
Normal file
@@ -0,0 +1,136 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.stats', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/stats', {
|
||||
templateUrl: 'views/stats/stats.html',
|
||||
controller: 'StatsCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('StatsCtrl', function($scope, $rootScope, $http, $filter) {
|
||||
|
||||
$rootScope.server = JSON.parse(localStorage.getItem("old_darkID_server"));
|
||||
|
||||
$scope.generatingID = false;
|
||||
$scope.ids = [];
|
||||
$http.get(clientapi + 'ids')
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
$scope.idsToChart();
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
|
||||
$scope.newID = function() {
|
||||
$scope.generatingID = true;
|
||||
$http.get(clientapi + 'newid')
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
$scope.generatingID = false;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.blindAndSendToSign = function(id) {
|
||||
$http.get(clientapi + 'blindandsendtosign/' + id)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
$scope.verify = function(id) {
|
||||
$http.get(clientapi + 'verify/' + id)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
$scope.clientApp = function(route, param) {
|
||||
$http.get(clientapi + route + '/' + param)
|
||||
.then(function(data) {
|
||||
console.log('data success');
|
||||
console.log(data);
|
||||
$scope.ids = data.data;
|
||||
|
||||
}, function(data) {
|
||||
console.log('data error');
|
||||
});
|
||||
};
|
||||
|
||||
//chartjs
|
||||
$scope.chart1 = {
|
||||
colours: ['#4DD0E1', '#9575CD', '#F06292', '#FFF176'],
|
||||
labels: [],
|
||||
data: []
|
||||
};
|
||||
$scope.chart2 = {
|
||||
colours: ['#4DD0E1', '#9575CD', '#F06292', '#FFF176'],
|
||||
labels: [],
|
||||
data: []
|
||||
};
|
||||
$scope.idsToChart = function() {
|
||||
//chart1
|
||||
var dictionary = {};
|
||||
var ids = $scope.ids;
|
||||
for(var i=0; i<ids.length; i++) {
|
||||
var day = $filter('date')(ids[i].date, 'dd.MM.y, HH:mm');
|
||||
if(dictionary[day]==undefined) {
|
||||
dictionary[day] = 1
|
||||
} else {
|
||||
dictionary[day]++;
|
||||
}
|
||||
}
|
||||
console.log(dictionary);
|
||||
for(var key in dictionary) {
|
||||
$scope.chart1.labels.push(key);
|
||||
$scope.chart1.data.push(dictionary[key]);
|
||||
}
|
||||
|
||||
|
||||
//chart2
|
||||
var dictionary = {};
|
||||
for(var i=0; i<ids.length; i++) {
|
||||
if(ids[i].blockchainref) {
|
||||
if(dictionary['in blockchain']==undefined) {
|
||||
dictionary['in blockchain'] = 1
|
||||
} else {
|
||||
dictionary['in blockchain']++;
|
||||
}
|
||||
} else if(ids[i].unblindedsig) {
|
||||
if(dictionary['signed']==undefined) {
|
||||
dictionary['signed'] = 1
|
||||
} else {
|
||||
dictionary['signed']++;
|
||||
}
|
||||
} else {
|
||||
if(dictionary['unsigned']==undefined) {
|
||||
dictionary['unsigned'] = 1
|
||||
} else {
|
||||
dictionary['unsigned']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(dictionary);
|
||||
for(var key in dictionary) {
|
||||
$scope.chart2.labels.push(key);
|
||||
$scope.chart2.data.push(dictionary[key]);
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
@@ -20,6 +20,11 @@ func Index(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "serverIDsigner")
|
||||
}
|
||||
|
||||
func GetServer(w http.ResponseWriter, r *http.Request) {
|
||||
color.Green(config.ServerIDSigner)
|
||||
fmt.Println(string(config.ServerIDSigner))
|
||||
fmt.Fprintln(w, string(config.ServerIDSigner))
|
||||
}
|
||||
func IDs(w http.ResponseWriter, r *http.Request) {
|
||||
//read the keys stored in /keys directory
|
||||
keys := readKeys("keys.json")
|
||||
@@ -69,7 +74,7 @@ func BlindAndSendToSign(w http.ResponseWriter, r *http.Request) {
|
||||
*/
|
||||
|
||||
//get the serverIDsigner pubK
|
||||
serverPubK := getServerPubK("http://" + config.ServerIDSigner.IP + ":" + config.ServerIDSigner.Port)
|
||||
serverPubK := getServerPubK("http://" + config.ServerIDSigner)
|
||||
|
||||
//blind the key.PubK
|
||||
var m []int
|
||||
@@ -90,7 +95,7 @@ func BlindAndSendToSign(w http.ResponseWriter, r *http.Request) {
|
||||
color.Green(askBlindSign.M)
|
||||
body := new(bytes.Buffer)
|
||||
json.NewEncoder(body).Encode(askBlindSign)
|
||||
res, err := http.Post("http://"+config.ServerIDSigner.IP+":"+config.ServerIDSigner.Port+"/blindsign", "application/json", body)
|
||||
res, err := http.Post("http://"+config.ServerIDSigner+"/blindsign", "application/json", body)
|
||||
check(err)
|
||||
fmt.Println(res)
|
||||
|
||||
@@ -117,13 +122,16 @@ func BlindAndSendToSign(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var iKey int
|
||||
for i, k := range keys {
|
||||
color.Green(k.PubK)
|
||||
color.Blue(packPubK)
|
||||
if k.PubK == packPubK {
|
||||
iKey = i
|
||||
//save to k the key updated
|
||||
k.PubKSigned = ownrsa.ArrayIntToString(mSigned, "_")
|
||||
k.Verified = verified
|
||||
keys[i].PubKSigned = ownrsa.ArrayIntToString(mSigned, "_")
|
||||
keys[i].Verified = verified
|
||||
keys[i].UnblindedSig = ownrsa.ArrayIntToString(mSigned, "_")
|
||||
}
|
||||
fmt.Println(k)
|
||||
fmt.Println(keys[i])
|
||||
}
|
||||
keys[iKey].PubKSigned = ownrsa.ArrayIntToString(mSigned, "_")
|
||||
keys[iKey].Verified = verified
|
||||
@@ -152,7 +160,7 @@ func Verify(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
//get the serverIDsigner pubK
|
||||
serverPubK := getServerPubK("http://" + config.ServerIDSigner.IP + ":" + config.ServerIDSigner.Port)
|
||||
serverPubK := getServerPubK("http://" + config.ServerIDSigner)
|
||||
m := ownrsa.StringToArrayInt(key.PubK, "_")
|
||||
mSigned := ownrsa.StringToArrayInt(key.PubKSigned, "_")
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
{
|
||||
"port": "4100",
|
||||
"keysDirectory": "keys",
|
||||
"serverIDsigner": {
|
||||
"ip": "127.0.0.1",
|
||||
"port": "3130"
|
||||
}
|
||||
"serverIDsigner": "127.0.0.1:3130"
|
||||
}
|
||||
|
||||
@@ -30,5 +30,8 @@ func main() {
|
||||
}
|
||||
|
||||
func GUI() {
|
||||
//here, run electron app
|
||||
//here, run webserver
|
||||
log.Println("webserver in port " + "8080")
|
||||
http.Handle("/", http.FileServer(http.Dir("./GUI")))
|
||||
http.ListenAndServe(":"+"8080", nil)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ type PackRSA struct {
|
||||
Date time.Time `json:"date"`
|
||||
PubKSigned string `json:"pubKSigned"`
|
||||
Verified bool `json:"verified"`
|
||||
UnblindedSig string `json:"unblindedsig"`
|
||||
BlockchainRef string `json:"blockchainref"`
|
||||
}
|
||||
|
||||
const maxPrime = 500
|
||||
|
||||
@@ -9,11 +9,7 @@ import (
|
||||
type Config struct {
|
||||
Port string `json:"port"`
|
||||
KeysDirectory string `json:"keysDirectory"`
|
||||
ServerIDSigner Server `json:"serverIDsigner"`
|
||||
}
|
||||
type Server struct {
|
||||
IP string `json:"ip"`
|
||||
Port string `json:"port"`
|
||||
ServerIDSigner string `json:"serverIDsigner"`
|
||||
}
|
||||
|
||||
var config Config
|
||||
|
||||
@@ -9,6 +9,12 @@ var routes = Routes{
|
||||
"/",
|
||||
Index,
|
||||
},
|
||||
Route{
|
||||
"GetServer",
|
||||
"GET",
|
||||
"/getserver",
|
||||
GetServer,
|
||||
},
|
||||
Route{
|
||||
"IDs",
|
||||
"GET",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,8 +3,11 @@ SESSION='peersTest'
|
||||
tmux new-session -d -s $SESSION
|
||||
tmux split-window -d -t 0 -v
|
||||
tmux split-window -d -t 0 -h
|
||||
tmux split-window -d -t 0 -v
|
||||
tmux split-window -d -t 2 -v
|
||||
tmux split-window -d -t 1 -h
|
||||
tmux split-window -d -t 0 -h
|
||||
|
||||
tmux split-window -d -t 4 -h
|
||||
tmux split-window -d -t 5 -h
|
||||
tmux split-window -d -t 4 -h
|
||||
|
||||
tmux send-keys -t 0 'cd peer && go run *.go server 3001 3002' enter
|
||||
@@ -14,7 +17,15 @@ sleep 1
|
||||
tmux send-keys -t 1 'cd peer && go run *.go client 3003 3004' enter
|
||||
tmux send-keys -t 2 'cd peer && go run *.go client 3005 3006' enter
|
||||
tmux send-keys -t 3 'cd peer && go run *.go client 3007 3008' enter
|
||||
|
||||
tmux send-keys -t 4 'cd serverCA && go run *.go' enter
|
||||
tmux send-keys -t 5 'cd serverIDsigner && go run *.go' enter
|
||||
tmux send-keys -t 6 'cd clientApp && go run *.go' enter
|
||||
#tmux send-keys -t 7 'cd clientApp/GUI && electron .' enter
|
||||
|
||||
tmux attach
|
||||
|
||||
|
||||
# webapps are at:
|
||||
# serverCA: http://127.0.0.1:3080
|
||||
# clientApp: http://127.0.0.1:8080
|
||||
|
||||
@@ -72,6 +72,7 @@ func Login(w http.ResponseWriter, r *http.Request) {
|
||||
panic(err)
|
||||
}
|
||||
defer r.Body.Close()
|
||||
//TODO check if the user password exists in the database
|
||||
|
||||
fmt.Print("user login: ")
|
||||
fmt.Println(user)
|
||||
@@ -83,11 +84,21 @@ func Login(w http.ResponseWriter, r *http.Request) {
|
||||
rUser := User{}
|
||||
err = userCollection.Find(bson.M{"email": user.Email}).One(&rUser)
|
||||
if err != nil {
|
||||
} else {
|
||||
//user exists, update with the token
|
||||
jResp, err := json.Marshal("error login, email not found")
|
||||
check(err)
|
||||
fmt.Fprintln(w, string(jResp))
|
||||
return
|
||||
}
|
||||
//user exists, check password
|
||||
if user.Password != rUser.Password {
|
||||
jResp, err := json.Marshal("error login, password not match")
|
||||
check(err)
|
||||
fmt.Fprintln(w, string(jResp))
|
||||
return
|
||||
}
|
||||
//update with the token
|
||||
err = userCollection.Update(bson.M{"_id": rUser.Id}, user)
|
||||
check(err)
|
||||
}
|
||||
|
||||
jResp, err := json.Marshal(user)
|
||||
if err != nil {
|
||||
|
||||
13
tmuxTest.sh
Normal file
13
tmuxTest.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
SESSION='peersTest'
|
||||
|
||||
tmux new-session -d -s $SESSION
|
||||
tmux split-window -d -t 0 -v
|
||||
tmux split-window -d -t 0 -h
|
||||
tmux split-window -d -t 1 -h
|
||||
tmux split-window -d -t 0 -h
|
||||
|
||||
tmux split-window -d -t 4 -h
|
||||
tmux split-window -d -t 5 -h
|
||||
tmux split-window -d -t 4 -h
|
||||
|
||||
tmux attach
|
||||
Reference in New Issue
Block a user