verifySignatureWorker -> verifyEventWorker

This commit is contained in:
Alex Gleason 2024-02-12 11:42:25 -06:00
parent dbff3fee9a
commit 1e3f637358
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ import { getTagSet } from '@/tags.ts';
import { eventAge, isRelay, nostrDate, nostrNow, Time } from '@/utils.ts'; import { eventAge, isRelay, nostrDate, nostrNow, Time } from '@/utils.ts';
import { fetchWorker } from '@/workers/fetch.ts'; import { fetchWorker } from '@/workers/fetch.ts';
import { TrendsWorker } from '@/workers/trends.ts'; import { TrendsWorker } from '@/workers/trends.ts';
import { verifySignatureWorker } from '@/workers/verify.ts'; import { verifyEventWorker } from '@/workers/verify.ts';
import { signAdminEvent } from '@/sign.ts'; import { signAdminEvent } from '@/sign.ts';
import { lnurlCache } from '@/utils/lnurl.ts'; import { lnurlCache } from '@/utils/lnurl.ts';
@ -25,7 +25,7 @@ const debug = Debug('ditto:pipeline');
* It is idempotent, so it can be called multiple times for the same event. * It is idempotent, so it can be called multiple times for the same event.
*/ */
async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise<void> { async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise<void> {
if (!(await verifySignatureWorker(event))) return; if (!(await verifyEventWorker(event))) return;
const wanted = reqmeister.isWanted(event); const wanted = reqmeister.isWanted(event);
if (await encounterEvent(event, signal)) return; if (await encounterEvent(event, signal)) return;
debug(`NostrEvent<${event.kind}> ${event.id}`); debug(`NostrEvent<${event.kind}> ${event.id}`);

View File

@ -6,8 +6,8 @@ const worker = Comlink.wrap<typeof VerifyWorker>(
new Worker(new URL('./verify.worker.ts', import.meta.url), { type: 'module' }), new Worker(new URL('./verify.worker.ts', import.meta.url), { type: 'module' }),
); );
function verifySignatureWorker(event: NostrEvent): Promise<boolean> { function verifyEventWorker(event: NostrEvent): Promise<boolean> {
return worker.verifySignature(event); return worker.verifyEvent(event);
} }
export { verifySignatureWorker }; export { verifyEventWorker };

View File

@ -1,7 +1,7 @@
import { Comlink, type NostrEvent, type VerifiedEvent, verifyEvent } from '@/deps.ts'; import { Comlink, type NostrEvent, type VerifiedEvent, verifyEvent } from '@/deps.ts';
export const VerifyWorker = { export const VerifyWorker = {
verifySignature(event: NostrEvent): event is VerifiedEvent { verifyEvent(event: NostrEvent): event is VerifiedEvent {
return verifyEvent(event); return verifyEvent(event);
}, },
}; };