Expand description
Blossom protocol client for hashtree
Provides upload/download of blobs to Blossom servers with NIP-98 authentication.
§Example
use hashtree_blossom::BlossomClient;
use nostr::Keys;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let keys = Keys::generate();
let client = BlossomClient::new(keys)
.with_servers(vec!["https://blossom.example.com".to_string()]);
// Upload
let hash = client.upload(b"hello world").await?;
println!("Uploaded: {}", hash);
// Download
let data = client.download(&hash).await?;
assert_eq!(data, b"hello world");
Ok(())
}Structs§
- Blossom
Client - Blossom protocol client
Enums§
Functions§
- compute_
sha256 - Compute SHA256 hash of data, returning hex string