diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-12 19:57:37 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-12 19:57:37 +0100 |
commit | c475471e7a8e7544f2be490898f4249cf27a17e9 (patch) | |
tree | 41253eaaba21b7d38340f2eab0ada17eaae88e8a /src/api/signature.rs | |
parent | f4aad8fe6e36fe05e05c88c322b99fc87d896578 (diff) | |
download | garage-c475471e7a8e7544f2be490898f4249cf27a17e9.tar.gz garage-c475471e7a8e7544f2be490898f4249cf27a17e9.zip |
Implement table gc, currently for block_ref and version only
Diffstat (limited to 'src/api/signature.rs')
-rw-r--r-- | src/api/signature.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/api/signature.rs b/src/api/signature.rs index d7fbd3f7..04d6666c 100644 --- a/src/api/signature.rs +++ b/src/api/signature.rs @@ -106,12 +106,8 @@ pub async fn check_signature( } else { let bytes = hex::decode(authorization.content_sha256) .ok_or_bad_request("Invalid content sha256 hash")?; - let mut hash = [0u8; 32]; - if bytes.len() != 32 { - return Err(Error::BadRequest(format!("Invalid content sha256 hash"))); - } - hash.copy_from_slice(&bytes[..]); - Some(Hash::from(hash)) + Some(Hash::try_from(&bytes[..]) + .ok_or(Error::BadRequest(format!("Invalid content sha256 hash")))?) }; Ok((key, content_sha256)) |