feat(privacy): add per-account toggle to disable NIP-89 client tag
Adds a "Don't add client tag to my events" switch under Security Filters. NostrSignerWithClientTag now consults a runtime predicate at sign-time, so the toggle takes effect immediately on the live session without rewrapping the signer or rebuilding Account. https://claude.ai/code/session_01KhNVTm8LLdVphqyxVkZtDS
This commit is contained in:
+13
-1
@@ -40,12 +40,19 @@ import com.vitorpamplona.quartz.nip57Zaps.LnZapRequestEvent
|
||||
class NostrSignerWithClientTag(
|
||||
val inner: NostrSigner,
|
||||
val clientTag: Array<String>,
|
||||
val disabled: () -> Boolean = { false },
|
||||
) : NostrSigner(inner.pubKey) {
|
||||
constructor(
|
||||
inner: NostrSigner,
|
||||
clientName: String,
|
||||
) : this(inner, ClientTag.assemble(clientName))
|
||||
|
||||
constructor(
|
||||
inner: NostrSigner,
|
||||
clientName: String,
|
||||
disabled: () -> Boolean,
|
||||
) : this(inner, ClientTag.assemble(clientName), disabled)
|
||||
|
||||
constructor(
|
||||
inner: NostrSigner,
|
||||
clientName: String,
|
||||
@@ -60,7 +67,12 @@ class NostrSignerWithClientTag(
|
||||
kind: Int,
|
||||
tags: Array<Array<String>>,
|
||||
content: String,
|
||||
): T = inner.sign(createdAt, kind, appendClientTag(tags), content)
|
||||
): T =
|
||||
if (disabled()) {
|
||||
inner.sign(createdAt, kind, tags, content)
|
||||
} else {
|
||||
inner.sign(createdAt, kind, appendClientTag(tags), content)
|
||||
}
|
||||
|
||||
override suspend fun nip04Encrypt(
|
||||
plaintext: String,
|
||||
|
||||
Reference in New Issue
Block a user