mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 08:23:35 +00:00
fix caching messages insecurely if signer nip44 failed
This commit is contained in:
1 parent
dbacdbc8ac
commit
9d7f5e48df
2 files changed
+29
-18
No files matched your search
@@ -1222,8 +1222,9 @@ export function DMProvider({ children, config }: DMProviderProps) {
|
||||
if (!userPubkey) return {};
|
||||
|
||||
try {
|
||||
const dbReadStart = performance.now();
|
||||
const { readMessagesFromDB } = await import('@/lib/dmMessageStore');
|
||||
|
||||
const dbReadStart = performance.now();
|
||||
const cachedStore = await readMessagesFromDB(userPubkey, user?.signer);
|
||||
console.log(`[DM] ⏱️ IndexedDB read + decrypt took ${(performance.now() - dbReadStart).toFixed(0)}ms`);
|
||||
|
||||
@@ -1521,6 +1522,12 @@ export function DMProvider({ children, config }: DMProviderProps) {
|
||||
// Write to store
|
||||
const writeAllMessagesToStore = useCallback(async () => {
|
||||
if (!userPubkey) return;
|
||||
|
||||
// Don't try to save if user/signer is not available
|
||||
if (!user?.signer) {
|
||||
console.log('[DM] Skipping cache write - no signer available');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const { writeMessagesToDB } = await import('@/lib/dmMessageStore');
|
||||
|
||||
Reference in new issue
Block a user