diff --git a/package.json b/package.json
index 189611c..0368c18 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,8 @@
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
+ "bitcore-ecies": "^1.0.3",
+ "bitcore-lib": "^0.14.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 24872af..3aa9414 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,12 +1,24 @@
Log Manager
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 889f721..bbf0730 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,4 +1,11 @@
import { Component } from '@angular/core';
+import { Http, Headers, Response } from '@angular/http';
+import { PrivateKey, PublicKey } from 'bitcore-lib';
+
+export class NewMessage {
+ public Content: string;
+ public Sign: string;
+}
@Component({
selector: 'app-root',
@@ -7,11 +14,40 @@ import { Component } from '@angular/core';
})
export class AppComponent {
showCon = false;
+ showDialog = false;
+ address = 'http://127.0.0.1:8000/api/';
pass: string;
+ textarea: string;
+ constructor(private http: Http) {}
Exit(): void {
this.showCon = false;
}
Decrypt(): void {
this.showCon = true;
+ if (this.pass === 'genmekey') {
+ this.GenerateKeyPair();
+ }
+ }
+ AddNew(): void {
+ this.showDialog = true;
+ }
+ HideNew(): void {
+ this.showDialog = false;
+ this.textarea = null;
+ }
+ GenerateKeyPair(): void {
+ const keypair = new PrivateKey();
+ const pubpair = new PublicKey(keypair, true);
+ console.log(keypair.toString());
+ console.log(pubpair.toString());
+ }
+ AcceptNew(): void {
+ console.log(this.textarea);
+ const obj = new NewMessage;
+ obj.Content = this.textarea;
+ obj.Sign = '';
+ const body = JSON.stringify(obj);
+ const headers = new Headers({ 'Content-Type': 'application/json;charset=utf-8' });
+ this.http.post((this.address + 'new'), body, { headers: headers });
}
}