Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: change the name to NotarySigningKeyProperties #410

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions notary-server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub struct NotaryServerProperties {
/// Setting for TLS connection between prover and notary
pub tls: TLSProperties,
/// File path of private key (in PEM format) used to sign the notarization
pub notary_signature: NotarySignatureProperties,
pub notary_key: NotarySigningKeyProperties,
/// Setting for logging/tracing
pub tracing: TracingProperties,
/// Setting for authorization
Expand Down Expand Up @@ -53,7 +53,7 @@ pub struct TLSProperties {

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct NotarySignatureProperties {
pub struct NotarySigningKeyProperties {
pub private_key_pem_path: String,
pub public_key_pem_path: String,
}
Expand Down
2 changes: 1 addition & 1 deletion notary-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod util;

pub use config::{
AuthorizationProperties, NotarizationProperties, NotaryServerProperties,
NotarySignatureProperties, ServerProperties, TLSProperties, TracingProperties,
NotarySigningKeyProperties, ServerProperties, TLSProperties, TracingProperties,
};
pub use domain::{
cli::CliFields,
Expand Down
10 changes: 5 additions & 5 deletions notary-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use tower::MakeService;
use tracing::{debug, error, info};

use crate::{
config::{NotaryServerProperties, NotarySignatureProperties},
config::{NotaryServerProperties, NotarySigningKeyProperties},
domain::{
auth::{authorization_whitelist_vec_into_hashmap, AuthorizationWhitelistRecord},
notary::NotaryGlobals,
Expand All @@ -44,7 +44,7 @@ use crate::{
#[tracing::instrument(skip(config))]
pub async fn run_server(config: &NotaryServerProperties) -> Result<(), NotaryServerError> {
// Load the private key for notarized transcript signing
let notary_signing_key = load_notary_signing_key(&config.notary_signature).await?;
let notary_signing_key = load_notary_signing_key(&config.notary_key).await?;
// Build TLS acceptor if it is turned on
let tls_acceptor = if !config.tls.enabled {
debug!("Skipping TLS setup as it is turned off.");
Expand Down Expand Up @@ -105,7 +105,7 @@ pub async fn run_server(config: &NotaryServerProperties) -> Result<(), NotarySer
);

// Parameters needed for the info endpoint
let public_key = std::fs::read_to_string(&config.notary_signature.public_key_pem_path)
let public_key = std::fs::read_to_string(&config.notary_key.public_key_pem_path)
.map_err(|err| eyre!("Failed to load notary public signing key for notarization: {err}"))?;
let version = env!("CARGO_PKG_VERSION").to_string();
let git_commit_hash = env!("GIT_COMMIT_HASH").to_string();
Expand Down Expand Up @@ -207,7 +207,7 @@ pub async fn run_server(config: &NotaryServerProperties) -> Result<(), NotarySer
}

/// Temporary function to load notary signing key from static file
async fn load_notary_signing_key(config: &NotarySignatureProperties) -> Result<SigningKey> {
async fn load_notary_signing_key(config: &NotarySigningKeyProperties) -> Result<SigningKey> {
debug!("Loading notary server's signing key");

let notary_signing_key = SigningKey::read_pkcs8_pem_file(&config.private_key_pem_path)
Expand Down Expand Up @@ -263,7 +263,7 @@ mod test {

#[tokio::test]
async fn test_load_notary_signing_key() {
let config = NotarySignatureProperties {
let config = NotarySigningKeyProperties {
private_key_pem_path: "./fixture/notary/notary.key".to_string(),
public_key_pem_path: "./fixture/notary/notary.pub".to_string(),
};
Expand Down
Loading