Skip to main content

NodeAuth

Trait NodeAuth 

Source
pub trait NodeAuth {
    // Required methods
    fn local_binding(
        &self,
        local_node: &[u8; 32],
        now_ms: i64,
    ) -> Result<Vec<u8>>;
    fn authorize(
        &self,
        binding: &[u8],
        remote_node: &[u8; 32],
        now_ms: i64,
    ) -> Result<bool>;
}
Expand description

The account-authorization capability the transport needs from the store: mint our own binding, and verify a peer’s. Both resolve against the store’s account + live fold; kept separate from crate::session::SyncStore so the auth phase is testable without the data-phase machinery.

Required Methods§

Source

fn local_binding(&self, local_node: &[u8; 32], now_ms: i64) -> Result<Vec<u8>>

Our signed binding vouching that local_node is this account’s local device, stamped now_ms. Err if this store cannot authorize (e.g. no local account/device yet — the onboarding case).

Source

fn authorize( &self, binding: &[u8], remote_node: &[u8; 32], now_ms: i64, ) -> Result<bool>

Whether binding authorizes a peer whose iroh-authenticated node key is remote_node, judged fresh against now_ms. Returns a plain bool — the store collapses the internal failure taxonomy so the wire stays uniform. Err is reserved for a real fault (e.g. the DB read failed), not a rejected peer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§