summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorrstular <rok@stular.eu>2020-05-14 12:16:08 +0200
committerrstular <rok@stular.eu>2020-05-14 12:16:08 +0200
commit5980e785db7b9897e0605e49fad423ecadd3471a (patch)
tree5f6e37d46cb65bd7d2a6332f7bb2f3b675eeca12 /js
parentAttempt 1 at fixing encryption (diff)
downloadbeziapp-5980e785db7b9897e0605e49fad423ecadd3471a.tar
beziapp-5980e785db7b9897e0605e49fad423ecadd3471a.tar.gz
beziapp-5980e785db7b9897e0605e49fad423ecadd3471a.tar.bz2
beziapp-5980e785db7b9897e0605e49fad423ecadd3471a.tar.lz
beziapp-5980e785db7b9897e0605e49fad423ecadd3471a.tar.xz
beziapp-5980e785db7b9897e0605e49fad423ecadd3471a.tar.zst
beziapp-5980e785db7b9897e0605e49fad423ecadd3471a.zip
Diffstat (limited to 'js')
-rw-r--r--js/messaging.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/js/messaging.js b/js/messaging.js
index a5e5f6c..765f919 100644
--- a/js/messaging.js
+++ b/js/messaging.js
@@ -450,12 +450,15 @@ function setupEventListeners() {
var randomencdivid = Math.floor(Math.random() * 9999).toString().padStart(4, "0");
var addrparts = window.location.href.split("/"); // engleski
+ var encrypted_message = sjcl.encrypt($("#msg-e2ee-pass-input").val(), msgcontent);
+
msgcontent = `
<script src="${addrparts[0]}//${addrparts[2]}/js/lib/sjcl.js"></script>
<div id="beziapp-msg-e2ee-form-${randomencdivid}">
This message was encrypted by BežiApp.
<input type="password" autocomplete="new-password" id="beziapp-msg-e2ee-password-${randomencdivid}" placeholder="Enter password ...">
<input type="button" value="Decrypt" onclick="
+ console.log($('beziapp-msg-e2ee-content-${randomencdivid}').text());
$('#beziapp-msg-e2ee-content-${randomencdivid}').html(
sjcl.decrypt(
$('#beziapp-msg-e2ee-password-${randomencdivid}').val(),
@@ -468,10 +471,14 @@ function setupEventListeners() {
>
</div>
<div id="beziapp-msg-e2ee-content-${randomencdivid}" hidden>
- <!-- beziapp-e2eemsg-${msgcontent.length.toString().padStart(4, "0")} -->${sjcl.encrypt($("#msg-e2ee-pass-input").val(), msgcontent)}<!-- end-msg -->
+ <!-- beziapp-e2eemsg-${msgcontent.length.toString().padStart(4, "0")} -->${encrypted_message}<!-- end-msg -->
</div>
`
- }
+ }
+
+ console.log(msgcontent);
+ console.log(encrypted_message);
+
sendMessage(value[$("#full-name").val()], msgsubject, htmlEncode(msgcontent));
$("#msg-body").val("");
$("#full-name").val("");