Background
This task is an outcome of the protocols Rust docs issues tracked in #845.
While documenting protocols::v2::noise-sv2 in #1013, areas of potential code debt were identified. This issue servers as a place to list out these items to then be addressed in an organized manner. The initial Rust documentation effort was an immediate action, while a refactoring (which implies breaking API changes) is not so urgent priority, so for now we should leave this in the backlog for an appropriate moment in the future.
Identified Potential Code Debt
- Consider moving
noise_sv2::cipher_state::GenericCipher enum + associated logic to its own noise_sv2::generic_cipher module. Or, perhaps given the comment in the #916 discussion and the removal of AES256GCM in this sv2-spec PR, we do not need the GenericCipher at all? Do we plan so support anything other than ChaCha20Poly1305 in the future?
- Consider moving
noise_sv2::cipher_state::Cipher struct and associated logic into its own noise_sv2::cipher module.
unwraps in the impl From<[u8; 74]> for SignatureNoiseMessage from method.
- There is no custom
Result type alias around our custom Error enum. Should add and use this everywhere we have a std::result::Result type.
- Consider making
handshake::HandshakeOp trait public so users can call Responder::generate_key().
Background
This task is an outcome of the
protocolsRust docs issues tracked in #845.While documenting
protocols::v2::noise-sv2in #1013, areas of potential code debt were identified. This issue servers as a place to list out these items to then be addressed in an organized manner. The initial Rust documentation effort was an immediate action, while a refactoring (which implies breaking API changes) is not so urgent priority, so for now we should leave this in the backlog for an appropriate moment in the future.Identified Potential Code Debt
noise_sv2::cipher_state::GenericCipherenum + associated logic to its ownnoise_sv2::generic_ciphermodule. Or, perhaps given the comment in the #916 discussion and the removal of AES256GCM in this sv2-spec PR, we do not need theGenericCipherat all? Do we plan so support anything other thanChaCha20Poly1305in the future?noise_sv2::cipher_state::Cipherstruct and associated logic into its ownnoise_sv2::ciphermodule.unwrapsin theimpl From<[u8; 74]> for SignatureNoiseMessagefrommethod.Resulttype alias around our customErrorenum. Should add and use this everywhere we have astd::result::Resulttype.handshake::HandshakeOptrait public so users can callResponder::generate_key().