mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-07-16 23:32:23 +02:00
use finishEvent instead of signEvent
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import { DraftNostrEvent, NostrEvent } from "../types/nostr-event";
|
import { DraftNostrEvent, NostrEvent } from "../types/nostr-event";
|
||||||
import { Account } from "./account";
|
import { Account } from "./account";
|
||||||
import db from "./db";
|
import db from "./db";
|
||||||
import { nip04, signEvent, getEventHash, getPublicKey } from "nostr-tools";
|
import { nip04, getPublicKey, finishEvent } from "nostr-tools";
|
||||||
|
|
||||||
const decryptedKeys = new Map<string, string>();
|
const decryptedKeys = new Map<string, string>();
|
||||||
|
|
||||||
@ -85,12 +85,7 @@ class SigningService {
|
|||||||
} else if (account?.secKey) {
|
} else if (account?.secKey) {
|
||||||
const secKey = await this.decryptSecKey(account);
|
const secKey = await this.decryptSecKey(account);
|
||||||
const tmpDraft = { ...draft, pubkey: getPublicKey(secKey) };
|
const tmpDraft = { ...draft, pubkey: getPublicKey(secKey) };
|
||||||
const signature = signEvent(tmpDraft, secKey);
|
const event = finishEvent(tmpDraft, secKey) as NostrEvent;
|
||||||
const event: NostrEvent = {
|
|
||||||
...tmpDraft,
|
|
||||||
id: getEventHash(tmpDraft),
|
|
||||||
sig: signature,
|
|
||||||
};
|
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
} else throw new Error("No signing method");
|
} else throw new Error("No signing method");
|
||||||
|
Reference in New Issue
Block a user