Chats: Ende-zu-Ende-verschlüsselte Direktnachrichten
Erste Version der Chats auf Basis der Schlüsselverwaltung: Gespräche zu
zweit, nur Text. Ziel ist, dass der Betreiber den Inhalt nicht kennt;
der Server speichert und verteilt nur OpenPGP-Chiffrate.
- Profil: „Ansprechen“, wenn beide einen Schlüssel haben (für Nutzer
ohne Schlüssel unsichtbar).
- Entsperren einmal pro Tab mit der Passphrase; der Schlüsselbund bleibt
im Speicher (keyring.ts) und umfasst auch frühere eigene Schlüssel.
- Nachrichten an Empfänger und Absender verschlüsselt und signiert; das
offene Gespräch fragt alle 5 s nach, die Übersicht alle 30 s.
- Server: Tabelle message, /api/chats, /api/chats/{username};
pgpkey.CheckMessage weist Klartext ab; internal/chat löscht stündlich,
was älter als 15 Tage ist. Konto löschen nimmt die Nachrichten mit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TiXsPUqw7oeomZ8wZrQW5q
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ed227f0d81
commit
f75407ea5b
@@ -1,9 +1,10 @@
|
||||
import { useState } from "react";
|
||||
import { useParams } from "react-router";
|
||||
import { Link, useParams } from "react-router";
|
||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { api, errMsg } from "../api";
|
||||
import { useAuthChanged, useMe } from "../auth";
|
||||
import { avatarUrl, linkify } from "../format";
|
||||
import { useUserKey } from "../useKey";
|
||||
import { useFormAction } from "../useFormAction";
|
||||
import { Feed } from "../components/Feed";
|
||||
import type { Profile } from "../types";
|
||||
@@ -49,6 +50,7 @@ function ProfileView({ username }: { username: string }) {
|
||||
{editing ? "Fertig" : "Profil bearbeiten"}
|
||||
</button>
|
||||
)}
|
||||
{me && info && !isOwner && <Contact me={me.username} other={info.username} />}
|
||||
</div>
|
||||
<h2 id="profile-name">{name}</h2>
|
||||
{info?.bio && <p className="bio">{linkify(info.bio)}</p>}
|
||||
@@ -71,6 +73,19 @@ function ProfileView({ username }: { username: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
// Contact führt zum Chat mit dem Profil -- nur, wenn beide einen Schlüssel
|
||||
// haben; wer selbst keinen hat, sieht den Knopf gar nicht.
|
||||
function Contact({ me, other }: { me: string; other: string }) {
|
||||
const own = useUserKey(me);
|
||||
const theirs = useUserKey(other);
|
||||
if (!own.data?.key || !theirs.data?.key) return null;
|
||||
return (
|
||||
<Link className="button" to={`/chats/${encodeURIComponent(other)}`}>
|
||||
Ansprechen
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
// ProfileEdit: Header-Bild, Profilbild und Beschreibung, nur für den
|
||||
// Eigentümer.
|
||||
function ProfileEdit({ info }: { info: Profile }) {
|
||||
|
||||
Reference in New Issue
Block a user