@Vitor Pamplona @hodlbod I’m having trouble wrapping (no pun intended) my head around the one-time use random keypair used to sign the kind 1059 gift wrap event. If I want to see the NIP-17 DMs that I’ve sent from my client, would I have to keep track of the random keypairs that I’ve used so that I can decrypt the gift wrap content and render them in the future? Alternatively, would I just need to store the seal events locally on my client? Context: I’m adding NIP-17 DM support to Nostr SDK for Apple Platforms and the randomized keypair stuff on the gift wrap confused me.
No, gift wrap DMs get sent to both the sender and the receiver, so you don't need to keep track of all the ephemeral keys
Oh, that’s right. I forgot about that. Sign the gift wrap from your random key and send it to yourself at the real key (or alias key). Which should be a different random key than the one used to sign the gift wrap that goes to the receiver (or their alias key). Got it. Thanks!
yep, sender and receiver have separate wraps, signed with different keys. Each side can delete their copy of the message anytime they want without affecting the other side.
Anyone implementing or testing nip17 may find this command line tool helpful. It can be used with NAK to send/receive nip17 messages to/from a relay with auth(optional). cc nostr:nprofile1qqsglv2qkn5dmmuhee9cy8fywfu2rfp4xd3xy0myqg2gfvmjl9yqqrqppamhxue69uhk2tnwdaejumr0dsq3qamnwvaz7tmwdaehgu3wd3skueqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduekf372 github.com/jeremyd/nip17pipe
I needed to construct one in TS and send it off, so probably wouldn’t help. I’ll donate some code example which I posted here earlier, to the nip repo
ya i think i saw you mention, no way to know if it sent properly. this tool can show the wraps youve sent is all.. maybe it speeds up your testing
Maybe this would be helpful: https://github.com/coracle-social/welshman/blob/master/packages/signer/src/nip59.ts
It would have been yesterday 😂🤣🫂
What about for the seal event? If I'm the sender of a message, the copy of the message that is sent to myself will contain a seal event with my pubkey set as the event pubkey. The seal content is then unencryptable on my side since I have no information on who I previously communicated with and can't calculate the conversation key (at least with nostr-tools). Would I just have to save a local state in that case, or am I thinking about the spec wrong? Currently working on finishing up NIP-17 integration on nostr:nprofile1qqs2xugc5jyguqkj36rk0syv4tmnkjdtmtperttl7x9rqjy3ustdcvcppemhxue69uhkummn9ekx7mp0qy2hwumn8ghj7un9d3shjtnyv9kh2uewd9hj7qg6waehxw309aek2mnyd96zumn0wdnxcctjv5hxxmmd9uxa0uz8.
If you’re the sender and you send the copy to yourself, you are both the sender and the receiver. You would unseal with your private key, which would reveal the kind 14 DM rumor (unsigned DM) which has the p-tag(s) of the actual receivers.
Ahh, that finally makes sense; thank you!
This is the best developer support group; single-handedly cleared up all the confusion about these DM and encryption NIPs. I feel like we’re getting some momentum to hopefully move most of the popular clients onto NIP-17 DMs and away from NIP-04 DMs in the medium-term. I’m very curious for scoping out the effort to have Damus onboarded.
The dev support group is the killer app... 😅
At @nos.social we did some similar work on top of your library for a probably incomplete version of Nip-17 but it may be useful anyways https://github.com/planetary-social/nos/blob/aebbcb7353ec5cc34584bc3c802ddb6b754cb6ad/Nos/Service/GiftWrapper.swift