From 053369df786571278161edb12bd0483a9f715192 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 14 Dec 2025 20:49:36 +0000 Subject: [PATCH] Add Unix timestamp to TUI exports for hash reproducibility The TUI export handler (_write_note_markdown) was missing the Unix timestamp that was added to CLI exports. This ensures consistency across all export paths. Changes: - Updated _write_note_markdown() in trace/tui/handlers/export_handler.py - Now includes "Unix Timestamp: `{timestamp}` (for hash verification)" line - Matches the format from CLI exports in trace/cli.py - Multi-line content is properly indented - Hash label updated to "SHA256 Hash (timestamp:content)" for clarity All export paths (CLI --export, TUI case export, TUI evidence export) now include the Unix timestamp needed for independent hash verification. --- trace/tui/handlers/export_handler.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/trace/tui/handlers/export_handler.py b/trace/tui/handlers/export_handler.py index c83b441..7b3d0d5 100644 --- a/trace/tui/handlers/export_handler.py +++ b/trace/tui/handlers/export_handler.py @@ -222,15 +222,23 @@ class ExportHandler: @staticmethod def _write_note_markdown(f, note: Note): - """Helper to write a note in markdown format""" + """Helper to write a note in markdown format + + Includes Unix timestamp for hash reproducibility - anyone can recompute the hash + using the formula: SHA256("{unix_timestamp}:{content}") + """ f.write(f"- **{time.ctime(note.timestamp)}**\n") - f.write(f" - Content: {note.content}\n") + f.write(f" - Unix Timestamp: `{note.timestamp}` (for hash verification)\n") + f.write(f" - Content:\n") + # Properly indent multi-line content + for line in note.content.splitlines(): + f.write(f" {line}\n") if note.tags: tags_str = " ".join([f"#{tag}" for tag in note.tags]) f.write(f" - Tags: {tags_str}\n") - f.write(f" - Hash: `{note.content_hash}`\n") + f.write(f" - SHA256 Hash (timestamp:content): `{note.content_hash}`\n") if note.signature: - f.write(" - **Signature Verified:**\n") + f.write(" - **GPG Signature of Hash:**\n") f.write(" ```\n") for line in note.signature.splitlines(): f.write(f" {line}\n")