mirror of
https://github.com/arnaucube/blockchainIDsystem.git
synced 2026-02-07 02:56:43 +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';
|
'use strict';
|
||||||
|
|
||||||
var urlapi = "http://127.0.0.1:3130/";
|
|
||||||
var clientapi = "http://127.0.0.1:4100/";
|
var clientapi = "http://127.0.0.1:4100/";
|
||||||
|
|
||||||
// Declare app level module which depends on views, and components
|
// Declare app level module which depends on views, and components
|
||||||
@@ -10,15 +10,18 @@ angular.module('app', [
|
|||||||
'angularBootstrapMaterial',
|
'angularBootstrapMaterial',
|
||||||
'ui.bootstrap',
|
'ui.bootstrap',
|
||||||
'toastr',
|
'toastr',
|
||||||
|
'chart.js',
|
||||||
'app.navbar',
|
'app.navbar',
|
||||||
'app.main',
|
'app.main',
|
||||||
'app.signup',
|
'app.signup',
|
||||||
'app.login'
|
'app.login',
|
||||||
|
'app.id',
|
||||||
|
'app.stats'
|
||||||
]).
|
]).
|
||||||
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
|
||||||
$locationProvider.hashPrefix('!');
|
$locationProvider.hashPrefix('!');
|
||||||
|
|
||||||
if ((localStorage.getItem('blid_token'))) {
|
if ((localStorage.getItem('old_darkID_token'))) {
|
||||||
console.log(window.location.hash);
|
console.log(window.location.hash);
|
||||||
if ((window.location.hash === '#!/login') || (window.location.hash === '#!/signup')) {
|
if ((window.location.hash === '#!/login') || (window.location.hash === '#!/signup')) {
|
||||||
window.location = '#!/main';
|
window.location = '#!/main';
|
||||||
@@ -31,8 +34,8 @@ config(['$locationProvider', '$routeProvider', function($locationProvider, $rout
|
|||||||
if ((window.location !== '#!/login') || (window.location !== '#!/signup')) {
|
if ((window.location !== '#!/login') || (window.location !== '#!/signup')) {
|
||||||
console.log('app, user no logged');
|
console.log('app, user no logged');
|
||||||
|
|
||||||
localStorage.removeItem('blid_token');
|
localStorage.removeItem('old_darkID_token');
|
||||||
localStorage.removeItem('blid_userdata');
|
localStorage.removeItem('old_darkID_userdata');
|
||||||
window.location = '#!/login';
|
window.location = '#!/login';
|
||||||
$routeProvider.otherwise({
|
$routeProvider.otherwise({
|
||||||
redirectTo: '/login'
|
redirectTo: '/login'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "angular-seed",
|
"name": "darkID-clientApp",
|
||||||
"description": "A starter project for AngularJS",
|
"description": "",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
"angular-bootstrap": "^2.5.0",
|
"angular-bootstrap": "^2.5.0",
|
||||||
"components-font-awesome": "^4.7.0",
|
"components-font-awesome": "^4.7.0",
|
||||||
"angular-toastr": "^2.1.1",
|
"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 {
|
body {
|
||||||
/*background: #15191e!important;*/
|
/*background: #15191e!important;*/
|
||||||
background: #000000!important;
|
background: #000000!important;
|
||||||
color: #ffffff!important;
|
color: #ffffff!important;
|
||||||
|
font-family: 'Open Sans', sans-serif!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
/*background: #1f262d!important;*/
|
background: #1f262d!important;
|
||||||
/*background: #15191e!important;
|
/*background: #15191e!important;
|
||||||
color: #ffffff!important;*/
|
color: #ffffff!important;*/
|
||||||
/*border: 1px solid #ffffff!important;*/
|
/*border: 1px solid #ffffff!important;*/
|
||||||
|
|
||||||
background: #000000!important;
|
background: #000000!important;
|
||||||
color: #ffffff!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>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>blockchainIDsystem</title>
|
<title>darkID</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<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">
|
<link rel="stylesheet" href="bower_components/components-font-awesome/css/font-awesome.min.css">
|
||||||
|
|
||||||
@@ -18,7 +24,7 @@
|
|||||||
|
|
||||||
<body ng-app="webapp">
|
<body ng-app="webapp">
|
||||||
<div ng-include="'views/navbar.html'"></div>
|
<div ng-include="'views/navbar.html'"></div>
|
||||||
<br><br><br><br><br>
|
<br><br><br><br>
|
||||||
<div ng-view></div>
|
<div ng-view></div>
|
||||||
|
|
||||||
|
|
||||||
@@ -48,6 +54,10 @@ Works for both browser and electron with the same code -->
|
|||||||
<!-- jQuery for Bootstrap -->
|
<!-- jQuery for Bootstrap -->
|
||||||
<script src="bower_components/jquery/dist/jquery.min.js"></script>
|
<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 -->
|
<!-- toastr -->
|
||||||
<link rel="stylesheet" type="text/css" href="bower_components/angular-toastr/dist/angular-toastr.css" />
|
<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>
|
<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/main/main.js"></script>
|
||||||
<script src="views/signup/signup.js"></script>
|
<script src="views/signup/signup.js"></script>
|
||||||
<script src="views/login/login.js"></script>
|
<script src="views/login/login.js"></script>
|
||||||
|
<script src="views/id/id.js"></script>
|
||||||
|
<script src="views/stats/stats.js"></script>
|
||||||
|
|
||||||
|
|
||||||
<!-- ELECTRON
|
<!-- ELECTRON
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ function createWindow () {
|
|||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 850,
|
width: 850,
|
||||||
height: 600,
|
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([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{label: 'Obre la finestra', type: 'radio'},
|
{label: 'Obre la finestra', type: 'radio'},
|
||||||
{label: 'javascript madness', type: 'radio'},
|
{label: 'javascript madness', type: 'radio'},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "blockchainIDsystem-clientApp",
|
"name": "darkID-clientApp",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "frontend desktop app for blockchainIDsystem",
|
"description": "frontend desktop app for darkID",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "bower install",
|
"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="row">
|
||||||
<div class="col-sm-3">
|
<div class="col-sm-3">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="card">
|
<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">
|
<div class="card-body">
|
||||||
<h4 class="card-title">
|
<h4 class="card-title">
|
||||||
blockchainIDsystem
|
darkID
|
||||||
</h4>
|
</h4>
|
||||||
<input ng-model="user.email" class="form-control" placeholder="Email" type="text">
|
<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.password" class="form-control" placeholder="Password" type="password">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-6">
|
<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>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div ng-click="login()" class="btn btn-raised btn-block c_o_cyan300 pull-right">Login</div>
|
<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 = {};
|
$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() {
|
$scope.login = function() {
|
||||||
|
|
||||||
console.log('Doing login', $scope.user);
|
console.log('Doing login', $scope.user);
|
||||||
console.log(urlapi + "login");
|
console.log($rootScope.server + "/login");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
$http({
|
$http({
|
||||||
url: urlapi + 'login',
|
url: $rootScope.server + 'login',
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": undefined
|
"Content-Type": undefined
|
||||||
@@ -26,12 +45,12 @@ angular.module('app.login', ['ngRoute'])
|
|||||||
console.log("data: ");
|
console.log("data: ");
|
||||||
console.log(data.data);
|
console.log(data.data);
|
||||||
if (data.data.token) {
|
if (data.data.token) {
|
||||||
localStorage.setItem("blid_token", data.data.token);
|
localStorage.setItem("old_darkID_token", data.data.token);
|
||||||
localStorage.setItem("blid_user", JSON.stringify(data.data));
|
localStorage.setItem("old_darkID_user", JSON.stringify(data.data));
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
console.log("login failed");
|
console.log("login failed");
|
||||||
toastr.error('Login failed');
|
toastr.error('Login failed, ' + data.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,39 +4,48 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="card">
|
<div ng-click="newID()" class="btn btn-raised pull-right c_o_pink300">Create new ID</div>
|
||||||
<div class="card-body">
|
<h4 class="card-title">
|
||||||
<div ng-click="newID()" class="btn btn-raised c_o_pink300">Create new ID</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="card-body">
|
|
||||||
<h4 class="card-title">
|
|
||||||
My IDs
|
My IDs
|
||||||
</h4>
|
</h4>
|
||||||
<div class="row" style="height:200px;" ng-repeat="id in ids">
|
<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 class="col-sm-6">
|
||||||
Public Key: {{id.pubK}}
|
<div ng-click="clientApp('blindandsendtosign', id.pubK)" ng-show="!id.unblindedsig" class="btn btn-raised btn-sm c_o_cyan300">
|
||||||
<!--<br> Private Key: {{id.privK}}-->
|
Send to serverIDsigner
|
||||||
<br> Date of creation: {{id.date}}
|
</div>
|
||||||
<!--<br> {{id.pubKSigned}}-->
|
<div ng-click="clientApp('addtoblockchain', id.pubK)" ng-show="id.unblindedsig && !id.blockchainref" class="btn btn-raised btn-sm c_o_deepPurple300">
|
||||||
<br>
|
<i title="" class="fa fa-chain"></i> Add to blockchain
|
||||||
<br><br>
|
</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>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="pull-right">
|
|
||||||
<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>
|
|
||||||
</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>
|
|
||||||
<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>
|
|
||||||
<!--<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="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>
|
</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>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
|
||||||
|
|||||||
@@ -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 = [];
|
$scope.ids = [];
|
||||||
$http.get(clientapi + 'ids')
|
$http.get(clientapi + 'ids')
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
@@ -22,19 +26,21 @@ angular.module('app.main', ['ngRoute'])
|
|||||||
});
|
});
|
||||||
|
|
||||||
$scope.newID = function() {
|
$scope.newID = function() {
|
||||||
|
$scope.generatingID = true;
|
||||||
$http.get(clientapi + 'newid')
|
$http.get(clientapi + 'newid')
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
console.log(data);
|
console.log(data);
|
||||||
$scope.ids = data.data;
|
$scope.ids = data.data;
|
||||||
|
$scope.generatingID = false;
|
||||||
|
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
console.log('data error');
|
console.log('data error');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.blindAndSendToSign = function(pubK) {
|
$scope.blindAndSendToSign = function(id) {
|
||||||
$http.get(clientapi + 'blindandsendtosign/' + pubK)
|
$http.get(clientapi + 'blindandsendtosign/' + id)
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
console.log(data);
|
console.log(data);
|
||||||
@@ -44,8 +50,19 @@ angular.module('app.main', ['ngRoute'])
|
|||||||
console.log('data error');
|
console.log('data error');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.verify = function(pubK) {
|
$scope.verify = function(id) {
|
||||||
$http.get(clientapi + 'verify/' + pubK)
|
$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) {
|
.then(function(data) {
|
||||||
console.log('data success');
|
console.log('data success');
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
|||||||
@@ -7,12 +7,29 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="/" title="blockchainIDsystem">
|
<a class="navbar-brand" href="#!/" title="darkID">
|
||||||
<img src="img/blockchainIDsystem-logo-white.png" style="width:30px;height:30px;display:inline;" alt=""> <b>blockchainIDsystem</b>
|
<img src="img/darkID-logo-white.png" style="width:30px;height:30px;display:inline;" alt=""> darkID
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
<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">
|
<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>
|
<li>
|
||||||
<a href="">
|
<a href="">
|
||||||
<i title="User" class="fa fa-user fa-1x"></i> {{user.email}}
|
<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() {
|
$scope.logout = function() {
|
||||||
localStorage.removeItem("blid_token");
|
localStorage.removeItem("old_darkID_token");
|
||||||
localStorage.removeItem("blid_user");
|
localStorage.removeItem("old_darkID_user");
|
||||||
|
localStorage.removeItem("old_darkID_server");
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,40 +1,32 @@
|
|||||||
<div class="container">
|
<div class="container" style="margin-top: -80px;">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-3">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-6">
|
||||||
<div class="panel">
|
<div class="card">
|
||||||
<div class="panel-heading c_deepPurpleG500to300">
|
<img src="img/darkID-logo01.png" class="img-responsive" />
|
||||||
<h3 class="panel-title">Signup</h3>
|
<div class="card-body">
|
||||||
</div>
|
<h4 class="card-title">
|
||||||
<div class="panel-body">
|
darkID
|
||||||
<div class="form-group label-floating">
|
</h4>
|
||||||
<input ng-model="user.username" abmFormControl class="form-control" id="inputUsername" placeholder="Username" type="text">
|
<input ng-model="user.email" class="form-control" placeholder="Email" type="text">
|
||||||
</div>
|
<input ng-model="user.password" class="form-control" placeholder="Password" type="password">
|
||||||
<div class="form-group">
|
<input ng-model="user.phone" class="form-control" placeholder="Phone" type="text">
|
||||||
<input ng-model="user.password" abmFormControl class="form-control" id="inputPassword" placeholder="Password" type="password">
|
<div class="row">
|
||||||
</div>
|
<div class="col-sm-6">
|
||||||
<div class="form-group label-floating">
|
<a href="#!/login" class="btn btn-raised btn-block c_o_blue300">Cancel</a>
|
||||||
<input ng-model="user.email" abmFormControl class="form-control" id="inputEmail" placeholder="Email" type="text">
|
</div>
|
||||||
</div>
|
<div class="col-sm-6">
|
||||||
<div class="form-group label-floating">
|
<div ng-click="signup()" class="btn btn-raised btn-block c_o_pink300 pull-right">Signup</div>
|
||||||
<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>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-3">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,35 +9,27 @@ angular.module('app.signup', ['ngRoute'])
|
|||||||
});
|
});
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.controller('SignupCtrl', function($scope, $http, $routeParams) {
|
.controller('SignupCtrl', function($scope, $http, $routeParams, $rootScope) {
|
||||||
$scope.user = {};
|
$scope.user = {};
|
||||||
$scope.doSignup = function() {
|
$scope.signup = function() {
|
||||||
console.log('Doing login', $scope.user);
|
console.log('Doing signup', $scope.user);
|
||||||
|
|
||||||
$http({
|
$http({
|
||||||
url: urlapi + 'signup',
|
url: $rootScope.server + 'signup',
|
||||||
method: "POST",
|
method: "POST",
|
||||||
data: $scope.user
|
headers: {
|
||||||
})
|
"Content-Type": undefined
|
||||||
.then(function(response) {
|
},
|
||||||
console.log("response: ");
|
data: $scope.user
|
||||||
console.log(response.data);
|
})
|
||||||
if (response.data.success == true)
|
.then(function(data) {
|
||||||
{
|
console.log("data: ");
|
||||||
localStorage.setItem("cr_webapp_token", response.data.token);
|
console.log(data.data);
|
||||||
localStorage.setItem("cr_webapp_userdata", JSON.stringify(response.data.user));
|
window.location="/";
|
||||||
window.location.reload();
|
|
||||||
}else{
|
|
||||||
console.log("signup failed");
|
|
||||||
toastr.error('Signup failed');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
},
|
||||||
},
|
function(data) {
|
||||||
function(response) { // optional
|
console.log(data);
|
||||||
// failed
|
});
|
||||||
console.log(response);
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
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")
|
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) {
|
func IDs(w http.ResponseWriter, r *http.Request) {
|
||||||
//read the keys stored in /keys directory
|
//read the keys stored in /keys directory
|
||||||
keys := readKeys("keys.json")
|
keys := readKeys("keys.json")
|
||||||
@@ -69,7 +74,7 @@ func BlindAndSendToSign(w http.ResponseWriter, r *http.Request) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//get the serverIDsigner pubK
|
//get the serverIDsigner pubK
|
||||||
serverPubK := getServerPubK("http://" + config.ServerIDSigner.IP + ":" + config.ServerIDSigner.Port)
|
serverPubK := getServerPubK("http://" + config.ServerIDSigner)
|
||||||
|
|
||||||
//blind the key.PubK
|
//blind the key.PubK
|
||||||
var m []int
|
var m []int
|
||||||
@@ -90,7 +95,7 @@ func BlindAndSendToSign(w http.ResponseWriter, r *http.Request) {
|
|||||||
color.Green(askBlindSign.M)
|
color.Green(askBlindSign.M)
|
||||||
body := new(bytes.Buffer)
|
body := new(bytes.Buffer)
|
||||||
json.NewEncoder(body).Encode(askBlindSign)
|
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)
|
check(err)
|
||||||
fmt.Println(res)
|
fmt.Println(res)
|
||||||
|
|
||||||
@@ -117,13 +122,16 @@ func BlindAndSendToSign(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
var iKey int
|
var iKey int
|
||||||
for i, k := range keys {
|
for i, k := range keys {
|
||||||
|
color.Green(k.PubK)
|
||||||
|
color.Blue(packPubK)
|
||||||
if k.PubK == packPubK {
|
if k.PubK == packPubK {
|
||||||
iKey = i
|
iKey = i
|
||||||
//save to k the key updated
|
//save to k the key updated
|
||||||
k.PubKSigned = ownrsa.ArrayIntToString(mSigned, "_")
|
keys[i].PubKSigned = ownrsa.ArrayIntToString(mSigned, "_")
|
||||||
k.Verified = verified
|
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].PubKSigned = ownrsa.ArrayIntToString(mSigned, "_")
|
||||||
keys[iKey].Verified = verified
|
keys[iKey].Verified = verified
|
||||||
@@ -152,7 +160,7 @@ func Verify(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get the serverIDsigner pubK
|
//get the serverIDsigner pubK
|
||||||
serverPubK := getServerPubK("http://" + config.ServerIDSigner.IP + ":" + config.ServerIDSigner.Port)
|
serverPubK := getServerPubK("http://" + config.ServerIDSigner)
|
||||||
m := ownrsa.StringToArrayInt(key.PubK, "_")
|
m := ownrsa.StringToArrayInt(key.PubK, "_")
|
||||||
mSigned := ownrsa.StringToArrayInt(key.PubKSigned, "_")
|
mSigned := ownrsa.StringToArrayInt(key.PubKSigned, "_")
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
"port": "4100",
|
"port": "4100",
|
||||||
"keysDirectory": "keys",
|
"keysDirectory": "keys",
|
||||||
"serverIDsigner": {
|
"serverIDsigner": "127.0.0.1:3130"
|
||||||
"ip": "127.0.0.1",
|
|
||||||
"port": "3130"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,5 +30,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GUI() {
|
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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ type RSA struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PackRSA struct {
|
type PackRSA struct {
|
||||||
PubK string `json:"pubK"`
|
PubK string `json:"pubK"`
|
||||||
PrivK string `json:"privK"`
|
PrivK string `json:"privK"`
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
PubKSigned string `json:"pubKSigned"`
|
PubKSigned string `json:"pubKSigned"`
|
||||||
Verified bool `json:"verified"`
|
Verified bool `json:"verified"`
|
||||||
|
UnblindedSig string `json:"unblindedsig"`
|
||||||
|
BlockchainRef string `json:"blockchainref"`
|
||||||
}
|
}
|
||||||
|
|
||||||
const maxPrime = 500
|
const maxPrime = 500
|
||||||
|
|||||||
@@ -9,11 +9,7 @@ import (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
Port string `json:"port"`
|
Port string `json:"port"`
|
||||||
KeysDirectory string `json:"keysDirectory"`
|
KeysDirectory string `json:"keysDirectory"`
|
||||||
ServerIDSigner Server `json:"serverIDsigner"`
|
ServerIDSigner string `json:"serverIDsigner"`
|
||||||
}
|
|
||||||
type Server struct {
|
|
||||||
IP string `json:"ip"`
|
|
||||||
Port string `json:"port"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var config Config
|
var config Config
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ var routes = Routes{
|
|||||||
"/",
|
"/",
|
||||||
Index,
|
Index,
|
||||||
},
|
},
|
||||||
|
Route{
|
||||||
|
"GetServer",
|
||||||
|
"GET",
|
||||||
|
"/getserver",
|
||||||
|
GetServer,
|
||||||
|
},
|
||||||
Route{
|
Route{
|
||||||
"IDs",
|
"IDs",
|
||||||
"GET",
|
"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 new-session -d -s $SESSION
|
||||||
tmux split-window -d -t 0 -v
|
tmux split-window -d -t 0 -v
|
||||||
tmux split-window -d -t 0 -h
|
tmux split-window -d -t 0 -h
|
||||||
tmux split-window -d -t 0 -v
|
tmux split-window -d -t 1 -h
|
||||||
tmux split-window -d -t 2 -v
|
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 split-window -d -t 4 -h
|
||||||
|
|
||||||
tmux send-keys -t 0 'cd peer && go run *.go server 3001 3002' enter
|
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 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 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 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 4 'cd serverCA && go run *.go' enter
|
||||||
tmux send-keys -t 5 'cd serverIDsigner && 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
|
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)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer r.Body.Close()
|
defer r.Body.Close()
|
||||||
|
//TODO check if the user password exists in the database
|
||||||
|
|
||||||
fmt.Print("user login: ")
|
fmt.Print("user login: ")
|
||||||
fmt.Println(user)
|
fmt.Println(user)
|
||||||
@@ -83,11 +84,21 @@ func Login(w http.ResponseWriter, r *http.Request) {
|
|||||||
rUser := User{}
|
rUser := User{}
|
||||||
err = userCollection.Find(bson.M{"email": user.Email}).One(&rUser)
|
err = userCollection.Find(bson.M{"email": user.Email}).One(&rUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
} else {
|
jResp, err := json.Marshal("error login, email not found")
|
||||||
//user exists, update with the token
|
|
||||||
err = userCollection.Update(bson.M{"_id": rUser.Id}, user)
|
|
||||||
check(err)
|
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)
|
jResp, err := json.Marshal(user)
|
||||||
if err != nil {
|
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