Blossom tools
Store pictures, media and other files on Blossom servers, then download them back to check they were saved correctly.
Try it in context: Read the guide.
import { Blossom } from '@chaoticka/nsite-loopy-sdk';
What you can call (4)
blossomAuthHeader
Turn an approved Blossom authorization event into the HTTP header sent to storage.
Call it as: Blossom.blossomAuthHeader
For developers: TypeScript signature
function blossomAuthHeader(event:SignedEvent):string;
Code location: src/blossom/client.js
blossomUploadAuth
Prepare a short-lived upload permission request for the signer.
Call it as: Blossom.blossomUploadAuth
For developers: TypeScript signature
function blossomUploadAuth(options:{hash:Hex;server:string;expiresIn?:number;now?:number}):UnsignedEvent;
Code location: src/blossom/client.js
fetchVerified
Download a file from Blossom servers and accept it only if its hash matches.
Call it as: Blossom.fetchVerified
For developers: TypeScript signature
function fetchVerified(hash:Hex,options:{servers:string[];fetcher?:typeof fetch;signal?:AbortSignal}):Promise<{server:string;data:Uint8Array;hash:Hex}>;
Code location: src/blossom/client.js
uploadVerified
Upload a file to Blossom, fetch it back and verify the exact bytes.
Call it as: Blossom.uploadVerified
For developers: TypeScript signature
function uploadVerified(data:string|Uint8Array,options:{server:string;signer:Signer;pubkey:Hex;path?:string;fetcher?:typeof fetch;signal?:AbortSignal}):Promise<{hash:Hex;size:number;server:string;verified:true;url:string}>;
Code location: src/blossom/client.js