Upload and recover pictures or files
Blossom is file storage for Nostr apps. Loopy can find your preferred storage servers, upload an approved file and check that the downloaded copy has exactly the same bytes.
Discover preferred servers
const { servers } = await Nostr.discoverBlossom(pubkey, {
bootstrap: bootstrapRelays,
query: Nostr.queryRelay,
});
This reads a signed kind: 10063 server list when available. Keep a user-approved fallback when no valid list exists.
Upload and verify exact bytes
const uploaded = await Blossom.uploadVerified(imageBytes, {
server: approvedBlossomServer,
signer,
pubkey,
path: 'photo.png',
});
if (!uploaded.verified) throw new Error('Upload unverified');
The implementation produces a signed kind: 24242 authorization, uploads to /upload, validates the descriptor and fetches by hash to compare actual bytes. Blossom.fetchVerified(hash, { servers }) checks fallback servers in order.
Do not describe an upload as successful based only on a 200 response without the integrity check. Blossom API.