Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ name: CI
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

permissions:
contents: read

jobs:
typecheck:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
name: Type Check
runs-on: ubuntu-latest
steps:
Expand All @@ -31,6 +38,7 @@ jobs:
run: yarn test

noir:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
name: Noir circuit tests
runs-on: ubuntu-latest
steps:
Expand Down
28 changes: 22 additions & 6 deletions src/components/MaskedText.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useRef, useState } from 'react';
import { maskedSegments } from '../utils/maskedRuns';

interface MaskedTextProps {
Expand All @@ -19,22 +19,38 @@ const Blocks = ({ count }: { count: number }) => (
/** A long redacted stretch, collapsed to one row; click to show every block. */
function CollapsedRedaction({ content, hidden, lines }: { content: string; hidden: number; lines: number }) {
const [open, setOpen] = useState(false);
const restoreFocus = useRef(false);
if (open) {
return (
<>
<button
type="button"
onClick={() => {
restoreFocus.current = true;
setOpen(false);
}}
className="max-w-full cursor-pointer whitespace-pre-wrap break-all text-left"
aria-label={`Collapse ${hidden.toLocaleString()} redacted characters`}
aria-expanded={true}
title="Collapse redacted characters"
>
{content.split(/(\0+)/).map((part, i) =>
part.startsWith('\0') ? <Blocks key={i} count={part.length} /> : <span key={i}>{part}</span>
)}
<button type="button" onClick={() => setOpen(false)} className="ml-1 text-xs text-[#666] underline select-none">
collapse
</button>
</>
<span className="ml-1 text-xs text-[#666] underline select-none">collapse</span>
</button>
);
}
return (
<button
ref={(node) => {
if (node && restoreFocus.current) {
restoreFocus.current = false;
node.focus({ preventScroll: true });
}
}}
type="button"
onClick={() => setOpen(true)}
aria-expanded={false}
className="my-1 flex w-full items-center gap-2 text-left text-xs text-[#666] select-none"
title="Show every redacted character"
>
Expand Down
37 changes: 25 additions & 12 deletions src/pages/VerifyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,18 +394,6 @@ export default function VerifyPage() {

{/* Body Section */}
<div className="p-6">
{bodyDecodedFromQp && (
<p className="text-xs text-[#666] mb-3">
{showRawBody
? "Shown as the raw quoted-printable bytes the proof covers."
: qpEvidence === "content"
? "Shown decoded from quoted-printable (detected from the text; its Content-Transfer-Encoding header is hidden). The proof covers the encoded bytes; decoding them is a fixed public step anyone can repeat."
: "Shown decoded from quoted-printable. The proof covers the encoded bytes; decoding them is a fixed public step anyone can repeat."}{" "}
<button type="button" className="underline" onClick={() => setShowRawBody((v) => !v)}>
{showRawBody ? "Show decoded" : "Show raw"}
</button>
</p>
)}
<div className="prose max-w-none">
<MaskedText
text={bodyDecodedFromQp && showRawBody ? maskedBodyRaw : maskedBody}
Expand All @@ -420,6 +408,31 @@ export default function VerifyPage() {
This content is extracted directly from the zero-knowledge proof's public outputs.
Black blocks indicate redacted information that was masked by the sender.
</p>
{bodyDecodedFromQp && (
<div className="mt-3 flex items-center justify-end gap-2 text-xs text-gray-500">
<button
type="button"
className="underline decoration-gray-300 underline-offset-2 hover:text-gray-700"
aria-pressed={showRawBody}
onClick={() => setShowRawBody((v) => !v)}
>
{showRawBody ? "Show decoded" : "Show raw"}
</button>
<details className="relative">
<summary
className="flex h-5 w-5 cursor-pointer list-none items-center justify-center rounded-full border border-gray-300 [&::-webkit-details-marker]:hidden"
aria-label="About the raw email view"
>
<span aria-hidden="true">i</span>
</summary>
<p className="absolute bottom-full right-0 z-10 mb-2 w-64 max-w-[calc(100vw-4rem)] rounded-md border border-gray-200 bg-white p-3 text-left leading-relaxed shadow-md">
Show raw displays the quoted-printable bytes covered by the proof.
The default view decodes them for readability using a fixed public step anyone can repeat.
{qpEvidence === "content" && " Encoding was detected from the text because its Content-Transfer-Encoding header is hidden."}
</p>
</details>
</div>
)}
</div>
</div>
</div>
Expand Down
Loading