Skip to content

Commit

Permalink
Merge pull request #3367 from zecakeh/upgrade-crates
Browse files Browse the repository at this point in the history
chore: Upgrade dependencies
  • Loading branch information
Hywan committed May 1, 2024
2 parents f4b0ebd + b4c3ab3 commit 76200c1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
18 changes: 9 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async-rx = "0.1.3"
async-stream = "0.3.3"
async-trait = "0.1.60"
as_variant = "1.2.0"
base64 = "0.21.0"
base64 = "0.22.0"
byteorder = "1.4.3"
eyeball = { version = "0.8.7", features = ["tracing"] }
eyeball-im = { version = "0.4.1", features = ["tracing"] }
Expand Down
2 changes: 1 addition & 1 deletion bindings/matrix-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ vergen = { version = "8.1.3", features = ["build", "git", "gitcl"] }
anyhow = { workspace = true }
as_variant = { workspace = true }
async-compat = "0.2.1"
base64 = "0.21"
base64 = "0.22"
eyeball-im = { workspace = true }
extension-trait = "1.0.1"
futures-core = { workspace = true }
Expand Down
21 changes: 13 additions & 8 deletions crates/matrix-sdk-store-encryption/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ pub struct EncryptedValue {
#[derive(Debug)]
pub enum EncryptedValueBase64DecodeError {
/// Base64 decoding failed because the string was not valid base64
DecodeError(base64::DecodeError),
DecodeError(base64::DecodeSliceError),

/// Decoding the nonce failed because it was not the expected length
IncorrectNonceLength(usize),
Expand All @@ -805,9 +805,15 @@ impl std::fmt::Display for EncryptedValueBase64DecodeError {
}
}

impl From<base64::DecodeSliceError> for EncryptedValueBase64DecodeError {
fn from(value: base64::DecodeSliceError) -> Self {
Self::DecodeError(value)
}
}

impl From<base64::DecodeError> for EncryptedValueBase64DecodeError {
fn from(value: base64::DecodeError) -> Self {
Self::DecodeError(value)
Self::DecodeError(value.into())
}
}

Expand All @@ -827,11 +833,10 @@ impl TryFrom<EncryptedValueBase64> for EncryptedValue {
type Error = EncryptedValueBase64DecodeError;

fn try_from(value: EncryptedValueBase64) -> Result<Self, Self::Error> {
Ok(Self {
version: value.version,
ciphertext: BASE64.decode(value.ciphertext)?,
nonce: BASE64.decode(value.nonce)?.try_into()?,
})
let mut nonce = [0; XNONCE_SIZE];
BASE64.decode_slice(value.nonce, &mut nonce)?;

Ok(Self { version: value.version, ciphertext: BASE64.decode(value.ciphertext)?, nonce })
}
}

Expand Down Expand Up @@ -1158,7 +1163,7 @@ mod tests {
panic!("Should be an error!");
};

assert_eq!(err.to_string(), "Encoded text cannot have a 6-bit remainder.");
assert_eq!(err.to_string(), "DecodeError: Invalid input length: 1");
}

fn make_nonce() -> [u8; 24] {
Expand Down
4 changes: 2 additions & 2 deletions crates/matrix-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ anymap2 = "0.13.0"
aquamarine = "0.5.0"
assert_matches2 = { workspace = true, optional = true }
as_variant = { workspace = true }
async-channel = "2.1.0"
async-channel = "2.2.1"
async-stream = { workspace = true }
async-trait = { workspace = true }
axum = { version = "0.7.4", optional = true }
bytes = "1.1.0"
bytesize = "1.1"
cfg-vis = "0.3.0"
chrono = { version = "0.4.23", optional = true }
event-listener = "4.0.0"
event-listener = "5.3.0"
eyeball = { workspace = true }
eyeball-im = { workspace = true }
eyeball-im-util = { workspace = true, optional = true }
Expand Down

0 comments on commit 76200c1

Please sign in to comment.