Make EventsDB not rely on Conf

This commit is contained in:
Alex Gleason
2024-09-11 13:06:20 -05:00
parent 624b6b278e
commit d2fb3fd253
14 changed files with 75 additions and 56 deletions

View File

@@ -13,7 +13,7 @@ import { RelayError } from '@/RelayError.ts';
import { AdminSigner } from '@/signers/AdminSigner.ts';
import { Storages } from '@/storages.ts';
import { nostrNow } from '@/utils.ts';
import { purifyEvent } from '@/storages/hydrate.ts';
import { purifyEvent } from '@/utils/purify.ts';
const debug = Debug('ditto:api');

14
src/utils/purify.ts Normal file
View File

@@ -0,0 +1,14 @@
import { NostrEvent } from '@nostrify/nostrify';
/** Return a normalized event without any non-standard keys. */
export function purifyEvent(event: NostrEvent): NostrEvent {
return {
id: event.id,
pubkey: event.pubkey,
kind: event.kind,
content: event.content,
tags: event.tags,
sig: event.sig,
created_at: event.created_at,
};
}