build NIP-59 seals manually for nip4e interop

This commit is contained in:
2026-10-04 13:27:43 +07:00
parent a8df0df0cd
commit 758ffaf7d9
6 changed files with 127 additions and 15 deletions
+12
View File
@@ -30,6 +30,18 @@
> notification, the requester in the "Wait for approval" notification — so the
> transfer can be verified out of band before approving. Still open: the
> plaintext backup file in section 4.
>
> **Update 4**: Verified against the PsstPsst source (nip17-gift-wrap.ts,
> encryption-key.service.ts) and closed the remaining envelope incompatibility.
> Coop now emits PsstPsst's split-key NIP-59 format when the sender has an
> encryption key: the seal (kind 13) is signed by the identity, the rumor
> content is NIP-44'd under the sender's encryption key, and the seal carries
> the sender's encryption pubkey in an `n` tag; the wrap uses a one-shot
> ephemeral key. Receiving supports both formats: the seal's `n` tag selects
> the content-decryption key, falling back to the seal author for legacy
> unified seals. Interop matrix is now green in all four directions, with one
> caveat: a Coop sender without an encryption key degrades to the legacy
> format, which PsstPsst ignores on its relay intake path.
**Scope**: `crates/nip4e/src/lib.rs` (key announcement/sync), the send path (`crates/chat/src/room.rs`), the receive path (`crates/chat/src/lib.rs`), UI integration (`crates/workspace`), compared against the [NIP-4e draft](https://github.com/nostr-protocol/nips/blob/per-device-keys/4e.md) and [PsstPsst's implementation](https://github.com/CodyTseng/psstpsst) (`docs/protocols/nip4e.md` + `docs/protocols/nip17-extensions.md`, plus rust-nostr's NIP-59 source to verify crypto mechanics).