summaryrefslogtreecommitdiff
path: root/src/auth.rs
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-07-17 13:21:16 +0200
committerpennae <github@quasiparticle.net>2022-07-17 17:25:48 +0200
commit5d7f509f1a98c2d45870e3877b4d7bfa756d2d2a (patch)
tree10da9b0614c5f1f98d4edc82e96a798e25971bc0 /src/auth.rs
parent55343df9c1f54113b5f2ed04cecfadf0670887c7 (diff)
downloadminor-skulk-5d7f509f1a98c2d45870e3877b4d7bfa756d2d2a.tar.gz
minor-skulk-5d7f509f1a98c2d45870e3877b4d7bfa756d2d2a.tar.xz
minor-skulk-5d7f509f1a98c2d45870e3877b4d7bfa756d2d2a.zip
use HawkKey everywhere hawk keys are handled
the db already does this, crypto did not.
Diffstat (limited to 'src/auth.rs')
-rw-r--r--src/auth.rs7
1 files changed, 3 insertions, 4 deletions
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(