diff --git a/clientApp/GUI/index.html b/clientApp/GUI/index.html index c544034..24baec9 100644 --- a/clientApp/GUI/index.html +++ b/clientApp/GUI/index.html @@ -18,7 +18,7 @@
-




+


diff --git a/clientApp/GUI/views/login/login.html b/clientApp/GUI/views/login/login.html index eaf58f6..3196118 100755 --- a/clientApp/GUI/views/login/login.html +++ b/clientApp/GUI/views/login/login.html @@ -1,4 +1,4 @@ -
+
diff --git a/clientApp/GUI/views/main/main.html b/clientApp/GUI/views/main/main.html index eee21ac..6d87217 100755 --- a/clientApp/GUI/views/main/main.html +++ b/clientApp/GUI/views/main/main.html @@ -6,46 +6,40 @@
-
-
-
Use ID
-
-
-
Create new ID
-
-
-
-
-
-
-
-
-
-
+
Create new ID

My IDs

-
-
- Public Key: {{id.pubK}} - -
Date of creation: {{id.date}} - -
-

-
-
-
+
+
+

{{id.id}}

+ {{id.date | date: "dd.MM.y, HH:mm:ss"}}h + Not verified Verified -
-
Not signed Signed + in Blockchain +
+
+
Send to serverIDsigner
+
Add to blockchain
+ Use ID +
+
+ + +
+ +
+
-

-
Send to serverIDsigner
- +
+
+ +
+
+
diff --git a/clientApp/GUI/views/main/main.js b/clientApp/GUI/views/main/main.js index 08805b8..e77f32b 100755 --- a/clientApp/GUI/views/main/main.js +++ b/clientApp/GUI/views/main/main.js @@ -61,4 +61,15 @@ angular.module('app.main', ['ngRoute']) 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'); + }); + }; }); diff --git a/clientApp/clientApp.go b/clientApp/clientApp.go index 353b167..89899e6 100644 --- a/clientApp/clientApp.go +++ b/clientApp/clientApp.go @@ -8,6 +8,7 @@ import ( "encoding/json" "fmt" "net/http" + "os/exec" "time" "github.com/cryptoballot/fdh" @@ -124,3 +125,18 @@ func Verify(packPubK string) { return } + +func Delete(keyID string) []Key { + originalKeys := readKeys() + //remove key .pem files + key := getKeyByKeyID(keyID) + _, err := exec.Command("rm", keysDir+"/"+key.PrivK).CombinedOutput() + check(err) + _, err = exec.Command("rm", keysDir+"/"+key.PubK).CombinedOutput() + check(err) + + //remove key from keys.json + keys := removeKey(keyID, originalKeys) + saveKeys(keys) + return keys +} diff --git a/clientApp/clientAppRESTFunctions.go b/clientApp/clientAppRESTFunctions.go index 2ce7f69..8b66118 100644 --- a/clientApp/clientAppRESTFunctions.go +++ b/clientApp/clientAppRESTFunctions.go @@ -37,7 +37,7 @@ func GetNewID(w http.ResponseWriter, r *http.Request) { } func GetBlindAndSendToSign(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - idKey := vars["idKey"] + idKey := vars["keyid"] color.Green(idKey) keys := BlindAndSendToSign(idKey) @@ -59,3 +59,14 @@ func GetVerify(w http.ResponseWriter, r *http.Request) { check(err) fmt.Fprintln(w, string(jResp)) } + +func GetDelete(w http.ResponseWriter, r *http.Request) { + vars := mux.Vars(r) + keyID := vars["keyid"] + + keys := Delete(keyID) + + jResp, err := json.Marshal(keys) + check(err) + fmt.Fprintln(w, string(jResp)) +} diff --git a/clientApp/keys.go b/clientApp/keys.go index 9d946de..cb4624b 100644 --- a/clientApp/keys.go +++ b/clientApp/keys.go @@ -24,6 +24,8 @@ type Key struct { UnblindedSig []byte `json:"unblindedsig"` Verified bool `json:"verified"` ServerVerifier *rsa.PublicKey `json:"serververifier"` + SignerID string `json:"signerid"` + BlockchainRef string `json:"blockchainref"` } func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string { @@ -151,6 +153,14 @@ func getKeyByKeyID(keyID string) (k Key) { } return k } +func removeKey(keyID string, originalKeys []Key) (keys []Key) { + for _, key := range originalKeys { + if key.ID != keyID { + keys = append(keys, key) + } + } + return +} /* func getServerPubK(url string) ownrsa.RSAPublicKey { diff --git a/clientApp/restRoutes.go b/clientApp/restRoutes.go index d69dc4f..5f7ad8c 100755 --- a/clientApp/restRoutes.go +++ b/clientApp/restRoutes.go @@ -30,13 +30,19 @@ var routes = Routes{ Route{ "GetBlindAndSendToSign", "GET", - "/blindandsendtosign/{idKey}", + "/blindandsendtosign/{keyid}", GetBlindAndSendToSign, }, Route{ "GetVerify", "GET", - "/verify/{idKey}", + "/verify/{keyid}", GetVerify, }, + Route{ + "GetDelete", + "GET", + "/delete/{keyid}", + GetDelete, + }, } diff --git a/documentation/screenshot02.png b/documentation/screenshot02.png index a9336e6..d71652f 100644 Binary files a/documentation/screenshot02.png and b/documentation/screenshot02.png differ