Support for DNS-01 and HTTP-01 ACME challenges (closes #226)

This commit is contained in:
mdecimus
2024-04-17 09:55:19 +02:00
parent 0267f28156
commit 929d84468f
34 changed files with 764 additions and 246 deletions

View File

@@ -228,6 +228,25 @@ impl JMAP {
Err(err) => err.into_http_response(),
};
}
("acme-challenge", &Method::GET) if self.core.has_acme_http_providers() => {
if let Some(token) = path.next() {
return match self
.core
.storage
.lookup
.key_get::<String>(format!("acme:{token}").into_bytes())
.await
{
Ok(Some(proof)) => Resource {
content_type: "text/plain",
contents: proof.into_bytes(),
}
.into_http_response(),
Ok(None) => RequestError::not_found().into_http_response(),
Err(err) => err.into_http_response(),
};
}
}
(_, &Method::OPTIONS) => {
return ().into_http_response();
}