add creation date and expiration date to access keys

This commit is contained in:
Alex Auvolat
2025-04-17 11:09:21 +02:00
parent 2f21181ccb
commit c56b7e20c3
10 changed files with 225 additions and 33 deletions
+8
View File
@@ -9,6 +9,7 @@ use sha2::{Digest, Sha256};
use garage_table::*;
use garage_util::data::Hash;
use garage_util::time::now_msec;
use garage_model::garage::Garage;
use garage_model::key_table::*;
@@ -396,6 +397,13 @@ pub fn verify_v4(
.ok_or_else(|| Error::forbidden(format!("No such key: {}", &auth.key_id)))?;
let key_p = key.params().unwrap();
if key_p.is_expired(now_msec()) {
return Err(Error::forbidden(format!(
"Access key {} has expired",
key.key_id
)));
}
let mut hmac = signing_hmac(
&auth.date,
&key_p.secret_key,