Crate nostr_nostd
source ·Expand description
Implementation of Nostr for a #![no_std] environment. It supports note creation and parsing relay responses. An example project using an esp32 can be seen here.
Example
use nostr_nostd::{Note, String, ClientMsgKinds};
let privkey = "a5084b35a58e3e1a26f5efb46cb9dbada73191526aa6d11bccb590cbeb2d8fa3";
let content: String<400> = String::from("Hello, World!");
let tag: String<150> = String::from("relay,wss://relay.example.com/");
// aux_rand should be generated from a random number generator
// required to keep PRIVKEY secure with Schnorr signatures
let aux_rand = [0; 32];
let note = Note::new_builder(privkey)
.unwrap()
.content(content)
.add_tag(tag)
.build(1686880020, aux_rand)
.unwrap();
let msg = note.serialize_to_relay(ClientMsgKinds::Event);
Modules
- Possible errors thrown by this crate
- Build queries to get events from relays
- Handle messages from relays
Structs
- Used to track the addition of the time created and the number of tags added
- Five tags have been added
- Four tags have been added
- Representation of Nostr Note
- Used to fill in the fields of a Note.
- One tag has been added
- A fixed capacity
String
- Three tags have been added
- Two tags have been added
- A fixed capacity
Vec
- No tags have been added
Enums
- Defined by the nostr protocol
Traits
- Impl for tags which can had an additional tag added. ie, not implemented for FiveTags but implemented for all others
- Number of tags added