Skip to main content

Module blossom

Module blossom 

Source

Functions§

delete_blob
Delete a blob from a Blossom server. 2xx and 404 both count as success (idempotent: “blob is gone” is the goal). 401/403/5xx and network errors propagate.
delete_blob_by_url
Parse a Blossom blob URL into (origin, hash) and DELETE that blob. Awaitable single-URL variant of delete_blobs_best_effort — caller drives sequencing + per-URL UI feedback.
delete_blobs_best_effort
Fire-and-forget DELETE for each parseable blob URL. Pairs with delete_own_dm so removing a NIP-17 file message also removes the ciphertext from the server it was uploaded to.
hash_swap_candidates
Derive BUD-03 hash-swap candidates: the same content-address on each of servers. Blossom URLs are <origin>/<sha256>[.ext], so any server in the author’s list may serve a blob whose embedded URLs have all died. Servers matching primary_url’s origin (already tried) are skipped.
mirror_blob
BUD-04: ask target_server to mirror the blob at source_url by pulling it server-to-server (the client sends one small JSON request, never the bytes). Authorized by the same hash-scoped upload event as a direct upload. The mirror’s ACK gets the same serve-check as an upload ACK. Returns the mirror’s URL for the blob.
mirror_blob_to_servers
Best-effort BUD-04 fan-out: mirror source_url onto up to max_mirrors of the user’s other servers, concurrently, under one wall-clock budget. Returns only the mirror URLs that verifiably serve — the caller embeds these as NIP-17 / imeta fallback sources. Never fails the send: an empty Vec just means the message ships with no fallbacks.
parse_blob_url
Parse a Blossom blob URL into its server origin and SHA-256 hash (last non-empty path segment, optional .ext stripped).
probe_servers_for_octet_stream
Probe (server, application/octet-stream, encrypted=true) with a 32-byte random blob to learn whether the server accepts the binary uploads Vector produces for chat attachments. Single-shot per (server,mime,encrypted). Successful probes are cleaned up via DELETE.
upload_blob
Simple upload without progress tracking. read_timeout fast-fails a dead server (see build_http_client_with_options); pass it for small uploads (emoji, avatars) so failover is quick, None for large blobs whose server may go quiet mid-store.
upload_blob_with_failover
Upload to multiple Blossom servers with failover, in input order.
upload_blob_with_progress
Upload to a single Blossom server with progress callbacks. retry_count defaults to 0; retry_spacing defaults to 1s.
upload_blob_with_progress_and_failover
Upload with progress + failover, cache-aware routing, and capability learning.
verify_blob_content
Verify a downloaded body against its URL’s content address. Some(true) = bytes match the blob hash, Some(false) = the source served the wrong bytes, None = the URL carries no content address to check.

Type Aliases§

ProgressCallback
Progress callback function type