Crate nostr_nostd

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§

errors
Possible errors thrown by this crate
query
Build queries to get events from relays
relay_responses
Handle messages from relays

Structs§

BuildStatus
Used to track the addition of the time created and the number of tags added
FiveTags
Five tags have been added
FourTags
Four tags have been added
Note
Representation of Nostr Note
NoteBuilder
Used to fill in the fields of a Note.
OneTag
One tag has been added
String
A fixed capacity String
ThreeTags
Three tags have been added
TwoTags
Two tags have been added
Vec
A fixed capacity Vec
ZeroTags
No tags have been added

Enums§

ClientMsgKinds
NoteKinds
Defined by the nostr protocol

Traits§

AddTag
Impl for tags which can had an additional tag added. ie, not implemented for FiveTags but implemented for all others
TagCount
Number of tags added