diff --git a/dnapi-rs/src/client_blocking.rs b/dnapi-rs/src/client_blocking.rs index 46fe4e8..f75c21c 100644 --- a/dnapi-rs/src/client_blocking.rs +++ b/dnapi-rs/src/client_blocking.rs @@ -49,7 +49,7 @@ impl Client { /// credentials to be used for future DN API requests, and an object containing organization information. /// # Errors /// This function will return an error in any of the following situations: - /// - the server_url is invalid + /// - the `server_url` is invalid /// - the HTTP request fails /// - the HTTP response is missing X-Request-ID /// - X-Request-ID isn't valid UTF-8 @@ -100,7 +100,7 @@ impl Client { Ok((r.config, dh_privkey_pem, creds, meta)) } - /// Send a signed message to the DNClient API to learn if there is a new configuration available. + /// Send a signed message to the `DNClient` API to learn if there is a new configuration available. /// # Errors /// This function returns an error if the dnclient request fails, or the server returns invalid data. pub fn check_for_update(&self, creds: &Credentials) -> Result> { @@ -111,10 +111,10 @@ impl Client { Ok(result.data.update_available) } - /// Send a signed message to the DNClient API to fetch the new configuration update. During this call a new - /// DH X25519 keypair is generated for the new Nebula certificate as well as a new Ed25519 keypair for DNClient API + /// Send a signed message to the `DNClient` API to fetch the new configuration update. During this call a new + /// DH X25519 keypair is generated for the new Nebula certificate as well as a new Ed25519 keypair for `DNClient` API /// communication. On success it returns the new config, a Nebula private key PEM to be inserted into the config - /// and new DNClient API credentials + /// and new `DNClient` API credentials /// # Errors /// This function returns an error in any of the following scenarios: /// - if the message could not be serialized @@ -154,7 +154,7 @@ impl Client { if result.nonce != update_keys.nonce { error!("nonce mismatch between request {:x?} and response {:x?}", result.nonce, update_keys.nonce); - return Err(format!("nonce mismatch between request and response").into()) + return Err("nonce mismatch between request and response".into()) } let trusted_keys = ed25519_public_keys_from_pem(&result.trusted_keys)?; @@ -169,12 +169,12 @@ impl Client { Ok((result.config, dh_privkey_pem, new_creds)) } - /// Wraps and signs the given req_type and value, and then makes the API call. + /// Wraps and signs the given `req_type` and value, and then makes the API call. /// On success, returns the response body. /// # Errors /// This function will return an error if: /// - serialization in any step fails - /// - if the server_url is invalid + /// - if the `server_url` is invalid /// - if the request could not be sent pub fn post_dnclient(&self, req_type: &str, value: &[u8], host_id: &str, counter: u32, ed_privkey: &SigningKey) -> Result, Box> { let encoded_msg = serde_json::to_string(&RequestWrapper { diff --git a/dnapi-rs/src/crypto.rs b/dnapi-rs/src/crypto.rs index c05e814..d5f87d9 100644 --- a/dnapi-rs/src/crypto.rs +++ b/dnapi-rs/src/crypto.rs @@ -23,7 +23,7 @@ pub fn new_nebula_keypair() -> (Vec, Vec) { /// Generate a new 32-byte X25519 keypair pub fn new_x25519_keypair() -> ([u8; 32], [u8; 32]) { - let priv_key = StaticSecret::new(&mut OsRng); + let priv_key = StaticSecret::new(OsRng); let pub_key = PublicKey::from(&priv_key); (pub_key.to_bytes(), priv_key.to_bytes()) } diff --git a/dnapi-rs/src/message.rs b/dnapi-rs/src/message.rs index b262105..ce1e891 100644 --- a/dnapi-rs/src/message.rs +++ b/dnapi-rs/src/message.rs @@ -6,9 +6,9 @@ use serde::{Serialize, Deserialize}; /// The version 1 `DNClient` API endpoint pub const ENDPOINT_V1: &str = "/v1/dnclient"; -/// The CheckForUpdate message type +/// The `CheckForUpdate` message type pub const CHECK_FOR_UPDATE: &str = "CheckForUpdate"; -/// The DoUpdate message type +/// The `DoUpdate` message type pub const DO_UPDATE: &str = "DoUpdate"; base64_serde_type!(Base64Standard, base64::engine::general_purpose::STANDARD);