Files
causius/lib/helpers/request-preview.ts
CatoandClaude e3dcbda881 feat(helpers): a directory of helpers, lawyers checked and still pseudonymous (#25)
- Helpers list themselves (AI service, legal assistant, licensed lawyer) under
  a name or pseudonym; the same account keeps matters of its own. Directory
  search and filters through searchkit and listkit, with the typo suite.
- A lawyer's admission is submitted privately (evidence sealed per
  credential), checked by a staff reviewer, and published as an SD-JWT signed
  with Ed25519: the place in clear, the legal name only as a salted digest.
  Key at /.well-known/jwks.json; anyone can check at /verify. A lawyer is
  listed only where verified.
- An owner asks a helper about a matter, with or without their personal
  details; the request is previewed exactly as it will be read. Accepted, the
  helper becomes a participant; anonymisation is applied in the store, so no
  route can forget it. A lawyer hands over the checked name with proof.
  Ending it removes access in the same transaction.
- Reviewers are staff/admin accounts, granted by the Grant role workflow.
- Who may do what is lib/professions.ts, the one domain file, so Diplodoctor
  reuses the engine by changing it.
- Fixes: the account menu label template; one site URL instead of three, with
  a dev-only origin so local sign-in works.


Claude-Session: https://claude.ai/code/session_018Lem7GyhyyjKhmwjG8G7Ud

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 05:48:41 +02:00

23 lines
824 B
TypeScript

import { applyRedactions, assignTokens, findPersonalData } from "../redact";
export interface HelpRequestText {
title: string;
area: string;
message: string;
}
/**
* What a helper reads of a request the owner sends without their personal
* details. Pure and shared: the server stores exactly this, and the form shows
* exactly this before sending — so a name the patterns miss is seen, and
* added to the words to hide, before it leaves.
*/
export function anonymiseRequest(text: HelpRequestText, hide: readonly string[]): HelpRequestText {
const table = assignTokens(findPersonalData(`${text.title}\n${text.area}\n${text.message}`, [...hide]));
return {
title: applyRedactions(text.title, table),
area: applyRedactions(text.area, table),
message: applyRedactions(text.message, table),
};
}