mirror of
https://github.com/aljazceru/nsecbunkerd.git
synced 2025-12-17 06:04:22 +01:00
13 lines
555 B
TypeScript
13 lines
555 B
TypeScript
import { NDKNip46Backend } from "@nostr-dev-kit/ndk";
|
|
import { IEventHandlingStrategy } from '@nostr-dev-kit/ndk/lib/src/signers/nip46/backend';
|
|
|
|
export default class PublishEventHandlingStrategy implements IEventHandlingStrategy {
|
|
async handle(backend: NDKNip46Backend, remotePubkey: string, params: string[]): Promise<string|undefined> {
|
|
const event = await backend.signEvent(remotePubkey, params);
|
|
if (!event) return undefined;
|
|
|
|
backend.ndk.publish(event);
|
|
|
|
return JSON.stringify(await event.toNostrEvent());
|
|
}
|
|
} |