(feat): enable support for Nostr event deletion (NIP-09) #2374
Ticket(s) / Related Merge Requests
Issue: #2374 (closed)
Summary of Changes
This MR adds support for NIP-09 for deleting Nostr events.
Testing Considerations
- Download and install noscl
- Create a keypair with
noscl key-gen
- Set the private key with
noscl setprivate <key>
- 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)"
- Add the sandbox relay:
noscl relay add wss://relay.minds.io/nostr/v1/ws
- Set a profile name:
noscl metadata --name=<name>
- Create a post:
noscl publish 'Hello, world!'
- take note of the event ID logged by noscl, we will later delete this
- View your post in Minds and on Nostr with:
noscl profile $(noscl public)
-
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:
- You should be able to query for kind 9 events with
REQ
in order for clients to register the post as deleted. - 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.
- 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
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