From 2c4ba03ace089dd1976e3b62ec8da86a1c1f5330 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 22 May 2017 12:42:29 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=88=D0=B8=D0=BB=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D0=BF=D0=B8=D1=81=D0=B0=D1=82=D1=8C=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=B1=D0=BB=D0=BE=D1=87=D0=BD=D0=BE=D0=B5=20=D1=88=D0=B8?= =?UTF-8?q?=D1=84=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D0=BD=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.component.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 6e2c020..ca4a662 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -3,7 +3,7 @@ import { Http, Headers } from '@angular/http'; export class NewMessage { public Content: string; - public Hash: string; + public Sign: string; } @Component({ @@ -35,10 +35,17 @@ export class AppComponent { } AcceptNew(): void { console.log(this.textarea); + crypto.subtle.generateKey( + { + name: 'AES-GCM', + length: 256, // can be 128, 192, or 256 + }, + true, // whether the key is extractable (i.e. can be used in exportKey) + ['encrypt', 'decrypt'] // can "encrypt", "decrypt", "wrapKey", or "unwrapKey" + ).then(function(key) { }); const encrypted_text = this.textarea; const obj = new NewMessage; obj.Content = encrypted_text; - obj.Hash = ''; const body = JSON.stringify(obj); console.log(body); // const headers = new Headers({ 'Content-Type': 'application/json;charset=utf-8' });