Add Damus client tag emission

- Add ClientTagMetadata struct with parsing helpers and documentation
- Append Damus client tags when posting across app, share, and drafts flows
- Gate the behavior behind a new publish_client_tag setting (default on)

Changelog-Added: Add client tag to published events to identify Damus
Ref: https://github.com/damus-io/damus/issues/3323
Signed-off-by: alltheseas <alltheseas@users.noreply.github.com>
This commit is contained in:
alltheseas
2026-02-02 12:15:11 -06:00
committed by Daniel D’Aquino
parent 795fce1b65
commit ec28822451
11 changed files with 126 additions and 11 deletions

View File

@@ -40,4 +40,18 @@ final class NostrEventTests: XCTestCase {
let urlInContent2 = "https://cdn.nostr.build/i/5c1d3296f66c2630131bf123106486aeaf051ed8466031c0e0532d70b33cddb2.jpg"
XCTAssert(testEvent2.content.contains(urlInContent2), "Issue parsing event. Expected to see '\(urlInContent2)' inside \(testEvent2.content)")
}
func testClientTagParsing() {
let tags = [["client", "Custom Client", "addr", "wss://relay.example"], ["p", test_pubkey.hex()]]
let event = NostrEvent(content: "hi", keypair: test_keypair, kind: 1, tags: tags)!
let metadata = event.clientTag
XCTAssertEqual(metadata?.name, "Custom Client")
XCTAssertEqual(metadata?.handlerAddress, "addr")
XCTAssertEqual(metadata?.relayHint, "wss://relay.example")
}
func testClientTagNilWhenMissing() {
let event = NostrEvent(content: "hi", keypair: test_keypair, kind: 1, tags: [])!
XCTAssertNil(event.clientTag)
}
}