Skip to main content

WanIdentityStore

Struct WanIdentityStore 

Source
pub struct WanIdentityStore {
    conn: Mutex<Connection>,
}

Fields§

§conn: Mutex<Connection>

Implementations§

Source§

impl WanIdentityStore

Source

const AGENT_KEY_COLUMNS: &'static str = "public_key, private_key, imported, created_at"

Source

pub fn open(path: &Path) -> Result<Self, StoreError>

Open (creating if needed) the store at path. Errors if the file can’t be opened or its schema can’t be ensured; the caller then runs without WAN identity.

Source

pub fn instance_ensure(&self, hostname: &str) -> Result<WanInstance, StoreError>

This install’s instance, minted on first call. hostname is read only at mint time and becomes the permanent host hint.

Source

fn instance_load(conn: &Connection) -> Result<Option<WanInstance>, StoreError>

Source

pub fn agent_key_load( &self, agent_id: &str, ) -> Result<Option<WanAgentKey>, StoreError>

An agent’s WAN key, if this store holds one.

Source

fn agent_key_from_row(r: &Row<'_>, offset: usize) -> Result<WanAgentKey>

Source

fn agent_key_load_locked( conn: &Connection, key: &str, ) -> Result<Option<WanAgentKey>, StoreError>

Source

pub fn agent_keys_unpublished( &self, directory: &str, ) -> Result<Vec<(String, WanAgentKey)>, StoreError>

Every agent key directory is not confirmed to hold, by agent id — what the publisher (muxbus/wan_publish.rs) works through.

Source

pub fn agent_key_is_published_to( &self, agent_id: &str, key: &WanAgentKey, directory: &str, ) -> Result<bool, StoreError>

Whether directory is confirmed to hold key, agent_id’s current key — the relay carry gate’s condition 4 (relay::wan_carry_gate).

Source

fn fp_matches(key: &WanAgentKey, published_fp: Option<&str>) -> bool

Source

pub fn agent_key_mark_published( &self, agent_id: &str, public_key: &str, directory: &str, ) -> Result<bool, StoreError>

Record that directory accepted public_key’s certificate. Only marks if the row still holds that key — an agent deleted and recreated while the PUT was in flight must not have its new key marked published on the strength of the old one’s. directory must be the one the PUT went to, so a PUT that returns after a sign-in to another account marks the old directory, not the new one.

Source

pub fn agent_key_ensure( &self, agent_id: &str, import: Option<(&str, &str)>, ) -> Result<WanAgentKey, StoreError>

An agent’s WAN key, created on first call: import (the agent’s key from this version’s db_agent_wan_keys, read by the caller) is carried over if given, otherwise a fresh key is minted. Only the first call for an agent decides — after that, import is ignored, so an agent keeps one key across upgrades. Case-insensitive, like every key table.

Source

pub fn peer_record_get( &self, instance_id: &str, agent_id: &str, channel: &str, key_fp: &str, ) -> Result<Option<WanKeyRecord>, StoreError>

A cached directory record for exactly this (instance, agent, channel, fingerprint). The caller re-checks its chain; a row that no longer parses is treated as absent.

Source

pub fn peer_record_put(&self, record: &WanKeyRecord) -> Result<(), StoreError>

Cache a record whose chain the caller has checked.

Source

pub fn peer_cache_clear(&self) -> Result<(), StoreError>

Forget every cached peer record — on logout or account switch (§2.3).

Source

pub fn known_instance_observe( &self, instance_id: &str, host_hint: &str, now: i64, ) -> Result<KnownInstance, StoreError>

Record instance_id as seen (first sight inserts it) and return what is known about it.

Source

pub fn known_instance_record_revocation_check( &self, instance_id: &str, revoked: bool, now: i64, ) -> Result<(), StoreError>

Record a revocation-status check. revoked is sticky: a later check that says “not revoked” never clears it.

Source

pub fn seen_sig_contains( &self, instance_id: &str, agent_id: &str, msg_id: &str, ) -> Result<bool, StoreError>

Whether this (instance, agent, msgid) was already delivered.

Source

pub fn seen_sig_record( &self, instance_id: &str, agent_id: &str, msg_id: &str, expires_at: i64, now: i64, ) -> Result<(), StoreError>

Record a delivered signature until expires_at, and prune the rows that could no longer pass freshness at now — the same clock the verifier’s freshness check used, so a row is never pruned while its message could still verify.

Source

pub fn agent_keys_delete(&self, names: &[String]) -> Result<usize, StoreError>

Delete the keys filed under each name (folded as the key tables fold). The agent-delete purge (storage/agents/name_keys.rs) passes exactly the names it decided no other agent signs under, so a later agent that takes a name never inherits the dead agent’s key. Returns rows removed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more