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§
- Batch
Upload Item - Batch
Upload Result - Blossom
Client - Blossom protocol client
Enums§
- Blob
Availability - Result of probing a blob’s presence on one Blossom server.
- Blossom
Error
Constants§
- BATCH_
UPLOAD_ BINARY_ CONTENT_ TYPE - BATCH_
UPLOAD_ HASH_ LIST_ AUTH_ TAG - BATCH_
UPLOAD_ MAX_ BLOBS - BATCH_
UPLOAD_ MAX_ BYTES
Functions§
- batch_
upload_ hash_ list_ digest - Return the compact authorization digest for an ordered batch upload hash list.
- compute_
sha256 - Compute SHA256 hash of data, returning hex string