nostr-dm-magiclink-utils
Version:
A comprehensive Nostr utility library for magic link authentication via direct messages, supporting both ESM and CommonJS. Features NIP-01/04 compliant message encryption, multi-relay support, internationalization (i18n) with RTL support, and TypeScript-f
32 lines • 1.3 kB
TypeScript
import { NostrEvent } from './nostr.js';
import type { SendMagicLinkOptions, MagicLinkResponse, NostrMagicLinkConfig } from './config.js';
export interface NostrServiceInterface {
/** Connect to the Nostr relay */
connect(): Promise<void>;
/** Disconnect from the Nostr relay */
disconnect(): Promise<void>;
/** Send a direct message to a public key */
sendDirectMessage(pubkey: string, content: string): Promise<NostrEvent>;
/** Get the current connection status */
getStatus(): {
connected: boolean;
error?: string;
};
/** Add a new relay at runtime */
addRelay(url: string): Promise<void>;
/** Remove a relay at runtime */
removeRelay(url: string): Promise<void>;
}
export interface MagicLinkServiceInterface {
/** Send a magic link via DM */
sendMagicLink(options: SendMagicLinkOptions): Promise<MagicLinkResponse>;
/** Verify a magic link token */
verifyMagicLink(token: string): Promise<string | null>;
}
export interface NostrMagicLinkInterface {
/** Initialize the service with configuration */
init(config: NostrMagicLinkConfig): Promise<void>;
/** Send a magic link via DM */
sendMagicLink(options: SendMagicLinkOptions): Promise<MagicLinkResponse>;
}
//# sourceMappingURL=service.d.ts.map