Allow anonymous session actors when checking login state

This commit is contained in:
thePR0M3TH3AN committed 2025-10-27 16:08:13 -04:00
1 parent f6a3e8b2ae
commit 7985a481a4
2 files changed
+45 -9

No files matched your search

+18 -4
View File
@@ -3499,11 +3499,25 @@ class Application {
return false;
}
const sessionActorPubkey = this.normalizeHexPubkey(
nostrClient?.sessionActor?.pubkey,
);
const sessionActor = nostrClient?.sessionActor || null;
const sessionActorPubkey = this.normalizeHexPubkey(sessionActor?.pubkey);
if (sessionActorPubkey && sessionActorPubkey !== normalizedPubkey) {
return false;
const rawPrivateKey =
typeof sessionActor?.privateKey === "string"
? sessionActor.privateKey.trim()
: "";
const hasEmbeddedPrivateKey =
rawPrivateKey.length > 0 && HEX64_REGEX.test(rawPrivateKey);
const declaredSource =
typeof sessionActor?.source === "string"
? sessionActor.source.trim()
: "";
const isPersisted = sessionActor?.persisted === true;
if (!hasEmbeddedPrivateKey || declaredSource || isPersisted) {
return false;
}
}
return true;