From 3366c7cbf7d4efcdbf63fc132360e66e2173a5f8 Mon Sep 17 00:00:00 2001 From: Lohachov Mykhailo Date: Tue, 10 Dec 2024 15:52:05 +0900 Subject: [PATCH 1/2] fix: make secret string public Signed-off-by: Lohachov Mykhailo --- crates/iroha/src/lib.rs | 2 +- crates/iroha/src/secrecy.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/iroha/src/lib.rs b/crates/iroha/src/lib.rs index 02c3553fb1d..fe29f02d3fd 100644 --- a/crates/iroha/src/lib.rs +++ b/crates/iroha/src/lib.rs @@ -5,7 +5,7 @@ pub mod config; pub mod http; mod http_default; pub mod query; -mod secrecy; +pub mod secrecy; pub use iroha_crypto as crypto; pub use iroha_data_model as data_model; diff --git a/crates/iroha/src/secrecy.rs b/crates/iroha/src/secrecy.rs index cdba906f476..ed6f5f10499 100644 --- a/crates/iroha/src/secrecy.rs +++ b/crates/iroha/src/secrecy.rs @@ -1,12 +1,15 @@ +//! Types for representing securely printable secrets. use std::fmt; use derive_more::Constructor; use serde::{Deserialize, Serialize, Serializer}; +/// SecretString epresents a sensitive secret string. #[derive(Clone, Deserialize, Constructor)] pub struct SecretString(String); impl SecretString { + /// Returns underlying secret string pub fn expose_secret(&self) -> &str { &self.0 } From 1cf6661de81bc5938db11c270033fc0f6b8209d6 Mon Sep 17 00:00:00 2001 From: Mykhailo Lohachov Date: Tue, 10 Dec 2024 17:29:14 +0900 Subject: [PATCH 2/2] fix: Update crates/iroha/src/secrecy.rs Co-authored-by: Shunkichi Sato <49983831+s8sato@users.noreply.github.com> Signed-off-by: Mykhailo Lohachov --- crates/iroha/src/secrecy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iroha/src/secrecy.rs b/crates/iroha/src/secrecy.rs index ed6f5f10499..08036233318 100644 --- a/crates/iroha/src/secrecy.rs +++ b/crates/iroha/src/secrecy.rs @@ -4,7 +4,7 @@ use std::fmt; use derive_more::Constructor; use serde::{Deserialize, Serialize, Serializer}; -/// SecretString epresents a sensitive secret string. +/// String sensitive to printing and serialization #[derive(Clone, Deserialize, Constructor)] pub struct SecretString(String);