feat: add NIP-89 client tag to all signed events via NostrSignerWithClientTag decorator
Introduces a signer decorator that automatically appends the NIP-89 client tag to every event before signing, ensuring all events carry client identification without modifying individual event creation sites. Works transparently with internal, external (NIP-55), and remote (NIP-46) signers. https://claude.ai/code/session_01WRtuk1ySCfqXzfFrieKsDs
This commit is contained in:
+6
-1
@@ -31,6 +31,7 @@ import com.vitorpamplona.amethyst.desktop.network.RelayConnectionManager
|
||||
import com.vitorpamplona.amethyst.desktop.ui.chats.DmSendTracker
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.EventTemplate
|
||||
import com.vitorpamplona.quartz.nip01Core.signers.NostrSigner
|
||||
import com.vitorpamplona.quartz.nip89AppHandlers.clientTag.NostrSignerWithClientTag
|
||||
import com.vitorpamplona.quartz.nip04Dm.messages.PrivateDmEvent
|
||||
import com.vitorpamplona.quartz.nip17Dm.NIP17Factory
|
||||
import com.vitorpamplona.quartz.nip17Dm.files.ChatMessageEncryptedFileHeaderEvent
|
||||
@@ -62,7 +63,7 @@ class DesktopIAccount(
|
||||
val dmSendTracker: DmSendTracker,
|
||||
private val scope: CoroutineScope,
|
||||
) : IAccount {
|
||||
override val signer: NostrSigner = accountState.signer
|
||||
override val signer: NostrSigner = NostrSignerWithClientTag(accountState.signer, CLIENT_TAG_NAME)
|
||||
|
||||
override val pubKey: String = accountState.pubKeyHex
|
||||
|
||||
@@ -221,4 +222,8 @@ class DesktopIAccount(
|
||||
}
|
||||
chatroomList.addMessage(roomKey, note)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val CLIENT_TAG_NAME = "Amethyst"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user