Skip to content

Commit b154f5d

Browse files
committed
chore: Bump secrecy
1 parent ca86578 commit b154f5d

File tree

22 files changed

+45
-60
lines changed

22 files changed

+45
-60
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ mime = "0.3"
2626
minidom = "0.16"
2727
parking_lot = "0.12"
2828
pretty_assertions = "1.4"
29-
secrecy = "0.8"
29+
secrecy = "0.10"
3030
serde = "1.0"
3131
serde_json = "1.0"
3232
sha1 = "0.10"

bindings/prose-sdk-ffi/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use prose_core_client::infra::encryption::{EncryptionKeysRepository, SessionRepo
1515
use prose_core_client::infra::general::OsRngProvider;
1616
use prose_core_client::{
1717
open_store, Client as ProseClient, ClientDelegate as ProseClientDelegate, FsAvatarRepository,
18-
PlatformDriver, Secret, SignalServiceHandle,
18+
PlatformDriver, SignalServiceHandle,
1919
};
2020
use prose_xmpp::{connector, ConnectionError};
2121

@@ -85,7 +85,7 @@ impl Client {
8585
self.client()
8686
.await
8787
.map_err(|e| ConnectionError::Generic { msg: e.to_string() })?
88-
.connect(&self.jid.to_bare().unwrap().into(), Secret::new(password))
88+
.connect(&self.jid.to_bare().unwrap().into(), password.into())
8989
.await?;
9090
Ok(())
9191
}

bindings/prose-sdk-js/src/client.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use wasm_bindgen::prelude::*;
1616

1717
use prose_core_client::dtos::{MucId, SoftwareVersion, UserStatus};
1818
use prose_core_client::infra::encryption::{EncryptionKeysRepository, SessionRepository};
19-
use prose_core_client::{
20-
open_store, Client as ProseClient, PlatformDriver, Secret, StoreAvatarRepository,
21-
};
19+
use prose_core_client::{open_store, Client as ProseClient, PlatformDriver, StoreAvatarRepository};
2220

2321
use crate::connector::{Connector, ProseConnectionProvider};
2422
use crate::delegate::{Delegate, JSDelegate};
@@ -208,9 +206,7 @@ impl Client {
208206
jid: &BareJid,
209207
password: &str,
210208
) -> std::result::Result<(), ConnectionError> {
211-
self.client
212-
.connect(&jid.into(), Secret::new(password.to_string()))
213-
.await?;
209+
self.client.connect(&jid.into(), password.into()).await?;
214210
Ok(())
215211
}
216212

bindings/prose-sdk-js/src/connector/strophe_js.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use anyhow::Result;
1010
use async_trait::async_trait;
1111
use jid::FullJid;
1212
use minidom::Element;
13-
use secrecy::{ExposeSecret, Secret};
13+
use secrecy::{ExposeSecret, SecretString};
1414
use thiserror::Error;
1515
use wasm_bindgen::prelude::*;
1616
use wasm_bindgen_futures::spawn_local;
@@ -96,7 +96,7 @@ impl ConnectorTrait for Connector {
9696
async fn connect(
9797
&self,
9898
jid: &FullJid,
99-
password: Secret<String>,
99+
password: SecretString,
100100
event_handler: ConnectionEventHandler,
101101
) -> Result<Box<dyn ConnectionTrait>, ConnectionError> {
102102
let client = Rc::new(self.provider.provide_connection(self.config.clone()));

crates/prose-core-client/src/app/services/connection_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// License: Mozilla Public License v2.0 (MPL v2.0)
55

66
use chrono::{DateTime, Utc};
7-
use secrecy::Secret;
7+
use secrecy::SecretString;
88
use tracing::{error, info, warn};
99

1010
use prose_proc_macros::InjectDependencies;
@@ -60,7 +60,7 @@ impl ConnectionService {
6060
pub async fn connect(
6161
&self,
6262
user_id: &UserId,
63-
password: Secret<String>,
63+
password: SecretString,
6464
) -> Result<(), ConnectionError> {
6565
self.ctx.set_connection_state(ConnectionState::Connecting);
6666
self.offline_messages_repo.drain();

crates/prose-core-client/src/client.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::ops::Deref;
77
use std::sync::Arc;
88

99
use anyhow::Result;
10-
use secrecy::Secret;
10+
use secrecy::SecretString;
1111

1212
use crate::app::deps::DynAppContext;
1313
use prose_wasm_utils::{SendUnlessWasm, SyncUnlessWasm};
@@ -74,7 +74,7 @@ impl Client {
7474
pub async fn connect(
7575
&self,
7676
id: &UserId,
77-
password: Secret<String>,
77+
password: SecretString,
7878
) -> Result<(), ConnectionError> {
7979
self.connection.connect(id, password).await
8080
}

crates/prose-core-client/src/domain/connection/services/connection_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use anyhow::Result;
77
use async_trait::async_trait;
8-
use secrecy::Secret;
8+
use secrecy::SecretString;
99

1010
use prose_wasm_utils::{SendUnlessWasm, SyncUnlessWasm};
1111
use prose_xmpp::ConnectionError;
@@ -20,7 +20,7 @@ pub trait ConnectionService: SendUnlessWasm + SyncUnlessWasm {
2020
async fn connect(
2121
&self,
2222
jid: &UserResourceId,
23-
password: Secret<String>,
23+
password: SecretString,
2424
) -> Result<(), ConnectionError>;
2525
async fn disconnect(&self);
2626

crates/prose-core-client/src/infra/connection/connection_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use anyhow::{anyhow, Result};
77
use async_trait::async_trait;
88
use chrono::Utc;
9-
use secrecy::Secret;
9+
use secrecy::SecretString;
1010
use tracing::{info, warn};
1111

1212
use prose_xmpp::{mods, ns, ConnectionError};
@@ -23,7 +23,7 @@ impl ConnectionService for XMPPClient {
2323
async fn connect(
2424
&self,
2525
jid: &UserResourceId,
26-
password: Secret<String>,
26+
password: SecretString,
2727
) -> Result<(), ConnectionError> {
2828
self.client.connect(jid.as_ref(), password).await
2929
}

crates/prose-core-client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
extern crate core;
77

8-
pub use secrecy::Secret;
8+
pub use secrecy::SecretString;
99

1010
pub use app::deps::{DynEncryptionKeysRepository, DynSessionRepository};
1111
pub use app::{dtos, services};

crates/prose-core-client/tests/connection_service.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::sync::{Arc, OnceLock};
77

88
use anyhow::Result;
99
use mockall::predicate;
10-
use secrecy::{ExposeSecret, Secret};
10+
use secrecy::{ExposeSecret, SecretString};
1111

1212
use prose_core_client::app::deps::DynAppContext;
1313
use prose_core_client::app::services::ConnectionService;
@@ -65,7 +65,7 @@ async fn test_starts_available_and_generates_resource() -> Result<()> {
6565
.once()
6666
.with(
6767
predicate::eq(user_resource_id!("[email protected]/resource-id")),
68-
predicate::function(|pw: &Secret<String>| pw.expose_secret().as_str() == "my-password"),
68+
predicate::function(|pw: &SecretString| pw.expose_secret() == "my-password"),
6969
)
7070
.return_once(|_, _| Box::pin(async { Ok(Default::default()) }));
7171
deps.contact_list_domain_service
@@ -138,10 +138,7 @@ async fn test_starts_available_and_generates_resource() -> Result<()> {
138138
assert!(deps.ctx.muc_service().is_err());
139139

140140
service
141-
.connect(
142-
&user_id!("[email protected]"),
143-
Secret::new("my-password".to_string()),
144-
)
141+
.connect(&user_id!("[email protected]"), "my-password".into())
145142
.await?;
146143

147144
assert_eq!(
@@ -268,10 +265,7 @@ async fn test_restores_availability_and_resource() -> Result<()> {
268265
let service = ConnectionService::from(&deps);
269266

270267
service
271-
.connect(
272-
&user_id!("[email protected]"),
273-
Secret::new("my-password".to_string()),
274-
)
268+
.connect(&user_id!("[email protected]"), "my-password".into())
275269
.await?;
276270

277271
Ok(())
@@ -325,10 +319,7 @@ async fn test_connection_failure() -> Result<()> {
325319
assert!(deps.ctx.muc_service().is_err());
326320

327321
assert!(service
328-
.connect(
329-
&user_id!("[email protected]"),
330-
Secret::new("my-password".to_string())
331-
)
322+
.connect(&user_id!("[email protected]"), "my-password".into())
332323
.await
333324
.is_err());
334325

0 commit comments

Comments
 (0)