use @snort/system cache

This commit is contained in:
2023-06-15 12:03:05 +01:00
parent c2a3a706de
commit fc11381ccd
79 changed files with 679 additions and 524 deletions

View File

@ -35,14 +35,21 @@ import DebugPage from "Pages/Debug";
import { db } from "Db";
import { preload, UserCache } from "Cache";
import { LoginStore } from "Login";
import { NostrSystem, ProfileLoaderService } from "@snort/system";
import { UserRelays } from "Cache/UserRelayCache";
import { EventPublisher, NostrSystem, ProfileLoaderService } from "@snort/system";
import { UserRelays } from "Cache";
/**
* Singleton nostr system
*/
export const System = new NostrSystem({
get: pk => UserRelays.getFromCache(pk)?.relays,
relayCache: UserRelays,
authHandler: async (c, r) => {
const { publicKey, privateKey } = LoginStore.snapshot();
if (publicKey) {
const pub = new EventPublisher(publicKey, privateKey);
return await pub.nip42Auth(c, r);
}
},
});
/**