Skip to main content

Crate hashtree_blossom

Crate hashtree_blossom 

Source
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§

BatchUploadItem
BatchUploadResult
BlossomClient
Blossom protocol client

Enums§

BlobAvailability
Result of probing a blob’s presence on one Blossom server.
BlossomError

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