mcginty / snow

A Rust implementation of the Noise Protocol Framework
Apache License 2.0
884 stars 120 forks source link

Add read/write functions accepting additional authentication data to StatelessTransportState #182

Open pr2502 opened 1 month ago

pr2502 commented 1 month ago

Hi,

I'm implementing a Noise-based protocol which needs to add a plaintext header to each message but have it still authenticated. This required only exposing the encrypt_ad and decrypt_ad functions which the private CipherState type already implements.

This is an interface other Noise libraries like https://pkg.go.dev/github.com/flynn/noise#CipherState.Decrypt or https://docs.rs/noise-protocol/latest/noise_protocol/struct.CipherState.html#method.encrypt_ad already expose so I hope this is an ok addition to snow?