bolt8

Encrypted and authenticated transport, per BOLT #8.
git clone git://git.ppad.tech/bolt8.git
Log | Files | Refs | README | LICENSE

commit a2adc22ba86ac58835d283a9b1fdabcf0ad8ce31
parent c890b7a7ca091a1a684253480c940a485b7af8e9
Author: Jared Tobin <jared@jtobin.io>
Date:   Sun, 25 Jan 2026 09:44:29 +0400

doc: add IMPL4 plan

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Aplans/IMPL4.md | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/plans/IMPL4.md b/plans/IMPL4.md @@ -0,0 +1,23 @@ +# IMPL4: Recoverable partial framing + +## Steps +1) Define a result ADT, e.g.: + data FrameResult = NeedMore !Int + | FrameOk !ByteString !ByteString !Session + | FrameError !Error +2) Add a new function (decrypt_frame_partial) that returns FrameResult. + - If buffer < 18, return NeedMore (18 - len). + - If length decrypt fails due to short buffer, return NeedMore. + - If buffer < 18 + len + 16, return NeedMore (needed bytes). + - MAC/parse failures return FrameError. +3) Keep decrypt_frame strict or re-implement it as a wrapper that + converts NeedMore into InvalidLength. +4) Add tests: + - Buffer smaller than 18 returns NeedMore. + - Buffer with full length header but short body returns NeedMore. + - Full frame returns FrameOk with remainder. +5) Update Haddocks to describe partial behavior. + +## Notes +- Use a new ADT to avoid breaking existing Error semantics. +- No new dependencies.