pub struct SignalBridge { /* private fields */ }Expand description
Main bridge between C++ and Rust Signal Protocol implementation
Implementations§
Source§impl SignalBridge
impl SignalBridge
pub async fn new(db_path: &str) -> Result<Self, SignalBridgeError>
pub async fn encrypt_message( &mut self, peer: &str, plaintext: &[u8], ) -> Result<Vec<u8>, SignalBridgeError>
pub async fn decrypt_message( &mut self, peer_hint: &str, ciphertext_bytes: &[u8], ) -> Result<DecryptionResult, SignalBridgeError>
pub async fn establish_session( &mut self, peer: &str, pre_key_bundle_bytes: &[u8], ) -> Result<(), SignalBridgeError>
pub async fn generate_pre_key_bundle( &mut self, ) -> Result<(Vec<u8>, u32, u32, u32), SignalBridgeError>
pub async fn cleanup_all_sessions(&mut self) -> Result<(), SignalBridgeError>
pub async fn clear_peer_session( &mut self, peer: &str, ) -> Result<(), SignalBridgeError>
pub async fn clear_all_sessions(&mut self) -> Result<(), SignalBridgeError>
pub async fn reset_identity(&mut self) -> Result<(), SignalBridgeError>
pub async fn derive_nostr_keypair(&mut self) -> Result<Keys, SignalBridgeError>
pub async fn derive_peer_nostr_key( &mut self, peer: &str, ) -> Result<Vec<u8>, SignalBridgeError>
pub async fn create_subscription_for_self( &mut self, subscription_id: &str, since_timestamp: u64, ) -> Result<String, SignalBridgeError>
pub async fn update_last_message_timestamp( &mut self, timestamp: u64, ) -> Result<(), SignalBridgeError>
pub async fn generate_prekey_bundle_announcement( &mut self, project_version: &str, ) -> Result<BundleInfo, SignalBridgeError>
pub async fn generate_empty_bundle_announcement( &mut self, project_version: &str, ) -> Result<String, SignalBridgeError>
pub async fn add_contact_and_establish_session( &mut self, bundle_bytes: &[u8], user_alias: Option<&str>, ) -> Result<String, SignalBridgeError>
pub async fn sign_nostr_event( &mut self, created_at: u64, kind: u32, tags: Vec<Vec<String>>, content: &str, ) -> Result<(String, String, String), SignalBridgeError>
pub async fn generate_node_fingerprint( &mut self, ) -> Result<String, SignalBridgeError>
pub async fn add_contact_from_bundle( &mut self, bundle_bytes: &[u8], user_alias: Option<&str>, ) -> Result<String, SignalBridgeError>
pub async fn lookup_contact( &mut self, identifier: &str, ) -> Result<ContactInfo, SignalBridgeError>
pub async fn assign_contact_alias( &mut self, identifier: &str, new_alias: &str, ) -> Result<(), SignalBridgeError>
pub async fn list_contacts( &mut self, ) -> Result<Vec<ContactInfo>, SignalBridgeError>
Sourcepub async fn perform_key_maintenance(
&mut self,
) -> Result<KeyMaintenanceResult, SignalBridgeError>
pub async fn perform_key_maintenance( &mut self, ) -> Result<KeyMaintenanceResult, SignalBridgeError>
Perform periodic key maintenance including rotation, cleanup, and replenishment.
This should be called periodically (e.g., hourly) to maintain proper key hygiene. It will:
- Rotate signed pre-keys if they are older than the rotation interval
- Rotate Kyber pre-keys if they are older than the rotation interval
- Clean up expired signed pre-keys past the grace period
- Replenish one-time pre-keys if the count drops below the threshold
Returns a KeyMaintenanceResult indicating which keys were rotated/replenished.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SignalBridge
impl RefUnwindSafe for SignalBridge
impl Send for SignalBridge
impl Sync for SignalBridge
impl Unpin for SignalBridge
impl UnwindSafe for SignalBridge
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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