mirror of
https://github.com/rosenpass/rosenpass.git
synced 2025-12-05 20:40:02 -08:00
feat(rosenpass): Add wireguard-broker interface in AppServer (#303)
Dynamically dispatch WireguardBrokerMio trait in AppServer. Also allows for mio event registration and poll processing, logic from dev/broker-architecture branch Co-authored-by: Prabhpreet Dua <615318+prabhpreet@users.noreply.github.com> Co-authored-by: Karolin Varner <karo@cupdev.net>
This commit is contained in:
@@ -162,12 +162,12 @@ impl<const N: usize> StoreValueB64Writer for Public<N> {
|
||||
mut writer: W,
|
||||
) -> Result<(), Self::Error> {
|
||||
let mut f = [0u8; F];
|
||||
let encoded_str = b64_encode(&self.value, &mut f)
|
||||
.with_context(|| format!("Could not encode secret to base64"))?;
|
||||
let encoded_str =
|
||||
b64_encode(&self.value, &mut f).with_context(|| "Could not encode secret to base64")?;
|
||||
|
||||
writer
|
||||
.write_all(encoded_str.as_bytes())
|
||||
.with_context(|| format!("Could not write base64 to writer"))?;
|
||||
.with_context(|| "Could not write base64 to writer")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,11 +295,11 @@ impl<const N: usize> StoreValueB64Writer for Secret<N> {
|
||||
fn store_b64_writer<const F: usize, W: Write>(&self, mut writer: W) -> anyhow::Result<()> {
|
||||
let mut f: Secret<F> = Secret::random();
|
||||
let encoded_str = b64_encode(self.secret(), f.secret_mut())
|
||||
.with_context(|| format!("Could not encode secret to base64"))?;
|
||||
.with_context(|| "Could not encode secret to base64")?;
|
||||
|
||||
writer
|
||||
.write_all(encoded_str.as_bytes())
|
||||
.with_context(|| format!("Could not write base64 to writer"))?;
|
||||
.with_context(|| "Could not write base64 to writer")?;
|
||||
f.zeroize();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user