diff options
-rw-r--r-- | html/mail.html | 55 | ||||
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | readme.md | 9 |
3 files changed, 66 insertions, 1 deletions
diff --git a/html/mail.html b/html/mail.html new file mode 100644 index 0000000..2aad8ab --- /dev/null +++ b/html/mail.html @@ -0,0 +1,55 @@ +<html> + +<head> + <title>mail</title> +</head> + +<body> + <script> + function sendenc(location, content) { + var xhr = new XMLHttpRequest(); + xhr.open("POST", window.location.href + location, true); + xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.onreadystatechange = function () { + if (xhr.readyState == XMLHttpRequest.DONE) { + pub = kekw.decrypt(JSON.parse(xhr.responseText).data); + return pub + } + } + let out = {} + Object.assign(out, { json: true, enc: false }, { data: nodersa(pub, 'pkcs8-public').encrypt(content, { date: new Date() }, 'base64') }) + xhr.send(JSON.stringify(out)) + } + function sendnoenc(location, content) { + var promise = new Promise((resolve, reject) => { + var xhr = new XMLHttpRequest(); + xhr.open("POST", window.location.href + location, true); + xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.onreadystatechange = function () { + if (xhr.readyState == XMLHttpRequest.DONE) { + resolve(xhr.responseText); + } + } + let out = {} + Object.assign(out, { json: true, enc: false }, content) + xhr.send(JSON.stringify(out)) + }) + return (promise) + } + document.onkeypress = function (key) { + key = key || window.event; + if (key.key == "Enter") { + submit() + } + }; + function update() { + console.log('hi') + sendnoenc('', { 'user': 'root', 'pass': 'password' }).then(res => { + console.log(res) + }) + } + </script> +</body> +<button onclick="update()">update mail</button> + +</html>
\ No newline at end of file diff --git a/package.json b/package.json index 7ba7de8..23375d7 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,8 @@ "fs": "^0.0.1-security", "ip": "^1.1.8", "node-rsa": "^1.1.1" + }, + "devDependencies": { + "emailjs-imap-client": "^3.1.0" } } @@ -1,6 +1,8 @@ # kanna -security project to learn client and server encryption +because the internet needs rewriting + +security project to ~~learn client and server encryption~~ mail & advanced requests create generic keys `openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./selfsigned.key -out selfsigned.crt` @@ -22,3 +24,8 @@ visit the [main git](https://git.disroot.org/grantsquires/kanna-site) or the [gi - [ ] login - [ ] performance related - [ ] store all listeners in array and kill + +## currently + +- [ ] learning how mail works +- [ ] imap cli |