docs: Added credits
All checks were successful
Deployment Pipeline / test (push) Successful in 2m33s
Deployment Pipeline / deploy (push) Successful in 33s

This commit is contained in:
2026-06-28 21:20:56 +05:30
parent e38b8cbee3
commit 920e4d11c1
2 changed files with 38 additions and 0 deletions

View File

@@ -162,3 +162,8 @@ sequenceDiagram
Note over C: Decrypts payload using local Private Key
```
## Credits
* [David Wong](https://cryptologie.net/posts/eddsa-ed25519-ed25519-ietf-ed25519ph-ed25519ctx-hasheddsa-pureeddsa-wtf/) for his brief intro to EdDSA and Ed25519 on his blog post.

View File

@@ -132,6 +132,39 @@ pub async fn approve(
Ok(Json("Approved!").into_response())
}
#[derive(Serialize)]
pub struct PendingDeviceRes {
pub hostname: String,
pub os: String,
pub public_key: String,
}
pub async fn get_pending_device(
State(state): State<AppState>,
axum::extract::Path(user_code): axum::extract::Path<String>,
) -> Result<Json<PendingDeviceRes>, StatusCode> {
let record = sqlx::query_as::<_, (String, String, String)>(
"SELECT hostname, os, public_key FROM devices WHERE user_code = ? AND approved_at IS NULL",
)
.bind(&user_code)
.fetch_optional(&state.pool)
.await
.map_err(|err| {
tracing::error!("Database error fetching pending device: {:?}", err);
StatusCode::INTERNAL_SERVER_ERROR
})?;
if let Some((hostname, os, public_key)) = record {
Ok(Json(PendingDeviceRes {
hostname,
os,
public_key,
}))
} else {
Err(StatusCode::NOT_FOUND)
}
}
#[derive(Deserialize)]
pub struct PollReq {
pub user_code: String,