You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NIP-09 Allows clients to send a kind 5 event to delete events from storage within the relay.
Example kind 5 event:
{
"kind": 5,
"pubkey": <32-bytes hex-encoded public key of the event creator>,
"tags": [
["e", "dcd59..464a2"],
["e", "968c5..ad7a4"],
["a", "<kind>:<pubkey>:<d-identifier>"]
],
"content": "these posts were published by accident",
...other fields
}
User Story
As any user I want to send a kind 5 event to a relay and have that event deleted from the relay's database. The relay should also store the kind 5 event for future reference
Considerations
Although the spec only indicated that the pubkey from the kind 5 event should match the pubkey for the events to be deleted, I would like to actually verify the validity of the event using a method like below:
Was previously implemented in Nostpy for all events added link
async def verify_signature(event_id: str, pubkey: str, sig: str) -> bool:
try:
pub_key: secp256k1.PublicKey = secp256k1.PublicKey(bytes.fromhex("02" + pubkey), True)
result: bool = pub_key.schnorr_verify(bytes.fromhex(event_id), bytes.fromhex(sig), None, raw=True)
if result:
logger.info(f"Verification successful for event: {event_id}")
else:
logger.error(f"Verification failed for event: {event_id}")
return result
except (ValueError, TypeError, secp256k1.Error) as e:
logger.error(f"Error verifying signature for event {event_id}: {e}")
return False
TO DO
Update event_handler service dependencies to include secp256k1
Update handle_new_event to check for kind 5
Update Event class to include method/s that:
Validates kind 5 event
Constructs DELETE statement
Executes DELETE statement
Replies to client with OK message indicating if the request was successful:
Ex ["OK", "b1a649ebe8...", true, ""]
The text was updated successfully, but these errors were encountered:
Background
NIP-09 Allows clients to send a
kind 5
event to delete events from storage within the relay.Example
kind 5
event:User Story
As any user I want to send a
kind 5
event to a relay and have that event deleted from the relay's database. The relay should also store thekind 5
event for future referenceConsiderations
Although the spec only indicated that the
pubkey
from thekind 5
event should match thepubkey
for the events to be deleted, I would like to actually verify the validity of the event using a method like below:TO DO
event_handler
service dependencies to includesecp256k1
handle_new_event
to check forkind 5
Event
class to include method/s that:kind 5
eventDELETE
statementDELETE
statementOK
message indicating if the request was successful:["OK", "b1a649ebe8...", true, ""]
The text was updated successfully, but these errors were encountered: