7a8cadc6ec
LOTUS_E2EE_INVESTIGATION.md: per-KE capture runbook (console signatures, synapse log greps + SQL against the documented LXC deployment, the KE-1⇒KE-2 causality decision tree, ranked remediations incl. what a crypto-store reset wipes; SDK finding: stable 41.6.0 has no OTK fix over our RC pin). Client: capture-only console ring buffer (cryptoDiagLog, KE-signature-matched, max 200) + a Crypto Diagnostics card in Developer Tools with a download-report button. ClientRoot installs the capture hook at module load and mounts useSessionSync (cross-tab sessions, prior commit). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
72 lines
2.6 KiB
TypeScript
72 lines
2.6 KiB
TypeScript
import React, { useCallback } from 'react';
|
|
import { Badge, Box, Button, Text } from 'folds';
|
|
import { SequenceCard } from '../../../components/sequence-card';
|
|
import { SequenceCardStyle } from '../styles.css';
|
|
import { SettingTile } from '../../../components/setting-tile';
|
|
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
|
import { useForceUpdate } from '../../../hooks/useForceUpdate';
|
|
import { useInterval } from '../../../hooks/useInterval';
|
|
import { buildCryptoDiagReport, getCryptoDiagEntries } from '../../../utils/cryptoDiagLog';
|
|
|
|
// Lotus E2EE investigation kit — Crypto Diagnostics settings card.
|
|
// Mirrors the surrounding Developer Tools cards (see DevelopTools.tsx).
|
|
|
|
const REFRESH_MS = 1000;
|
|
|
|
export function CryptoDiagnostics() {
|
|
const mx = useMatrixClient();
|
|
// Re-render on a light interval so the live matched-entry count stays fresh
|
|
// while the settings pane is open.
|
|
const [, forceUpdate] = useForceUpdate();
|
|
useInterval(forceUpdate, REFRESH_MS);
|
|
|
|
const count = getCryptoDiagEntries().length;
|
|
|
|
const handleDownload = useCallback(() => {
|
|
const report = buildCryptoDiagReport(mx);
|
|
const blob = new Blob([report], { type: 'application/json' });
|
|
const url = URL.createObjectURL(blob);
|
|
const a = document.createElement('a');
|
|
a.href = url;
|
|
a.download = `lotus-crypto-diag-${new Date().toISOString().replace(/[:.]/g, '-')}.json`;
|
|
a.click();
|
|
URL.revokeObjectURL(url);
|
|
}, [mx]);
|
|
|
|
return (
|
|
<Box direction="Column" gap="100">
|
|
<Text size="L400">Crypto Diagnostics</Text>
|
|
<SequenceCard
|
|
className={SequenceCardStyle}
|
|
variant="SurfaceVariant"
|
|
direction="Column"
|
|
gap="400"
|
|
>
|
|
<SettingTile
|
|
title="Crypto Diagnostics — captures E2EE error signatures this session"
|
|
description="Ring-buffers up to 200 matched console warnings/errors for the KE-1..KE-4 bug cluster. Local only — no network calls. The downloaded report includes the matched log lines as evidence."
|
|
after={
|
|
<Box alignItems="Center" gap="200" shrink="No">
|
|
<Badge variant={count > 0 ? 'Critical' : 'Secondary'} fill="Solid" radii="Pill">
|
|
<Text as="span" size="L400">
|
|
{count}
|
|
</Text>
|
|
</Badge>
|
|
<Button
|
|
onClick={handleDownload}
|
|
variant="Secondary"
|
|
fill="Soft"
|
|
size="300"
|
|
radii="300"
|
|
outlined
|
|
>
|
|
<Text size="B300">Download report</Text>
|
|
</Button>
|
|
</Box>
|
|
}
|
|
/>
|
|
</SequenceCard>
|
|
</Box>
|
|
);
|
|
}
|