-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nostr: add NIP-35 support #683
Conversation
83ec494
to
b22d0a3
Compare
- Added `Torrent` and `TorrentFile` structs to represent torrent metadata and files. - Implemented `to_event_builder` method for `Torrent` to convert metadata into a Nostr event. - Added `TorrentComment` struct to represent comments on torrent events. - Implemented `to_event_builder` method for `TorrentComment` to convert comments into a Nostr event. ```rust use nostr::nips::nip35::{Torrent, TorrentFile, TorrentComment}; use nostr::{EventBuilder, EventId, RelayUrl}; // Create a Torrent instance let torrent = Torrent { title: "Example Torrent".to_string(), description: "This is an example torrent.".to_string(), info_hash: "abcdef1234567890".to_string(), files: vec![ TorrentFile { name: "file1.txt".to_string(), size: 1024, }, TorrentFile { name: "file2.txt".to_string(), size: 2048, }, ], trackers: vec!["http://tracker.example.com".to_string()], categories: vec!["video".to_string(), "movie".to_string()], hashtags: vec!["example".to_string()], }; // Convert to Nostr event let event_builder = torrent.to_event_builder(); // Create a TorrentComment instance let comment = TorrentComment { torrent_event: EventId::new(), content: "This is a comment.".to_string(), relay_url: Some(RelayUrl::new("http://relay.example.com")), }; ``` This commit adds support for sharing BitTorrent metadata and comments through Nostr events, as specified in [NIP-35](https://github.com/nostr-protocol/nips/blob/master/35.md).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I flagged some changes to do.
In the review I missed a thing. Can you add this like to the pub use crate::nips::nip35::{self, *}; |
Thanks! During the cherry-picking I've fixed some missing thing and the torrent event building (the tags were wrong but I didn't noticed in the last review). Cherry-picked and squashed at af36bba |
Thank you for taking the time to do such a thorough review! 🚀 |
Adds support for NIP35 (BitTorrent metadata)
Torrent
andTorrentFile
structs to represent torrent metadata and files.to_event_builder
method forTorrent
to convert metadata into a Nostr event.TorrentComment
struct to represent comments on torrent events.to_event_builder
method forTorrentComment
to convert comments into a Nostr event.This commit adds support for sharing BitTorrent metadata and comments through Nostr events, as specified in NIP-35.