fix and update
This commit is contained in:
@@ -11,6 +11,8 @@ import {
|
||||
type E2EMessagePayload
|
||||
} from '@/lib/e2e-chat';
|
||||
|
||||
const publishedE2EKeys = new Set<string>();
|
||||
|
||||
export function resolveChatPeerUserId(room: ChatRoom | null | undefined, userId: string | undefined) {
|
||||
if (!room || !userId) return null;
|
||||
const fromMembers = room.members.find((member) => member.userId !== userId)?.userId;
|
||||
@@ -69,7 +71,10 @@ export function useE2EChat(options: {
|
||||
void (async () => {
|
||||
try {
|
||||
const { publicKey } = await ensureE2EKeyPair(options.userId!);
|
||||
const cacheKey = `${options.userId}:${publicKey}`;
|
||||
if (publishedE2EKeys.has(cacheKey)) return;
|
||||
await setUserE2EPublicKey(options.userId!, publicKey, options.token);
|
||||
publishedE2EKeys.add(cacheKey);
|
||||
} catch {
|
||||
// фоновая инициализация E2E
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user