2022-02-17 15:48:55 +00:00
|
|
|
use crate::database::{Database, KeyDatabase};
|
|
|
|
use crate::web::MyResponse;
|
|
|
|
|
|
|
|
// WKD queries
|
|
|
|
#[get("/.well-known/openpgpkey/<domain>/hu/<wkd_hash>")]
|
2022-02-26 15:54:07 +00:00
|
|
|
pub fn wkd_query(db: &rocket::State<KeyDatabase>, domain: String, wkd_hash: String) -> MyResponse {
|
2022-02-17 15:48:55 +00:00
|
|
|
match db.by_domain_and_hash_wkd(&domain, &wkd_hash) {
|
|
|
|
Some(key) => MyResponse::wkd(key, &wkd_hash),
|
2022-02-26 15:54:07 +00:00
|
|
|
None => MyResponse::not_found_plain("No key found for this email address."),
|
2022-02-17 15:48:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Policy requests.
|
|
|
|
// 200 response with an empty body.
|
|
|
|
#[get("/.well-known/openpgpkey/<_domain>/policy")]
|
2022-02-26 15:54:07 +00:00
|
|
|
pub fn wkd_policy(_domain: String) -> MyResponse {
|
2022-02-17 15:48:55 +00:00
|
|
|
MyResponse::plain("".to_string())
|
|
|
|
}
|