From 780c614263fc4362ff6b590de9bfd4cb50a742ba Mon Sep 17 00:00:00 2001 From: Arzumify Date: Mon, 6 May 2024 18:03:11 +0100 Subject: [PATCH] fixed aeskeyshare --- main.go | 2 +- static/js/aeskeyshare.js | 22 +++++++++++++++++----- templates/aeskeyshare.html | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 98121a6..279d3d7 100644 --- a/main.go +++ b/main.go @@ -739,7 +739,7 @@ func main() { return } - c.JSON(200, gin.H{"success": "true"}) + c.JSON(200, gin.H{"appId": claims["aud"]}) }) router.GET("/api/auth", func(c *gin.Context) { diff --git a/static/js/aeskeyshare.js b/static/js/aeskeyshare.js index 8ae4277..97c13c9 100644 --- a/static/js/aeskeyshare.js +++ b/static/js/aeskeyshare.js @@ -8,10 +8,22 @@ window.addEventListener("message", function(event) { access_token: access_token }) }) - .then((response) => function () { - if (response.status === 200) { - console.log("Key is valid") - window.postMessage(localStorage.getItem("DONOTSHARE-password"), event.origin) + .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!") } + console.log("Running doStuff") + doStuff(); }) -}); \ No newline at end of file + console.log("The script is running!") +}); diff --git a/templates/aeskeyshare.html b/templates/aeskeyshare.html index c4f6f2d..b8f5c0c 100644 --- a/templates/aeskeyshare.html +++ b/templates/aeskeyshare.html @@ -6,6 +6,7 @@ +

Sending key...