pub struct SecurityConfig {
pub require_transport_identity: bool,
}Expand description
Security configuration for transport and control-message hardening.
Fields§
§require_transport_identity: boolWhen true, control messages with no transport-level peer identity
(transport_peer_id is None) are rejected. When false (default),
missing transport identity emits a SecurityWarning but allows the
message through (best-effort / fail-open).
§Why the default (false) is not the weak setting it once was
This flag used to carry real weight, because a forged sender was
otherwise cheap: identities were app-chosen strings and the only thing
standing behind one was a trust-on-first-use pin, so first contact with
any peer was open to a man-in-the-middle and transport identity was the
only independent corroboration available.
Under self-certifying addressing it is not. Every security-gated control
frame must now carry an Ed25519 signature — unconditionally, no longer
gated on this flag — and the signing key must derive to the address in
sender. A forged sender therefore requires the private key behind
that address, on first contact as much as on the thousandth. Transport
identity adds no authenticity on top of that; it only cross-checks a
claim the signature already proved.
The strict match on frames claiming direct origin (hop_count == 0) runs
regardless of this flag, as it always has, and is unaffected.
§What enabling it still does, and what it costs
Exactly one thing: control frames arriving with no transport identity at all are rejected instead of falling through to the signature gate.
That is a real cost with no matching benefit on most deployments. Nostr
frames carry no transport identity by construction — the Nostr pubkey is
an install signing key, not the protocol id, so attaching it would fail
the strict match (see nostr_message_received_inner) — and relay frames
that arrive without a named sender are in the same position. Turning this
on rejects every control message on those paths, including the
key-package exchange that cold contact depends on. Mesh-forwarded frames
re-created by intermediate nodes legitimately lack identity too.
Set to true only on a deployment that runs neither Nostr nor
sender-less relay delivery, and wants frames without transport identity
refused as a matter of policy rather than of authentication.
Trait Implementations§
Source§impl Clone for SecurityConfig
impl Clone for SecurityConfig
Source§fn clone(&self) -> SecurityConfig
fn clone(&self) -> SecurityConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SecurityConfig
impl Debug for SecurityConfig
Source§impl Default for SecurityConfig
impl Default for SecurityConfig
Source§fn default() -> SecurityConfig
fn default() -> SecurityConfig
Source§impl<'de> Deserialize<'de> for SecurityConfig
impl<'de> Deserialize<'de> for SecurityConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SecurityConfig
impl RefUnwindSafe for SecurityConfig
impl Send for SecurityConfig
impl Sync for SecurityConfig
impl Unpin for SecurityConfig
impl UnsafeUnpin for SecurityConfig
impl UnwindSafe for SecurityConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more