mirror of
https://github.com/arnaucube/darkID-prototype.git
synced 2026-02-07 11:26:44 +01:00
added proof-of-decrypt, encrypt, decrypt
This commit is contained in:
55
clientApp/GUI/views/id/id.html
Normal file
55
clientApp/GUI/views/id/id.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<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>
|
||||
{{decryptData.m}}
|
||||
<div ng-click="decrypt()" ng-show="id.blockchainref" class="btn btn-raised pull-right c_o_pink300">
|
||||
Proof of decrypt
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br><br><br><br><br>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<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>
|
||||
<textarea style="backgroud:grey;color:#000000;width:100%;" rows="4"
|
||||
ng-model="encryptData.c"
|
||||
placeholder="Encrypted data..."
|
||||
></textarea>
|
||||
<div ng-click="encrypt()" ng-show="id.blockchainref" class="btn btn-raised pull-right c_o_orange300">
|
||||
Encrypt
|
||||
</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("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);
|
||||
});
|
||||
};
|
||||
});
|
||||
@@ -7,7 +7,7 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/" title="darkID">
|
||||
<a class="navbar-brand" href="#!/" title="darkID">
|
||||
<img src="img/darkID-logo-white.png" style="width:30px;height:30px;display:inline;" alt=""> <b>darkID</b>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user