Skip to content

Commit

Permalink
Merge pull request #41 from LeoniePhiline/renovate/secrecy-0.x
Browse files Browse the repository at this point in the history
fix(deps): update rust crate secrecy to 0.10.0
  • Loading branch information
LeoniePhiline authored Oct 22, 2024
2 parents a21cb96 + 72496d0 commit d2651a6
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] <!-- release-date -->

### BREAKING CHANGES

- Update public dependency `secrecy` to v0.10.

## [0.4.2] - 2024-04-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ tracing = ["async-mailer-core/tracing", "async-mailer-outlook?/tracing", "async-
async-mailer-core = { path = "core", version = "0.3" }
async-mailer-outlook = { optional = true, path = "outlook", version = "0.3" }
async-mailer-smtp = { optional = true, path = "smtp", version = "0.3" }
secrecy = "0.8.0"
secrecy = "0.10.0"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use async_mailer::{IntoMessage, Mailer, OutlookMailer, SmtpMailer};
let mailer: OutlookMailer = OutlookMailer::new(
"<Microsoft Identity service tenant>".into(),
"<OAuth2 app GUID>".into(),
async_mailer::Secret::new("<OAuth2 app secret>".into())
async_mailer::SecretString::from("<OAuth2 app secret>")
).await?;

// Alternative:
Expand All @@ -48,7 +48,7 @@ let mailer: SmtpMailer = SmtpMailer::new(
465,
async_mailer::SmtpInvalidCertsPolicy::Deny,
"<username>".into(),
async_mailer::Secret::new("<password>".into())
async_mailer::SecretString::from("<password>")
);

// Further alternative mailers can be implemented by third parties.
Expand Down Expand Up @@ -81,7 +81,7 @@ use async_mailer::{BoxMailer, IntoMessage, OutlookMailer, SmtpMailer};
let mailer: BoxMailer = OutlookMailer::new_box( // Or `OutlookMailer::new_arc()`.
"<Microsoft Identity service tenant>".into(),
"<OAuth2 app GUID>".into(),
async_mailer::Secret::new("<OAuth2 app secret>".into())
async_mailer::SecretString::from("<OAuth2 app secret>")
).await?;

// Alternative:
Expand All @@ -91,7 +91,7 @@ let mailer: BoxMailer = SmtpMailer::new_box( // Or `SmtpMailer::new_arc()`.
465,
async_mailer::SmtpInvalidCertsPolicy::Deny,
"<username>".into(),
async_mailer::Secret::new("<password>".into())
async_mailer::SecretString::from("<password>")
);

// Further alternative mailers can be implemented by third parties.
Expand Down
4 changes: 4 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] <!-- release-date -->

### Changed

- Remove unused dependency `secrecy`.

## [0.3.3] - 2024-04-05

### Added
Expand Down
1 change: 0 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ tracing = ["dep:tracing"]
[dependencies]
async-trait = "0.1.80"
mail-send = { version = "0.4.7", default-features = false, features = ["builder"] }
secrecy = "0.8.0"
thiserror = "1.0.59"
tracing = { optional = true, version = "0.1.40" }
4 changes: 4 additions & 0 deletions outlook/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] <!-- release-date -->

### BREAKING CHANGES

- Update public dependency `secrecy` to v0.10.

