str0m_proto/sha1.rs
1use std::fmt::Debug;
2
3/// Marker trait for types that are safe to use in crypto provider components.
4///
5/// This trait combines the common bounds required for crypto provider trait objects:
6/// - [`Send`] + [`Sync`]: Thread-safe
7/// - [`Debug`]: Support debugging
8///
9/// Note: We don't require `UnwindSafe` because some error types (like `dimpl::Error`)
10/// may not implement it, but they're still safe to use in our context.
11pub trait CryptoSafe: Send + Sync + Debug {}
12
13/// Blanket implementation: any type satisfying the bounds implements [`CryptoSafe`].
14impl<T: Send + Sync + Debug> CryptoSafe for T {}
15
16/// SHA1 HMAC provider for STUN message integrity.
17pub trait Sha1HmacProvider: CryptoSafe {
18 /// Compute HMAC-SHA1(key, payloads) and return the result.
19 fn sha1_hmac(&self, key: &[u8], payloads: &[&[u8]]) -> [u8; 20];
20}