Add Svelte web client and service worker
Mobile-first PWA: groups via key-in-fragment links, encrypted outbox and sync over SSE, all split modes, currencies with ECB rate prefill, photos, comments, history and rewind, stats, recurring expenses, CSV and backup, EN/CS, dark/light theme, Web Push decrypted in the service worker. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
This commit is contained in:
parent
f67add3660
commit
8fbbb4933e
53 changed files with 4558 additions and 37 deletions
17
apps/web/src/lib/events.ts
Normal file
17
apps/web/src/lib/events.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Decrypting a stored event. Plain module (no runes) so the service worker
|
||||
// can use it too.
|
||||
import type { EventPlaintext, GroupEvent } from '@oweme/core';
|
||||
import { decryptJson, type GroupKeys } from './crypto.ts';
|
||||
|
||||
export async function decryptEvent(
|
||||
keys: GroupKeys,
|
||||
groupId: string,
|
||||
e: { id: string; seq: number | null; deviceId: string; iv: string; ct: string },
|
||||
): Promise<GroupEvent | null> {
|
||||
try {
|
||||
const p = await decryptJson<EventPlaintext>(keys.encKey, e.iv, e.ct, `${groupId}|${e.id}`);
|
||||
return { ...p, id: e.id, seq: e.seq, deviceId: e.deviceId };
|
||||
} catch {
|
||||
return null; // wrong key or tampered: skip it
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue