Skip to content

refactor: collapse secureOverwriteBuffer to pattern-fill only#57

Merged
jacaudi merged 2 commits into
mainfrom
refactor/secure-overwrite-simplification
Apr 12, 2026
Merged

refactor: collapse secureOverwriteBuffer to pattern-fill only#57
jacaudi merged 2 commits into
mainfrom
refactor/secure-overwrite-simplification

Conversation

@jacaudi
Copy link
Copy Markdown
Owner

@jacaudi jacaudi commented Apr 12, 2026

Summary

  • Delete the dead useRandom=true async random-fill branch from secureOverwriteBuffer in crypto-storage.js — the sole caller already passed false.
  • Collapse the function from 27 lines (3-arg with async cooperative yield) to 7 lines (2-arg synchronous pattern fill).
  • Add 3 unit tests (16-byte aligned, zero-length, non-divisible-by-4) verifying the FF 00 FF 00 pattern output.

Test plan

  • docker run --rm -v $(pwd):/work -w /work node:22-alpine sh -c "node scripts/build.js && node --test app/tests/test-*.js" — 169/169 passing
  • No useRandom references remain in src/
  • Both secureOverwriteBuffer references (definition + caller) use 2-arg form
  • Security-hardening tests still pass

🤖 Generated with Claude Code

jacaudi and others added 2 commits April 12, 2026 00:03
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jacaudi jacaudi merged commit bb116b4 into main Apr 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant