aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrant-kun <[email protected]>2022-10-04 15:06:22 -0500
committergrant-kun <[email protected]>2022-10-04 15:06:22 -0500
commitd6cb93f137ef669a1727d29d15426582baae4e97 (patch)
treeafb49ce3ea286402479c3100eb3077189240e539
parent1d799f67eb394048e4ac39cd1dec999e2c0ebb5c (diff)
fixed
-rw-r--r--html/mail.html55
-rw-r--r--package.json3
-rw-r--r--readme.md9
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"
}
}
diff --git a/readme.md b/readme.md
index 15c29b5..d9af631 100644
--- a/readme.md
+++ b/readme.md
@@ -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