Skip to content

Commit b2bdee9

Browse files
committed
Document why salsa-simple is vendored in lib.rs
Add comprehensive module-level documentation explaining that this is a vendored XSalsa20 implementation created because the external salsa20 crate lacks serde support needed for Redux state serialization.
1 parent d32ece0 commit b2bdee9

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

vendor/salsa-simple/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
//! Vendored XSalsa20 stream cipher implementation with serde support.
2+
//!
3+
//! This is a custom implementation of the XSalsa20 stream cipher algorithm
4+
//! that provides serialization support via serde, which is required for
5+
//! persisting P2P network connection state in the Redux state machine.
6+
//!
7+
//! # Why vendored?
8+
//!
9+
//! The external [`salsa20`](https://crates.io/crates/salsa20) crate (v0.10.2)
10+
//! does not provide serde support for serializing/deserializing cipher state.
11+
//! This is needed for:
12+
//! - Persisting P2P pnet encryption state across restarts
13+
//! - State snapshots in the Redux architecture
14+
//! - Debugging and inspection capabilities
15+
//!
16+
//! # Implementation
17+
//!
18+
//! This implementation manually implements the XSalsa20 algorithm and adds
19+
//! `Serialize` and `Deserialize` derives. It is tested against the external
20+
//! `salsa20` crate (used as a dev-dependency) to ensure correctness.
21+
//!
22+
//! # Usage
23+
//!
24+
//! Used in `p2p/src/network/pnet/` for P2P private network encryption,
25+
//! providing encrypted communication between peers with serializable state.
26+
127
#[cfg(test)]
228
mod tests;
329

0 commit comments

Comments
 (0)