bolt8

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

ARCH4.md (998B)


      1 # ARCH4: Recoverable partial framing
      2 
      3 ## Goal
      4 Distinguish "need more bytes" from malformed packets when decrypting
      5 from a stream buffer.
      6 
      7 ## Context
      8 Current decrypt_frame returns InvalidLength when the buffer does not
      9 contain a full frame. In streaming reads, this can be a normal condition
     10 rather than an error. BOLT8 framing requires incremental parsing of a
     11 length field and then the encrypted body.
     12 
     13 ## Decision points
     14 - Introduce a new result type (e.g., FrameResult) that can be:
     15   - NeedMore Int (minimum bytes required),
     16   - FrameOk plaintext remainder session,
     17   - FrameError Error.
     18 - Alternatively, add a new function decrypt_frame_partial with a
     19   dedicated error type while keeping decrypt_frame strict.
     20 
     21 ## Constraints
     22 - Keep existing API behavior stable if possible.
     23 - Avoid partial functions.
     24 - Make the partial/need-more case explicit and non-exceptional.
     25 
     26 ## Expected outcome
     27 A clear API for streaming callers to handle partial buffers without
     28 conflating them with invalid frames.