This commit is contained in:
grant-kun 2022-10-04 15:06:22 -05:00
parent 1d799f67eb
commit d6cb93f137
3 changed files with 66 additions and 1 deletions

55
html/mail.html Normal file
View file

@ -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>

View file

@ -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"
}
}

View file

@ -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