nostr-protocol / nips

Nostr Implementation Possibilities
2.39k stars 582 forks source link

Add explicit support for address quotes #1558

Closed staab closed 3 weeks ago

staab commented 3 weeks ago

If a naddr is added to a note's content, it should be referred to in the tags. But using an a tag will cause the quote to be treated as a reply (as used to happen with events). In some cases, using a q tag with the event's id rather than address may work, but it goes against user intention, and it may not always be possible to convert an address to an id if the event is not loaded by the client. Adding an address variant to q tags fixes this.

Related conversation: https://github.com/cesardeazevedo/nostr-editor/pull/8

vitorpamplona commented 3 weeks ago

Ack

fiatjaf commented 3 weeks ago

Looks good to me.

SnowCait commented 3 weeks ago

Is this a breaking change? I think e tag and a tag should be distinguished to parse. If the tags are the same name, they cannot be parsed correctly. Please use Q or another tag name. (I'm in favor of supporting the address.)

["q", <32-bytes lowercase hex of the id of another event>, <relay-url>]
["q", <kind integer>:<32-bytes lowercase hex of a pubkey>:<d tag value>, <relay-url>]
staab commented 3 weeks ago

I think e tag and a tag should be distinguished to parse.

Clients still have to be defensive, and it's easy to tell an address from an event. I believe we do this overloading elsewhere and it's ok. But I'm open to using Q instead.

Also, sorry about merging so quickly, I thought it had been 24 hours. Today has been a long day.

AsaiToshiya commented 3 weeks ago

reverted

mikedilger commented 3 weeks ago

Yes this is a breaking change.

Gossip currently pushes an "a" tag with the third field being "mention". You can complain about how wrong you think that is with plenty of logical justification, but that used to be right. That was what the NIPs said to do at some time in the past.

staab commented 3 weeks ago

The same was true of e tags, and both should still work, but it is ambiguous because both 3-deep replies and mentions will have mention tags, but with different meanings. For compatibility quotes should probably include both, but use of q clarifies what is intended.