From 5d7f509f1a98c2d45870e3877b4d7bfa756d2d2a Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 17 Jul 2022 13:21:16 +0200 Subject: use HawkKey everywhere hawk keys are handled the db already does this, crypto did not. --- src/auth.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/auth.rs') diff --git a/src/auth.rs b/src/auth.rs index f56c5e2..304ab0f 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -11,17 +11,16 @@ use rocket::{request, Data, Ignite, Phase, Rocket, Sentinel}; use serde::Deserialize; use serde_json::error::Category; -use crate::crypto::SecretBytes; use crate::db::DbConn; use crate::types::oauth::ScopeSet; -use crate::types::{OauthToken, UserID}; +use crate::types::{HawkKey, OauthToken, UserID}; use crate::Config; #[rocket::async_trait] pub(crate) trait AuthSource { type ID: FromStr + Send + Sync + Clone; type Context: Send + Sync; - async fn hawk(r: &Request<'_>, id: &Self::ID) -> Result<(SecretBytes<32>, Self::Context)>; + async fn hawk(r: &Request<'_>, id: &Self::ID) -> Result<(HawkKey, Self::Context)>; async fn bearer_token(r: &Request<'_>, id: &OauthToken) -> Result<(Self::ID, Self::Context)>; } @@ -227,7 +226,7 @@ pub(crate) struct WithBearer; impl crate::auth::AuthSource for WithBearer { type ID = UserID; type Context = ScopeSet; - async fn hawk(_r: &Request<'_>, _id: &Self::ID) -> Result<(SecretBytes<32>, Self::Context)> { + async fn hawk(_r: &Request<'_>, _id: &Self::ID) -> Result<(HawkKey, Self::Context)> { bail!("hawk signatures not allowed here") } async fn bearer_token( -- cgit v1.2.3