nostr-deploy-server
Version:
Node.js server for hosting static websites under npub subdomains using Nostr protocol and Blossom servers
59 lines • 1.72 kB
TypeScript
import 'websocket-polyfill';
import { PubkeyResolution } from '../types';
export declare class NostrHelper {
private pool;
private config;
private connections;
private cleanupInterval;
constructor();
/**
* Ensure connection to a relay is established and keep it alive
*/
private ensureConnection;
/**
* Clean up stale connections that haven't been used for over an hour
*/
private cleanupStaleConnections;
/**
* Get active connections for the specified relays, establishing new ones if needed
* Prioritizes relays by reliability for faster responses
*/
private getActiveRelays;
/**
* Resolve npub subdomain to pubkey
*/
resolvePubkey(hostname: string): PubkeyResolution;
/**
* Get relay list for a pubkey (NIP-65)
*/
getRelayList(pubkey: string): Promise<string[]>;
/**
* Get Blossom server list for a pubkey (BUD-03)
*/
getBlossomServers(pubkey: string): Promise<string[]>;
/**
* Get static file mapping for a specific path (kind 34128)
*/
getStaticFileMapping(pubkey: string, path: string): Promise<string | null>;
/**
* Query multiple relays with timeout using persistent connections
* Optimized for fast responses - terminates early when events are found
*/
private queryRelays;
/**
* Close connections to specific relays
*/
private closeConnections;
/**
* Close all connections and cleanup
*/
closeAllConnections(): void;
/**
* Get connection statistics
*/
getStats(): {
activeConnections: number;
connectedRelays: string[];
};
}
//# sourceMappingURL=nostr.d.ts.map