diff --git a/chatto/src/main/javascript/ts/src/dto/ChatMessageDTO.ts b/chatto/src/main/javascript/ts/src/dto/ChatMessageDTO.ts index 90b1041..01e39ff 100644 --- a/chatto/src/main/javascript/ts/src/dto/ChatMessageDTO.ts +++ b/chatto/src/main/javascript/ts/src/dto/ChatMessageDTO.ts @@ -4,5 +4,5 @@ export class ChatMessageDTO { public toUser: string | undefined; public fromUser: string | undefined; public messageCipher!: MessageCipherDTO; - public messageTime!: Date; + public messageTime: Date | undefined | null; } \ No newline at end of file diff --git a/chatto/src/main/javascript/ts/src/main.ts b/chatto/src/main/javascript/ts/src/main.ts index 8f27533..efe0fcd 100644 --- a/chatto/src/main/javascript/ts/src/main.ts +++ b/chatto/src/main/javascript/ts/src/main.ts @@ -8,7 +8,6 @@ import { ModelFactory } from "./model/ModelFactory"; import { ActiveUserViewModel } from "./viewmodel/ActiveUserViewModel"; import { ChatMessageViewModel } from "./viewmodel/ChatMessageViewModel"; import * as Handlebars from "handlebars"; -import markdownit = require('markdown-it'); import { ChatModel } from "./model/ChatModel"; import { ChatView } from "./view/ChatView"; import { ChatController } from "./controller/ChatController"; @@ -18,8 +17,9 @@ import * as log from 'loglevel'; // import log from 'loglevel'; import { EncryptionService } from "./service/EncryptionService"; import { SJCLEncryptionService } from "./service/SJCLEncryptionService"; +import { MessageCipherDTO } from "./dto/MessageCipherDTO"; // var markdownit = require('markdown-it'); -var md = new markdownit(); +// var md = new markdownit(); const userBox = document.getElementById('contacts-box'); @@ -72,8 +72,8 @@ var msgContainerTemplate = Handlebars.compile(source); JsonAPI.ACTIVE_USERS_GET + 'aef'; const encryptionService: EncryptionService = new SJCLEncryptionService(); -let ct = encryptionService.encrypt("password","data"); -console.log(encryptionService.decrypt("password", JSON.parse(ct as string))); +let messageCipherDTO: MessageCipherDTO = encryptionService.encrypt("password","data"); +console.log(encryptionService.decrypt("password", messageCipherDTO)); Handlebars.registerHelper('avatar', function() { return '