@nostr-dev-kit/blossom
Version:
Blossom protocol support for NDK (Nostr Development Kit)
38 lines • 1.49 kB
TypeScript
import type NDK from "@nostr-dev-kit/ndk";
import { NDKEvent } from "@nostr-dev-kit/ndk";
/**
* Create a Blossom authorization event according to BUD-01 specification
*
* @param ndk NDK instance
* @param action The action being performed ('upload', 'delete', 'list', 'get')
* @param options Options for the auth event
* @returns Signed authentication event
*/
export declare function createAuthEvent(ndk: NDK, action: "upload" | "delete" | "list" | "get", options?: {
sha256?: string | string[];
content?: string;
expirationSeconds?: number;
}): Promise<NDKEvent>;
/**
* Add authorization headers to a request using base64 encoded event
*
* @param headers Headers object to modify
* @param authEvent Signed authentication event
* @returns Modified headers object
*/
export declare function addAuthHeaders(headers: Record<string, string>, authEvent: NDKEvent): Record<string, string>;
/**
* Create authenticated fetch options with the NDK signer
*
* @param ndk NDK instance
* @param action The action being performed ('upload', 'delete', 'list', 'get')
* @param options Options for the auth event and fetch
* @returns Fetch options with authentication
*/
export declare function createAuthenticatedFetchOptions(ndk: NDK, action: "upload" | "delete" | "list" | "get", options?: {
sha256?: string | string[];
content?: string;
expirationSeconds?: number;
fetchOptions?: RequestInit;
}): Promise<RequestInit>;
//# sourceMappingURL=auth.d.ts.map