Expose provider health public identity
This commit is contained in:
parent
ab321b3434
commit
547404fa33
1 changed files with 18 additions and 2 deletions
|
|
@ -282,8 +282,9 @@ fn provider_health_identity_enroll(args: Args) -> Result<()> {
|
|||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json!({
|
||||
"schemaVersion": "epiphany.provider_health_identity_enrollment.v1",
|
||||
"schemaVersion": "epiphany.provider_health_identity_enrollment.v2",
|
||||
"identityId": signer.entry().identity_id,
|
||||
"publicKeyHex": lowercase_hex(&signer.entry().public_key),
|
||||
"privateStateExposed": false,
|
||||
}))?
|
||||
);
|
||||
|
|
@ -305,8 +306,9 @@ fn provider_health_identity_export(args: Args) -> Result<()> {
|
|||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&json!({
|
||||
"schemaVersion": "epiphany.provider_health_identity_export.v1",
|
||||
"schemaVersion": "epiphany.provider_health_identity_export.v2",
|
||||
"identityId": signer.entry().identity_id,
|
||||
"publicKeyHex": lowercase_hex(&signer.entry().public_key),
|
||||
"publicAnchor": public,
|
||||
"privateStateExposed": false,
|
||||
}))?
|
||||
|
|
@ -314,6 +316,20 @@ fn provider_health_identity_export(args: Args) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn lowercase_hex(bytes: &[u8]) -> String {
|
||||
bytes.iter().map(|byte| format!("{byte:02x}")).collect()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod provider_health_identity_output_tests {
|
||||
use super::lowercase_hex;
|
||||
|
||||
#[test]
|
||||
fn public_identity_key_is_exact_lowercase_hex() {
|
||||
assert_eq!(lowercase_hex(&[0x00, 0x7f, 0x80, 0xff]), "007f80ff");
|
||||
}
|
||||
}
|
||||
|
||||
fn refuse_false_windows_scm_authority() -> Result<()> {
|
||||
anyhow::bail!(
|
||||
"Windows SCM deployment is unsupported: this executable is a foreground console process, not a Windows service host; use managed-service-task-plan/install/status/start/stop/uninstall"
|
||||
|
|
|
|||
Reference in a new issue