Chore: Update xsalsa20poly1305 -> 0.9

A few extra error types needed adding and handling due to the new `KeyInit::new_from_slice` returning a non-exported error.
This commit is contained in:
Kyle Simpson
2022-08-09 17:11:07 +01:00
parent 893dbaae34
commit 48db45ffd8
5 changed files with 12 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ use std::{net::IpAddr, str::FromStr};
use tokio::{net::UdpSocket, spawn, time::timeout};
use tracing::{debug, info, instrument};
use url::Url;
use xsalsa20poly1305::{aead::NewAead, XSalsa20Poly1305 as Cipher};
use xsalsa20poly1305::{KeyInit, XSalsa20Poly1305 as Cipher};
pub(crate) struct Connection {
pub(crate) info: ConnectionInfo,
@@ -353,7 +353,8 @@ async fn init_cipher(client: &mut WsStream, mode: CryptoMode) -> Result<Cipher>
return Err(Error::CryptoModeInvalid);
}
return Ok(Cipher::new_from_slice(&desc.secret_key)?);
return Cipher::new_from_slice(&desc.secret_key)
.map_err(|_| Error::CryptoInvalidLength);
},
other => {
debug!(