summaryrefslogtreecommitdiffstats
path: root/static/crypto.js
diff options
context:
space:
mode:
authorGab Virebent <gabriel1@virebent.art>2026-07-06 16:34:47 +0200
committerGab Virebent <gabriel1@virebent.art>2026-07-06 16:34:47 +0200
commit16854e8b24a3b00d9d5dbd285bbe3b93ee47ce1c (patch)
tree7ac7c321cacd62795cc23939bebdc9c48975377e /static/crypto.js
parent4fd6b4fefa7243f68fae7e24df3da46ee1a8e356 (diff)
downloadnymdrop-16854e8b24a3b00d9d5dbd285bbe3b93ee47ce1c.tar.gz
nymdrop-16854e8b24a3b00d9d5dbd285bbe3b93ee47ce1c.tar.xz
nymdrop-16854e8b24a3b00d9d5dbd285bbe3b93ee47ce1c.zip
Guard key material in RAM with memguard, add Markdown preview for message field
Reader now keeps the private key bytes and the per-submission ECDH/HKDF secrets in memguard.LockedBuffer (mlock + guaranteed wipe) instead of a manual zero loop. Added a regression test for the decrypt path. Message field gets a self-hosted Markdown toggle preview (no external library): headers, bold/italic, inline code, code blocks, blockquotes, lists, links. Output is HTML-escaped and link schemes are whitelisted before rendering. Submitted content is still the raw Markdown source, unchanged on the wire.
Diffstat (limited to 'static/crypto.js')
-rw-r--r--static/crypto.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/static/crypto.js b/static/crypto.js
index f1cc6c9..e196826 100644
--- a/static/crypto.js
+++ b/static/crypto.js
@@ -161,6 +161,13 @@ document.getElementById("drop-form").addEventListener("submit", async (e) => {
if (resp.ok) {
document.getElementById("drop-form").reset();
document.getElementById("filename").textContent = "";
+ const preview = document.getElementById("message-preview");
+ const previewToggle = document.getElementById("preview-toggle");
+ if (preview && previewToggle && !preview.hidden) {
+ preview.hidden = true;
+ document.getElementById("message").hidden = false;
+ previewToggle.textContent = "Preview";
+ }
status.textContent = "Delivered. No record of this submission exists on the server.";
} else {
status.className = "error";