18 lines
426 B
Rust
Raw Normal View History

2020-02-06 15:41:11 +01:00
use crate::error::SResult;
2020-01-15 17:10:33 +01:00
use crate::helpers::tide::RequestExt;
2020-02-06 15:41:11 +01:00
use crate::helpers::tide::ACL::*;
2019-10-31 15:00:36 +01:00
use crate::Data;
2020-02-26 18:49:17 +01:00
use serde_json::json;
use tide::{Request, Response};
2019-10-31 15:00:36 +01:00
2020-01-15 17:10:33 +01:00
pub async fn list(ctx: Request<Data>) -> SResult<Response> {
2019-10-31 15:00:36 +01:00
ctx.is_allowed(Admin)?;
2020-02-06 15:41:11 +01:00
let keys = &ctx.state().api_keys;
2019-10-31 15:00:36 +01:00
2020-02-26 18:49:17 +01:00
Ok(tide::Response::new(200).body_json(&json!({
"private": keys.private,
"public": keys.public,
}))?)
2019-10-31 15:00:36 +01:00
}