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

Structs

Enums

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