enhance simple e2ee

This commit is contained in:
Mystikfluu 2022-08-19 19:51:08 +02:00
parent 30ddffd83d
commit e567e04133

View File

@ -52,6 +52,8 @@ function set_keys(s_key) {
}) })
encryption_keys = packed encryption_keys = packed
main()
} }
async function postMessage() { async function postMessage() {
@ -66,7 +68,7 @@ async function postMessage() {
let text = document.getElementById("post-text").value let text = document.getElementById("post-text").value
if(typeof encrypt == "function" && encryption_keys != "") { if(typeof encrypt == "function" && encryption_keys != "") {
text = encrypt(test,{ text = encrypt(text,{
packed: encryption_keys packed: encryption_keys
}) })
} }
@ -245,6 +247,9 @@ async function createPost(username,text,time,specialtext,postid,isbot,reply_id,a
} }
} }
if(typeof decrypt == "function" && encryption_keys != "") {
text = decrypt(text,{packed:encryption_keys})
}
newDiv.appendChild(newP) newDiv.appendChild(newP)
newDiv.innerHTML += filterPost(text) newDiv.innerHTML += filterPost(text)
newDiv.id = postid newDiv.id = postid