mirror of
https://github.com/bitbaum/causius.git
synced 2026-12-04 04:07:36 +01:00
- Anonymisation: names, addresses, AHV, IBAN, phone, e-mail, birth dates and labelled reference numbers are replaced with placeholders before a letter leaves the browser; the reader sees and can adjust every replacement and preview what is sent. The browser restores the values in the result. - Photo cover tool: black out areas of a page; boxes are burnt into the pixels before upload. - Anonymised export for helpers; pseudonymity for clients, assistants and lawyers in the helper rules (lawyer named to a client on engagement). - Security: per-request nonce CSP (strict-dynamic, connect-src 'self', frame-ancestors 'none'), HSTS, nosniff, no-referrer, Permissions-Policy, COOP/CORP, no-store on the API, no X-Powered-By. - Fix: unprefixed English pages were rewritten by next-intl to https://localhost behind the box's proxy and answered 500. Every language is now prefixed; / redirects by browser language. - AGENTS.md: finish to production; security and privacy stay strict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012EJFFkKhmaVnnH8E3mHnaZ
21 lines
923 B
TypeScript
21 lines
923 B
TypeScript
import type { CaseFile } from "./case";
|
|
import { applyRedactions, assignTokens, findPersonalData, mapStrings } from "./redact";
|
|
|
|
/**
|
|
* The case as a helper should get it: every personal detail replaced by its
|
|
* placeholder again, and the table of what the placeholders mean left out. A
|
|
* helper can work the case — the deadline, what is asked, the letter — without
|
|
* learning who it is about until the reader decides to tell them.
|
|
*
|
|
* Uses the table from the original analysis; a case without one (filed by
|
|
* hand, or imported) is searched afresh.
|
|
*/
|
|
export function anonymisedCase(data: CaseFile): CaseFile {
|
|
const table = data.redactions.length
|
|
? data.redactions
|
|
: assignTokens(findPersonalData(data.texts.map((t) => t.text).join("\n")));
|
|
const { redactions: _omit, ...rest } = data;
|
|
void _omit;
|
|
return { ...mapStrings(rest, (s) => applyRedactions(s, table)), id: data.id, redactions: [] };
|
|
}
|