mirror of
https://github.com/chatmail/core.git
synced 2026-05-06 16:36:59 +03:00
Compare commits
1 Commits
hoc/stats-
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8056605e37 |
33
Cargo.lock
generated
33
Cargo.lock
generated
@@ -934,9 +934,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
||||
|
||||
[[package]]
|
||||
name = "colorutils-rs"
|
||||
version = "0.8.0"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69abc9a8ed011e2b7946769f460b9e76e8b659ece9ef4001b9d8bba3489f796d"
|
||||
checksum = "6e2fc25857fa523662de5cae84225b0e7bfb24a2a3f9ed8802fecf03df7252b1"
|
||||
dependencies = [
|
||||
"erydanos",
|
||||
"half",
|
||||
@@ -1301,9 +1301,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.11.0"
|
||||
version = "2.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4ae5f15dda3c708c0ade84bfee31ccab44a3da4f88015ed22f63732abe300c8"
|
||||
checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea"
|
||||
|
||||
[[package]]
|
||||
name = "dbl"
|
||||
@@ -1400,7 +1400,7 @@ dependencies = [
|
||||
"url",
|
||||
"uuid",
|
||||
"walkdir",
|
||||
"webpki-roots",
|
||||
"webpki-roots 1.0.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2645,7 +2645,7 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-rustls",
|
||||
"tower-service",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.26.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2662,7 +2662,7 @@ dependencies = [
|
||||
"hyper",
|
||||
"libc",
|
||||
"pin-project-lite",
|
||||
"socket2 0.6.3",
|
||||
"socket2 0.5.9",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@@ -3009,7 +3009,7 @@ dependencies = [
|
||||
"tracing",
|
||||
"url",
|
||||
"wasm-bindgen-futures",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.26.11",
|
||||
"x509-parser",
|
||||
"z32",
|
||||
]
|
||||
@@ -3195,7 +3195,7 @@ dependencies = [
|
||||
"tokio-websockets",
|
||||
"tracing",
|
||||
"url",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.26.11",
|
||||
"ws_stream_wasm",
|
||||
"z32",
|
||||
]
|
||||
@@ -5007,7 +5007,7 @@ dependencies = [
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-streams",
|
||||
"web-sys",
|
||||
"webpki-roots",
|
||||
"webpki-roots 0.26.11",
|
||||
"windows-registry",
|
||||
]
|
||||
|
||||
@@ -6765,9 +6765,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.26.8"
|
||||
version = "0.26.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9"
|
||||
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
|
||||
dependencies = [
|
||||
"webpki-roots 1.0.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"
|
||||
dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
@@ -53,7 +53,7 @@ blake3 = "1.8.2"
|
||||
brotli = { version = "8", default-features=false, features = ["std"] }
|
||||
bytes = "1"
|
||||
chrono = { workspace = true, features = ["alloc", "clock", "std"] }
|
||||
colorutils-rs = { version = "0.8.0", default-features = false }
|
||||
colorutils-rs = { version = "0.7.5", default-features = false }
|
||||
data-encoding = "2.9.0"
|
||||
escaper = "0.1"
|
||||
fast-socks5 = "1"
|
||||
@@ -111,7 +111,7 @@ tracing = "0.1.41"
|
||||
url = "2"
|
||||
uuid = { version = "1", features = ["serde", "v4"] }
|
||||
walkdir = "2.5.0"
|
||||
webpki-roots = "0.26.8"
|
||||
webpki-roots = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = { workspace = true, features = ["backtrace"] } # Enable `backtrace` feature in tests.
|
||||
|
||||
@@ -29,7 +29,6 @@ const STATISTICS_BOT_VCARD: &str = include_str!("../assets/statistics-bot.vcf");
|
||||
const SENDING_INTERVAL_SECONDS: i64 = 3600 * 24 * 7; // 1 week
|
||||
// const SENDING_INTERVAL_SECONDS: i64 = 60; // 1 minute (for testing)
|
||||
const MESSAGE_STATS_UPDATE_INTERVAL_SECONDS: i64 = 4 * 60; // 4 minutes (less than the lowest ephemeral messages timeout)
|
||||
const KEY_CREATE_TIMESTAMP_RESOLUTION: u32 = 3600 * 24 * 7 * 4; // 4 weeks
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct Statistics {
|
||||
@@ -349,13 +348,7 @@ async fn get_stats(context: &Context) -> Result<String> {
|
||||
let key_create_timestamps: Vec<u32> = load_self_public_keyring(context)
|
||||
.await?
|
||||
.iter()
|
||||
.map(|k| {
|
||||
k.created_at()
|
||||
.as_secs()
|
||||
.div_ceil(KEY_CREATE_TIMESTAMP_RESOLUTION)
|
||||
.checked_mul(KEY_CREATE_TIMESTAMP_RESOLUTION)
|
||||
.unwrap_or(0)
|
||||
})
|
||||
.map(|k| k.created_at().as_secs())
|
||||
.collect();
|
||||
|
||||
let sending_enabled_timestamps =
|
||||
|
||||
@@ -486,15 +486,6 @@ async fn test_stats_key_creation_timestamp() -> Result<()> {
|
||||
// Alice uses a pregenerated key. It was created at this timestamp:
|
||||
const ALICE_KEY_CREATION_TIME: u128 = 1582855645;
|
||||
|
||||
// The key creation time's resolution is reduced in order to prevent deanonymization:
|
||||
const CENSORED_KEY_CREATION_TIME: u128 = 1584576000;
|
||||
assert!(CENSORED_KEY_CREATION_TIME.is_multiple_of(KEY_CREATE_TIMESTAMP_RESOLUTION as u128));
|
||||
assert!(CENSORED_KEY_CREATION_TIME > ALICE_KEY_CREATION_TIME);
|
||||
assert!(
|
||||
CENSORED_KEY_CREATION_TIME - ALICE_KEY_CREATION_TIME
|
||||
< KEY_CREATE_TIMESTAMP_RESOLUTION as u128
|
||||
);
|
||||
|
||||
let alice = &TestContext::new_alice().await;
|
||||
alice.set_config_bool(Config::StatsSending, true).await?;
|
||||
|
||||
@@ -504,7 +495,7 @@ async fn test_stats_key_creation_timestamp() -> Result<()> {
|
||||
assert_eq!(
|
||||
key_create_timestamps,
|
||||
&vec![Value::Number(
|
||||
Number::from_u128(CENSORED_KEY_CREATION_TIME).unwrap()
|
||||
Number::from_u128(ALICE_KEY_CREATION_TIME).unwrap()
|
||||
)]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user