From 7da58d79a047bc69476251da4e2f88385813769a Mon Sep 17 00:00:00 2001 From: Brett <27568879+BrettCleary@users.noreply.github.com> Date: Thu, 19 Dec 2024 00:34:32 -0800 Subject: [PATCH] [Fix] SIWE check in packaged app (#1199) * check * update debug log * fix domain and origin for siwe request, rm debug logs --- src/backend/storeManagers/hyperplay/games.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/backend/storeManagers/hyperplay/games.ts b/src/backend/storeManagers/hyperplay/games.ts index 85c9e888c..bf9e7e122 100644 --- a/src/backend/storeManagers/hyperplay/games.ts +++ b/src/backend/storeManagers/hyperplay/games.ts @@ -1404,10 +1404,13 @@ async function createSiweMessage(signerAddress: string): Promise { throw 'could not get main window url' } const url = new URL(mainWindowUrl) - const domain = url.host ? url.host : 'hyperplay' - const origin = url.origin.startsWith('file://') - ? 'file://hyperplay' - : url.origin + let domain = url.host + let origin = url.origin + // host is empty string and origin is null on the artifact + if (url.protocol === 'file:') { + domain = 'hyperplay' + origin = 'file://hyperplay' + } const statementRes = await fetch( DEV_PORTAL_URL + 'api/v1/license_contracts/validate/get-nonce'