## [0.3.2] - 2024-04-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion outlook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async-mailer-core = { path = "../core", version = "0.3" }
async-trait = "0.1.80"
base64 = "0.22.1"
reqwest = { version = "0.12.4", default-features = false, features = ["rustls-tls", "charset", "http2", "macos-system-configuration", "gzip", "brotli"] }
secrecy = "0.8.0"
secrecy = "0.10.0"
serde = { version = "1.0.200", features = ["derive"] }
serde_json = "1.0.116"
thiserror = "1.0.59"
Expand Down
20 changes: 10 additions & 10 deletions outlook/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! let mailer = OutlookMailer::new(
//! "<Microsoft Identity service tenant>".into(),
//! "<OAuth2 app GUID>".into(),
//! secrecy::Secret::new("<OAuth2 app secret>".into())
//! secrecy::SecretString::from("<OAuth2 app secret>")
//! ).await?;
//!
//! // An alternative `SmtpMailer` can be found at `async-mailer-smtp`.
Expand Down Expand Up @@ -61,7 +61,7 @@
//! let mailer: BoxMailer = OutlookMailer::new_box( // Or `OUtlookMailer::new_arc()`.
//! "<Microsoft Identity service tenant>".into(),
//! "<OAuth2 app GUID>".into(),
//! secrecy::Secret::new("<OAuth2 app secret>".into())
//! secrecy::SecretString::from("<OAuth2 app secret>")
//! ).await?;
//!
//! // An alternative `SmtpMailer` can be found at `async-mailer-smtp`.
Expand Down Expand Up @@ -105,7 +105,7 @@ use std::sync::Arc;
use async_trait::async_trait;
use base64::{engine::general_purpose::STANDARD as base64_engine, Engine as _};
use reqwest::header::{HeaderMap, AUTHORIZATION, CONTENT_TYPE};
use secrecy::{ExposeSecret, Secret};
use secrecy::{ExposeSecret, SecretString};
use serde::Deserialize;

#[cfg(feature = "tracing")]
Expand Down Expand Up @@ -160,7 +160,7 @@ pub enum OutlookAccessTokenError {
#[derive(Clone, Debug)]
pub struct OutlookMailer {
http_client: reqwest::Client,
access_token: Secret<String>,
access_token: SecretString,
}

impl OutlookMailer {
Expand All @@ -178,7 +178,7 @@ impl OutlookMailer {
pub async fn new(
tenant: String,
app_guid: String,
secret: Secret<String>,
secret: SecretString,
) -> Result<Self, OutlookMailerError> {
let http_client = reqwest::Client::new();

Expand Down Expand Up @@ -206,7 +206,7 @@ impl OutlookMailer {
pub async fn new_box(
tenant: String,
app_guid: String,
secret: Secret<String>,
secret: SecretString,
) -> Result<BoxMailer, OutlookMailerError> {
Ok(Box::new(Self::new(tenant, app_guid, secret).await?))
}
Expand All @@ -225,7 +225,7 @@ impl OutlookMailer {
pub async fn new_arc(
tenant: String,
app_guid: String,
secret: Secret<String>,
secret: SecretString,
) -> Result<ArcMailer, OutlookMailerError> {
Ok(Arc::new(Self::new(tenant, app_guid, secret).await?))
}
Expand All @@ -243,9 +243,9 @@ impl OutlookMailer {
async fn get_access_token(
tenant_id: &str,
client_id: &str,
client_secret: &Secret<String>,
client_secret: &SecretString,
http_client: reqwest::Client,
) -> Result<Secret<String>, OutlookAccessTokenError> {
) -> Result<SecretString, OutlookAccessTokenError> {
let token_url = format!("https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/token");

let form_data = [
Expand All @@ -270,7 +270,7 @@ impl OutlookMailer {
let token_response: TokenResponse = serde_json::from_slice(&response_data)
.map_err(OutlookAccessTokenError::ParseResponse)?;

Ok(Secret::from(token_response.access_token))
Ok(SecretString::from(token_response.access_token))
}
}

Expand Down
4 changes: 4 additions & 0 deletions smtp/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased] <!-- release-date -->

### BREAKING CHANGES

- Update public dependency `secrecy` to v0.10.

## [0.3.2] - 2024-04-05

### Added
Expand Down
2 changes: 1 addition & 1 deletion smtp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ clap = ["dep:clap"]
async-mailer-core = { path = "../core", version = "0.3" }
async-trait = "0.1.80"
clap = { optional = true, version = "4.5.4", features = ["derive"] }
secrecy = "0.8.0"
secrecy = "0.10.0"
thiserror = "1.0.59"
tracing = { optional = true, version = "0.1.40" }
12 changes: 6 additions & 6 deletions smtp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! 465,
//! SmtpInvalidCertsPolicy::Deny,
//! "<username>".into(),
//! secrecy::Secret::new("<password>".into())
//! secrecy::SecretString::from("<password>")
//! );
//!
//! // An alternative `OutlookMailer` can be found at `async-mailer-outlook`.
Expand Down Expand Up @@ -69,7 +69,7 @@
//! 465,
//! SmtpInvalidCertsPolicy::Deny,
//! "<username>".into(),
//! secrecy::Secret::new("<password>".into())
//! secrecy::SecretString::from("<password>")
//! );
//!
//! // An alternative `OutlookMailer` can be found at `async-mailer-outlook`.
Expand Down Expand Up @@ -118,7 +118,7 @@ use async_trait::async_trait;
#[cfg(feature = "clap")]
use clap;

use secrecy::{ExposeSecret, Secret};
use secrecy::{ExposeSecret, SecretString};

#[cfg(feature = "tracing")]
use tracing::{error, info, instrument};
Expand Down Expand Up @@ -186,7 +186,7 @@ impl SmtpMailer {
port: u16,
invalid_certs: SmtpInvalidCertsPolicy,
user: String,
password: Secret<String>,
password: SecretString,
) -> Self {
let mut smtp_client = SmtpClientBuilder::new(host, port)
.credentials((user, password.expose_secret().into()))
Expand All @@ -206,7 +206,7 @@ impl SmtpMailer {
port: u16,
invalid_certs: SmtpInvalidCertsPolicy,
user: String,
password: Secret<String>,
password: SecretString,
) -> BoxMailer {
Box::new(Self::new(host, port, invalid_certs, user, password))
}
Expand All @@ -218,7 +218,7 @@ impl SmtpMailer {
port: u16,
invalid_certs: SmtpInvalidCertsPolicy,
user: String,
password: Secret<String>,
password: SecretString,
) -> ArcMailer {
Arc::new(Self::new(host, port, invalid_certs, user, password))
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//! let mailer: OutlookMailer = OutlookMailer::new(
//! "<Microsoft Identity service tenant>".into(),
//! "<OAuth2 app GUID>".into(),
//! async_mailer::Secret::new("<OAuth2 app secret>".into())
//! async_mailer::SecretString::from("<OAuth2 app secret>")
//! ).await?;
//!
//! // Alternative:
Expand All @@ -49,7 +49,7 @@
//! 465,
//! async_mailer::SmtpInvalidCertsPolicy::Deny,
//! "<username>".into(),
//! async_mailer::Secret::new("<password>".into())
//! async_mailer::SecretString::from("<password>")
//! );
//!
//! // Further alternative mailers can be implemented by third parties.
Expand Down Expand Up @@ -85,7 +85,7 @@
//! let mailer: BoxMailer = OutlookMailer::new_box( // Or `OutlookMailer::new_arc()`.
//! "<Microsoft Identity service tenant>".into(),
//! "<OAuth2 app GUID>".into(),
//! async_mailer::Secret::new("<OAuth2 app secret>".into())
//! async_mailer::SecretString::from("<OAuth2 app secret>")
//! ).await?;
//!
//! // Alternative:
Expand All @@ -95,7 +95,7 @@
//! 465,
//! async_mailer::SmtpInvalidCertsPolicy::Deny,
//! "<username>".into(),
//! async_mailer::Secret::new("<password>".into())
//! async_mailer::SecretString::from("<password>")
//! );
//!
//! // Further alternative mailers can be implemented by third parties.
Expand Down Expand Up @@ -142,7 +142,7 @@
//!
//! [docs]: https://docs.rs/async-mailer
pub use secrecy::Secret;
pub use secrecy::SecretString;

pub use async_mailer_core::mail_send;
pub use async_mailer_core::mail_send::mail_builder;
Expand Down

0 comments on commit d2651a6

Please sign in to comment.