implemented complete login example (frontend and backend)

This commit is contained in:
arnaucode
2018-01-18 18:37:17 +01:00
parent 55594e3b45
commit 3b65da470d
24 changed files with 435 additions and 76 deletions

View File

@@ -7,6 +7,11 @@
<div class="card">
<div class="card-body">
<h4>ID: {{id.id}}</h4>
<div class="row">
<textarea disabled style="color:#81C784;width:100%;" rows="4"
ng-model="id.publicKey"
></textarea>
</div>
<span class="pull-right">{{id.date | date: "dd.MM.y, HH:mm:ss"}}h</span>
@@ -23,7 +28,7 @@
</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">
<div ng-click="decrypt()" ng-show="id.unblindedsig" class="btn btn-raised pull-right c_o_pink300">
Proof of decrypt
</div>
@@ -42,7 +47,7 @@
placeholder="Encrypted data..."
></textarea>
</div>
<div ng-click="encrypt()" ng-show="id.blockchainref" class="btn btn-raised pull-right c_o_orange300">
<div ng-click="encrypt()" ng-show="id.unblindedsig" class="btn btn-raised pull-right c_o_orange300">
Encrypt
</div>
</div>

View File

@@ -26,7 +26,7 @@
<div ng-click="clientApp('addtoblockchain', id.id)" 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>
<a ng-href="#!/id/{{id.id}}" ng-show="id.blockchainref" class="btn btn-raised btn-sm c_o_green300">
<a ng-href="#!/id/{{id.id}}" ng-show="id.unblindedsig" class="btn btn-raised btn-sm c_o_green300">
Use ID
</a>
</div>

View File

@@ -8,6 +8,7 @@ import (
"crypto/sha1"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os/exec"
"time"
@@ -37,8 +38,16 @@ func NewID() []Key {
key.PrivK = id + "private.pem"
key.PubK = id + "public.pem"
time.Sleep(time.Second * 2)
b, err := ioutil.ReadFile(keysDir + "/" + key.PubK)
if err != nil {
fmt.Print(err)
}
key.PublicKey = string(b)
key.Date = time.Now()
fmt.Println(key)
fmt.Println(key.PublicKey)
keys := readKeys()
keys = append(keys, key)

View File

@@ -19,6 +19,7 @@ type Key struct {
ID string `json:"id"`
PrivK string `json:"privK"` //path of the PrivK file
PubK string `json:"pubK"` //path of the PubK file
PublicKey string `json:"publicKey"`
Date time.Time `json:"date"`
Hashed []byte `json:"hashed"`
UnblindedSig []byte `json:"unblindedsig"`

View File

@@ -40,6 +40,6 @@ func main() {
func GUI() {
//here, run webserver
log.Println("webserver in port " + "8080")
http.Handle("/", http.FileServer(http.Dir("./web")))
http.Handle("/", http.FileServer(http.Dir("./GUI")))
http.ListenAndServe(":"+"8080", nil)
}