Skip to content

Commit

Permalink
rofl-appd: Serialize byte data as hex
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Jan 23, 2025
1 parent ed12894 commit 31815df
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rofl-appd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ anyhow = "1.0.86"
# TODO: Replace with a released version once it includes UNIX socket support.
rocket = { git = "https://github.com/rwf2/Rocket", rev = "28891e8072136f4641a33fb8c3f2aafce9d88d5b", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_with = { version = "3.12.0", features = ["hex"] }
sp800-185 = "0.2.0"
thiserror = "1.0"
tokio = { version = "1.38", features = ["rt", "rt-multi-thread", "sync", "time", "macros"] }
Expand Down
6 changes: 6 additions & 0 deletions rofl-appd/src/services/kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::sync::{
Arc, Mutex,
};

use serde_with::serde_as;
use sp800_185::KMac;
use tokio::sync::Notify;

Expand Down Expand Up @@ -97,9 +98,11 @@ pub struct GenerateRequest<'r> {
}

/// Key generation response.
#[serde_as]
#[derive(Clone, Default, serde::Serialize, zeroize::Zeroize, zeroize::ZeroizeOnDrop)]
pub struct GenerateResponse {
/// Generated key.
#[serde_as(as = "serde_with::hex::Hex")]
pub key: Vec<u8>,
}

Expand All @@ -115,11 +118,14 @@ pub struct OpenSecretRequest<'r> {
}

/// Secret decryption and authentication response.
#[serde_as]
#[derive(Clone, Default, serde::Serialize)]
pub struct OpenSecretResponse {
/// Decrypted plain-text name.
#[serde_as(as = "serde_with::hex::Hex")]
pub name: Vec<u8>,
/// Decrypted plain-text value.
#[serde_as(as = "serde_with::hex::Hex")]
pub value: Vec<u8>,
}

Expand Down

0 comments on commit 31815df

Please sign in to comment.