Created
April 29, 2018 15:47
-
-
Save ohmpzz/6dfee093cdeb6e6b89ab1c1bf8c207ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| decrypt(data) { | |
| const ciphertext = data.msg | |
| const key = this.chatService.getPasscode | |
| const bytes = CryptoJS.AES.decrypt(ciphertext, key) | |
| const plaintext = bytes.toString(CryptoJS.enc.Utf8) | |
| console.log(data.msg) | |
| console.log(key) | |
| console.log(bytes.toString(CryptoJS.enc.Utf8)) | |
| return {msg: plaintext} | |
| } | |
| encrypt(msg: string) { | |
| const plaintext = msg | |
| const key = this.chatService.getPasscode | |
| const ciphertext = CryptoJS.AES.encrypt(plaintext, key) | |
| console.log(msg) | |
| console.log(key) | |
| return ciphertext.toString() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment