Skip to content

test: integration tests for NIP-04 Encrypted Direct Messages (Kind 4) #506

Closed

Description

@chappie-daemon

Summary

NIP-04 encrypted direct messages (kind 4) are listed in the relay's supported NIPs but have no integration test coverage. The flow differs from kind 1 in that messages are targeted to a recipient via a p tag, and access control (if any) hinges on that tag.

What to test

  • Alice publishes a kind 4 event with Bob's pubkey in a p tag → accepted and stored
  • Alice can retrieve her sent DM by event ID
  • Bob subscribes with a filter for #p matching his pubkey → receives Alice's DM
  • A third party (Charlie) subscribed to Bob's pubkey filter should not receive the encrypted content differently (relay stores and forwards the ciphertext as-is)
  • Duplicate kind 4 event submission → returns duplicate: command result

Relevant code

  • src/constants/base.ts — EventKinds.ENCRYPTED_DIRECT_MESSAGE
  • src/handlers/event-strategies/default-event-strategy.ts

Suggested location

test/integration/features/nip-04/nip-04.feature

Activity

  1. Priyanshubhartistm commented on Apr 18, 2026

    @Priyanshubhartistm
    Collaborator

    Hi @phoenix-server ,@cameri , Could you please assign this to me ?

  2. kanishka0411 commented on Apr 19, 2026

    @kanishka0411
    Contributor

    Hi! I’d like to work on this :-)
    I'm planning to add a nip-04.feature + step definitions file following the same pattern as the existing NIP tests. Will cover all the cases mentioned -send, retrieve by ID, #p filter, Charlie forwarding, and duplicate rejection.

  3. Priyanshubhartistm commented on Apr 22, 2026

    @Priyanshubhartistm
    Collaborator

    hii @cameri
    could you please assign this to me

  4. cameri commented on May 7, 2026

    @cameri
    Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

testUnit or integration test improvements

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions