From b718fe2792355c1d3bcff4c69d130785b625c340 Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Sun, 27 Oct 2024 14:25:08 -0600 Subject: [PATCH] chore: Rename endpoint consts and reformat --- src/api/endpoints.rs | 4 ++-- src/api/mod.rs | 12 ++++++------ src/api/responses.rs | 10 ++++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/api/endpoints.rs b/src/api/endpoints.rs index 1784c9b..2fddfe8 100644 --- a/src/api/endpoints.rs +++ b/src/api/endpoints.rs @@ -43,7 +43,7 @@ type Endpoint<'a> = (reqwest::Method, &'a str); /// we could completely change it without requiring an upgrade to v1 /// clients.) /// ``` -pub const ADD_CHAIN_ENDPOINT: Endpoint = (reqwest::Method::POST, "/ct/v1/add-chain"); +pub const ADD_CHAIN: Endpoint = (reqwest::Method::POST, "/ct/v1/add-chain"); /// Reference: https://datatracker.ietf.org/doc/html/rfc6962#section-4.2 /// ```txt @@ -59,4 +59,4 @@ pub const ADD_CHAIN_ENDPOINT: Endpoint = (reqwest::Method::POST, "/ct/v1/add-cha /// /// Outputs are the same as in Section 4.1. /// ``` -pub const ADD_PRE_CHAIN_ENDPOINT: Endpoint = (reqwest::Method::POST, "/ct/v1/add-pre-chain"); +pub const ADD_PRE_CHAIN: Endpoint = (reqwest::Method::POST, "/ct/v1/add-pre-chain"); diff --git a/src/api/mod.rs b/src/api/mod.rs index 4b401b7..5f97688 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -19,7 +19,7 @@ impl CtApiClient { /// Adds a standard x509 chain to the CT log. /// - /// See: [`endpoints::ADD_CHAIN_ENDPOINT`] + /// See: [`endpoints::ADD_CHAIN`] /// /// ## Errors /// @@ -34,8 +34,8 @@ impl CtApiClient { ) -> reqwest::Result { self.inner_client .request( - endpoints::ADD_CHAIN_ENDPOINT.0, - self.log_url.to_string() + endpoints::ADD_CHAIN_ENDPOINT.1 + endpoints::ADD_CHAIN.0, + self.log_url.to_string() + endpoints::ADD_CHAIN.1 ) .json(&AddChainRequest { chain }) .send() @@ -49,7 +49,7 @@ impl CtApiClient { /// [`CtApiClient::add_chain`], except is used specifically when the chain /// starts with a precertificate rather than the final end-user certificate. /// - /// See: [`endpoints::ADD_PRE_CHAIN_ENDPOINT`] + /// See: [`endpoints::ADD_PRE_CHAIN`] /// /// ## Errors /// @@ -67,8 +67,8 @@ impl CtApiClient { ) -> reqwest::Result { self.inner_client .request( - endpoints::ADD_PRE_CHAIN_ENDPOINT.0, - self.log_url.to_string() + endpoints::ADD_PRE_CHAIN_ENDPOINT.1 + endpoints::ADD_PRE_CHAIN.0, + self.log_url.to_string() + endpoints::ADD_PRE_CHAIN.1 ) .json(&AddChainRequest { chain }) .send() diff --git a/src/api/responses.rs b/src/api/responses.rs index 4f02a3e..b3a2c83 100644 --- a/src/api/responses.rs +++ b/src/api/responses.rs @@ -1,16 +1,18 @@ use serde::{Deserialize, Serialize}; /// A request payload for adding a chain to a CT log -/// -/// See: [`super::endpoints::ADD_CHAIN_ENDPOINT`] or [`super::endpoints::ADD_PRE_CHAIN_ENDPOINT`] +/// +/// See: [`super::endpoints::ADD_CHAIN`] or +/// [`super::endpoints::ADD_PRE_CHAIN`] #[derive(Debug, Serialize)] pub struct AddChainRequest { - pub chain: Vec + pub chain: Vec } /// A response given when adding a chain to a CT log /// -/// See: [`super::endpoints::ADD_CHAIN_ENDPOINT`] or [`super::endpoints::ADD_PRE_CHAIN_ENDPOINT`] +/// See: [`super::endpoints::ADD_CHAIN`] or +/// [`super::endpoints::ADD_PRE_CHAIN`] #[derive(Debug, Deserialize)] pub struct AddChainResponse { pub sct_version: u8,