mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 21:02:28 +00:00
Allow anonymous session actors when checking login state
This commit is contained in:
1 parent
f6a3e8b2ae
commit
7985a481a4
2 files changed
+45
-9
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user