cargo fmt + clippy

This commit is contained in:
nvrl committed 2026-06-28 11:41:51 +02:00
1 parent 70e573ebe1
commit c98ec2d55d
12 files changed
+76 -67

No files matched your search

+5 -5
View File
@@ -17,13 +17,13 @@ mod verify;
pub use content::ContentKey;
pub use derive::derive_key_passphrase;
pub use encrypt::{
build_volume_creation_material, generate_node_hash_key, generate_node_key,
generate_node_key_aead, GeneratedNodeKey, VolumeCreationMaterial,
GeneratedNodeKey, VolumeCreationMaterial, build_volume_creation_material,
generate_node_hash_key, generate_node_key, generate_node_key_aead,
};
pub use errors::CryptoError;
pub use keys::{decrypt_armored_with_keys, PrivateKey};
pub use srp::{generate_proofs, SrpProofs, DEFAULT_BIT_LENGTH};
pub use verify::{verify_detached, PublicKey, VerificationKeyRing, VerificationStatus};
pub use keys::{PrivateKey, decrypt_armored_with_keys};
pub use srp::{DEFAULT_BIT_LENGTH, SrpProofs, generate_proofs};
pub use verify::{PublicKey, VerificationKeyRing, VerificationStatus, verify_detached};
/// Result alias for crypto operations.
pub type CryptoResult<T> = std::result::Result<T, CryptoError>;
+3 -3
View File
@@ -19,7 +19,7 @@ use pgp::packet::{
};
use pgp::types::{DecryptionKey, EncryptionKey, EskType, PkeskVersion, Seipdv1ReadMode};
use super::encrypt::{recipient_encryption_key, RecipientOp};
use super::encrypt::{RecipientOp, recipient_encryption_key};
use super::errors::CryptoError;
use super::keys::PrivateKey;
@@ -246,7 +246,7 @@ impl ContentKey {
return Err(CryptoError::Parse(format!(
"unexpected thumbnail payload packet: {:?}",
other.tag()
)))
)));
}
}
}
@@ -276,7 +276,7 @@ impl ContentKey {
return Err(CryptoError::Parse(format!(
"unexpected block packet: {:?}",
other.tag()
)))
)));
}
}
};
+5 -6
View File
@@ -6,8 +6,8 @@
//! signing key with a separate encryption subkey, so recipient selection must
//! pick the encryption-capable (sub)key.
use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;
use base64::engine::general_purpose::STANDARD as BASE64;
use bytes::Bytes;
use pgp::composed::{
ArmorOptions, DetachedSignature, EncryptionCaps, KeyType, MessageBuilder,
@@ -278,11 +278,10 @@ pub(crate) fn sign_detached(signer: &PrivateKey, data: &[u8]) -> Result<String,
.map_err(|e| CryptoError::Encrypt(format!("creation-time subpacket: {e}")))?,
];
if key.version() <= KeyVersion::V4 {
config.unhashed_subpackets =
vec![
Subpacket::regular(SubpacketData::IssuerKeyId(key.legacy_key_id()))
.map_err(|e| CryptoError::Encrypt(format!("issuer subpacket: {e}")))?,
];
config.unhashed_subpackets = vec![
Subpacket::regular(SubpacketData::IssuerKeyId(key.legacy_key_id()))
.map_err(|e| CryptoError::Encrypt(format!("issuer subpacket: {e}")))?,
];
}
let signature = config
+1 -1
View File
@@ -4,7 +4,7 @@
//! distinct pre-unlock step, so a [`PrivateKey`] simply pairs a parsed
//! [`SignedSecretKey`] with the passphrase that unlocks it.
use pgp::composed::{Deserializable, SignedSecretKey, DetachedSignature};
use pgp::composed::{Deserializable, DetachedSignature, SignedSecretKey};
use pgp::types::Password;
use super::errors::CryptoError;
+1 -1
View File
@@ -11,8 +11,8 @@
//! message; we verify the signature against Proton's embedded SRP modulus key
//! before trusting it.
use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;
use base64::engine::general_purpose::STANDARD as BASE64;
use num_bigint::BigUint;
use num_traits::One;
use pgp::composed::{CleartextSignedMessage, Deserializable, SignedPublicKey};
+1 -1
View File
@@ -9,7 +9,7 @@
//! throwing.
use pgp::composed::{
Deserializable, Message, SignedPublicKey, SignedSecretKey, DetachedSignature,
Deserializable, DetachedSignature, Message, SignedPublicKey, SignedSecretKey,
VerificationResult,
};
use pgp::types::{Password, VerifyingKey};
+14 -10
View File
@@ -10,12 +10,12 @@ use std::time::Duration;
use rand::Rng;
use reqwest::{Method, StatusCode};
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde::de::DeserializeOwned;
use tokio::sync::Mutex;
use crate::api::{ApiResponse, ResponseCode};
use crate::config::{ProtonClientConfiguration, RetryPolicy, API_CONTENT_TYPE};
use crate::config::{API_CONTENT_TYPE, ProtonClientConfiguration, RetryPolicy};
use crate::error::{ProtonApiError, ProtonError, Result};
use crate::ids::SessionId;
use crate::telemetry::{NoopTelemetry, Telemetry, TelemetryExt};
@@ -674,13 +674,17 @@ mod tests {
let event = &events[0];
assert_eq!(event.operation, "http_request");
assert_eq!(event.outcome, Outcome::Success);
assert!(event
.attributes
.iter()
.any(|(k, v)| *k == "method" && v == "GET"));
assert!(event
.attributes
.iter()
.any(|(k, v)| *k == "status" && v == "200"));
assert!(
event
.attributes
.iter()
.any(|(k, v)| *k == "method" && v == "GET")
);
assert!(
event
.attributes
.iter()
.any(|(k, v)| *k == "status" && v == "200")
);
}
}
+1 -1
View File
@@ -6,8 +6,8 @@
//! deferred, matching the official SDK's stance that login flows live outside
//! the core Drive scope.
use base64::engine::general_purpose::STANDARD as BASE64;
use base64::Engine;
use base64::engine::general_purpose::STANDARD as BASE64;
use serde::{Deserialize, Serialize};
use crate::config::ProtonClientConfiguration;