-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add /api/v1/eth2/publicKeys endpoint for compatibility with validator clients * add file
- Loading branch information
JasonVranek
authored
Mar 23, 2024
1 parent
b28ba61
commit 03a92fc
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use axum::{response::IntoResponse, Json}; | ||
use log::{error, info}; | ||
|
||
use crate::{io::key_management, strip_0x_prefix}; | ||
|
||
pub async fn handler() -> axum::response::Response { | ||
info!("list_bls_keys_for_vc()"); | ||
match key_management::list_bls_keys() { | ||
Ok(list_res) => { | ||
// safely prepend the response with "0x" to match the expected format | ||
let list_res = list_res.iter().map(|x| { | ||
let stripped: &str = strip_0x_prefix!(x); | ||
format!("0x{}", stripped) | ||
}).collect::<Vec<String>>(); | ||
(axum::http::status::StatusCode::OK, Json(list_res)).into_response() | ||
} | ||
Err(e) => { | ||
error!("list_bls_keys_for_vc() failed with: {:?}", e); | ||
axum::http::status::StatusCode::INTERNAL_SERVER_ERROR.into_response() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters