Skip to content

(feat): enable support for Nostr event deletion (NIP-09) #2374

Zack Wynne requested to merge feat/nostr-kind-9-2374 into master

Ticket(s) / Related Merge Requests

Issue: #2374 (closed)

Summary of Changes

This MR adds support for NIP-09 for deleting Nostr events.

Testing Considerations

  1. Download and install noscl
  2. Create a keypair with noscl key-gen
  3. Set the private key with noscl setprivate <key>
  4. Whitelist the public key for your account:
kubectl exec -ti $(kubectl get po -l app.minds.io/component=engine -o name) -c php-fpm -- \
  /bin/sh -c "source /vault/secrets/env && php engine/cli.php Nostr whitelist --pubkey=$(noscl public)"
  1. Add the sandbox relay: noscl relay add wss://relay.minds.io/nostr/v1/ws
  2. Set a profile name: noscl metadata --name=<name>
  3. Create a post: noscl publish 'Hello, world!'
    • take note of the event ID logged by noscl, we will later delete this
  4. View your post in Minds and on Nostr with: noscl profile $(noscl public)
  5. noscl doesn't support delete events, so in order to generate a delete event we can use nostril
nostril --envelope --sec $(jq .privatekey -r < ~/.config/nostr/config.json) --kind 9 -e <event_id> |\
  websocat -1 wss://relay.minds.io/nostr/v1/ws

The post should be deleted and no longer visible in Minds or with a Nostr client.

Notes:

  1. You should be able to query for kind 9 events with REQ in order for clients to register the post as deleted.
  2. Only post content and sig is removed in order to keep reply relationships intact. If you delete an event, you should still be able to still view the replies.
  3. You should not receive any response when querying for the deleted event with REQ.

Deployment Considerations

We will need to add the deleted column to the nostr_events table production prior to deploying:

ALTER TABLE nostr_events ADD deleted boolean DEFAULT 0 AFTER sig;

Regression Scope

This should affect querying and saving Nostr events.

Platform Affected (web, mobile, etc)

Web

Developer Testing Completed

Tested the above steps including replies etc.

Screenshots / Screen Recording

simplescreenrecorder.mkv

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode

Definition of Done Checklist

  • The Acceptance Criteria has been met
  • Code is tested: Testing includes unit/spec, E2E/automated and manual testing
  • Merge requests description has been filled out
Edited by Zack Wynne

Merge request reports