From 0a46fc05dcb00406a0c2e51a7f3a2a0a1e8201a5 Mon Sep 17 00:00:00 2001 From: _ <> Date: Mon, 21 Dec 2020 14:26:51 +0000 Subject: [PATCH] :bug: bug: fix 30-day scraper keys having 7 days of validity. This won't affect anything, because I had manually written the not_after for the testing keys. Even the automated tests weren't using the new_30_day function --- crates/ptth_relay/src/key_validity.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ptth_relay/src/key_validity.rs b/crates/ptth_relay/src/key_validity.rs index dbb3704..77c73f8 100644 --- a/crates/ptth_relay/src/key_validity.rs +++ b/crates/ptth_relay/src/key_validity.rs @@ -111,14 +111,14 @@ pub enum KeyValidity { DurationNegative, } -impl ScraperKey { +impl ScraperKey { pub fn new_30_day > (name: S, input: &[u8]) -> Self { let now = Utc::now (); Self { name: name.into (), not_before: now, - not_after: now + Duration::days (7), + not_after: now + V::dur (), hash: BlakeHashWrapper::from_key (input), _phantom: Default::default (), } @@ -227,6 +227,7 @@ mod tests { for (input, expected) in &[ (zero_time + Duration::days (0), ClockIsBehind), (zero_time + Duration::days (2), Valid), + (zero_time + Duration::days (29), Valid), (zero_time + Duration::days (1 + 30), Expired), (zero_time + Duration::days (100), Expired), ] {