This PR builds on PR #173 and completes the remaining construction and
runtime processing logic in `Section 8` of the Mix Protocol RFC. It
finalizes the last steps of packet construction (`Section 8.5.2 step 3.
e–f`) and introduces the complete mix node handler logic in `Section
8.6`, including intermediary and exit processing.
It clearly separates construction, role determination, and processing
logic.
### Changes Introduced in This PR
- **8.5.2 Construction Steps (Final Steps Added)**
- Sphinx packet construction
- [x] Assemble Final Packet
- [x] Transmit Packet
- **8.6 Sphinx Packet Handling**
- [x] **8.6.1 Shared Preprocessing**
- Derives session key, validates replay tag and MAC, decrypts
header/payload
- [x] **8.6.2 Node Role Determination**
- Inspects decrypted header prefix and padding to classify node as
intermediary or exit
- [x] **8.6.3 Intermediary Processing**
- Parses next hop address and mean delay
- Updates ephemeral key and routing fields
- Samples actual forwarding delay and transmits packet
- Erases all temporary state.
- [x] **8.6.4 Exit Processing**
- Verifies payload padding and extracts destination address
- Parses and validates application-layer message
- Hands off to Exit Layer along with origin protocol codec and
destination address
### Highlights
- Explicit role determination via zero-delay and padding inspection
- Fully decoupled construction and handling logic
- Forwarding delay behavior updated:
- Sender selects per-hop mean delay
- Mix node samples actual delay using pluggable distribution
---------
Co-authored-by: kaiserd <1684595+kaiserd@users.noreply.github.com>