Переаписал на cryptojs и typings. Проблемы с Webpack

This commit is contained in:
2017-05-22 14:45:22 +03:00
parent 2c4ba03ace
commit 8dc4b0422b
4 changed files with 11 additions and 11 deletions

View File

@@ -22,7 +22,9 @@
"@angular/platform-browser": "^4.0.0", "@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0", "@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0", "@angular/router": "^4.0.0",
"@types/crypto-js": "^3.1.33",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"cryptojs": "^2.5.3",
"rxjs": "^5.1.0", "rxjs": "^5.1.0",
"zone.js": "^0.8.4" "zone.js": "^0.8.4"
}, },

View File

@@ -2,7 +2,6 @@
<span>Log Manager</span> <span>Log Manager</span>
<span style="flex: 1 1 auto;"></span> <span style="flex: 1 1 auto;"></span>
<span> <span>
<button md-button (click)="GenerateKeyPair();">Ключ</button>
<button md-raised-button color="primary" (click)="AddNew();">Новый</button> <button md-raised-button color="primary" (click)="AddNew();">Новый</button>
<button (click)="Exit();" md-raised-button color="warn">Выхода нет</button> <button (click)="Exit();" md-raised-button color="warn">Выхода нет</button>
</span> </span>

View File

@@ -1,5 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Http, Headers } from '@angular/http'; import { Http, Headers } from '@angular/http';
import { AES, SHA256 } from 'cryptojs';
export class NewMessage { export class NewMessage {
public Content: string; public Content: string;
@@ -35,15 +36,7 @@ export class AppComponent {
} }
AcceptNew(): void { AcceptNew(): void {
console.log(this.textarea); console.log(this.textarea);
crypto.subtle.generateKey( const encrypted_text = AES(this.textarea, this.pass);
{
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; const obj = new NewMessage;
obj.Content = encrypted_text; obj.Content = encrypted_text;
const body = JSON.stringify(obj); const body = JSON.stringify(obj);

View File

@@ -4,10 +4,16 @@
"outDir": "../out-tsc/app", "outDir": "../out-tsc/app",
"module": "es2015", "module": "es2015",
"baseUrl": "", "baseUrl": "",
"types": [] "types": [
"node"
]
}, },
"exclude": [ "exclude": [
"test.ts", "test.ts",
"**/*.spec.ts" "**/*.spec.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
] ]
} }