burgerauth/static/js/aeskeyshare.js

29 lines
937 B
JavaScript
Raw Normal View History

window.addEventListener("message", function(event) {
2024-04-29 21:18:46 +01:00
const access_token = event.data;
2024-04-29 21:28:18 +01:00
fetch("https://auth.hectabit.org/api/loggedin", {
2024-04-29 21:18:46 +01:00
method: "POST",
body: JSON.stringify({
access_token: access_token
})
2024-04-29 21:18:46 +01:00
})
2024-05-06 18:03:11 +01:00
.then((response) => response)
.then((response) => {
async function doStuff() {
let responseData = await response.json()
if (response.status === 200) {
console.log("Key is valid")
let key = localStorage.getItem("DONOTSHARE-password").concat(responseData["appId"]);
for (let i = 0; i < 128; i++) {
key = await hashwasm.sha3(key)
}
parent.window.postMessage(key, "*")
}
console.log("Alive check!")
2024-04-29 21:18:46 +01:00
}
2024-05-06 18:03:11 +01:00
console.log("Running doStuff")
doStuff();
2024-04-29 21:18:46 +01:00
})
2024-05-06 18:03:11 +01:00
console.log("The script is running!")
});