From 27d9f85031bfd3e746c68013770efbc11dfbe95e Mon Sep 17 00:00:00 2001 From: Lohachov Mykhailo Date: Tue, 10 Dec 2024 15:52:05 +0900 Subject: [PATCH] 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 }