diff --git a/nostr/CHANGELOG.md b/nostr/CHANGELOG.md index 339179e6f..5d7ada8a9 100644 --- a/nostr/CHANGELOG.md +++ b/nostr/CHANGELOG.md @@ -27,6 +27,12 @@ --> +## Unreleased + +### Fixed + +- The `Display` implementations of `NostrConnectMessage` redact the sensitive data (https://github.com/nostrdevkit/nostr/pull/1432) + ## v0.45.0 - 2026/08/05 ### Breaking changes diff --git a/nostr/src/nips/nip46.rs b/nostr/src/nips/nip46.rs index 5a563f720..de8f40d47 100644 --- a/nostr/src/nips/nip46.rs +++ b/nostr/src/nips/nip46.rs @@ -656,8 +656,9 @@ impl fmt::Debug for NostrConnectMessage { } impl fmt::Display for NostrConnectMessage { + #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.as_json()) + fmt::Debug::fmt(self, f) } } diff --git a/signer/nostr-connect/CHANGELOG.md b/signer/nostr-connect/CHANGELOG.md index df3b2fc96..13a472a03 100644 --- a/signer/nostr-connect/CHANGELOG.md +++ b/signer/nostr-connect/CHANGELOG.md @@ -27,6 +27,12 @@ --> +## Unreleased + +### Fixed + +- Log the parsed `NostrConnectMessage` to redact sensitive data, instead of the raw decrypted message (https://github.com/nostrdevkit/nostr/pull/1432) + ## v0.45.0 - 2026/08/05 ### Breaking changes diff --git a/signer/nostr-connect/src/client.rs b/signer/nostr-connect/src/client.rs index fba82c7b7..94202e37b 100644 --- a/signer/nostr-connect/src/client.rs +++ b/signer/nostr-connect/src/client.rs @@ -409,14 +409,15 @@ async fn get_remote_signer_public_key( Err(_) => continue, }; - tracing::debug!("Received Nostr Connect message: '{msg}'"); - // Parse message let msg: NostrConnectMessage = match NostrConnectMessage::from_json(msg) { Ok(m) => m, Err(_) => continue, }; + // The Debug and Display implementations of NostrConnectMessage redact the sensitive data. + tracing::debug!("Received Nostr Connect message: '{msg}'"); + // Check if it's a `connect` response. // // Per NIP-46, for nostrconnect:// (client-initiated) connections the signer