pub struct WanIdentityStore {
conn: Mutex<Connection>,
}Fields§
§conn: Mutex<Connection>Implementations§
Source§impl WanIdentityStore
impl WanIdentityStore
const AGENT_KEY_COLUMNS: &'static str = "public_key, private_key, imported, created_at"
Sourcepub fn open(path: &Path) -> Result<Self, StoreError>
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.
Sourcepub fn instance_ensure(&self, hostname: &str) -> Result<WanInstance, StoreError>
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.
fn instance_load(conn: &Connection) -> Result<Option<WanInstance>, StoreError>
Sourcepub fn agent_key_load(
&self,
agent_id: &str,
) -> Result<Option<WanAgentKey>, StoreError>
pub fn agent_key_load( &self, agent_id: &str, ) -> Result<Option<WanAgentKey>, StoreError>
An agent’s WAN key, if this store holds one.
fn agent_key_from_row(r: &Row<'_>, offset: usize) -> Result<WanAgentKey>
fn agent_key_load_locked( conn: &Connection, key: &str, ) -> Result<Option<WanAgentKey>, StoreError>
Sourcepub fn agent_keys_unpublished(
&self,
directory: &str,
) -> Result<Vec<(String, WanAgentKey)>, StoreError>
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.
Sourcepub fn agent_key_is_published_to(
&self,
agent_id: &str,
key: &WanAgentKey,
directory: &str,
) -> Result<bool, StoreError>
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).
fn fp_matches(key: &WanAgentKey, published_fp: Option<&str>) -> bool
Sourcepub fn agent_key_mark_published(
&self,
agent_id: &str,
public_key: &str,
directory: &str,
) -> Result<bool, StoreError>
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.
Sourcepub fn agent_key_ensure(
&self,
agent_id: &str,
import: Option<(&str, &str)>,
) -> Result<WanAgentKey, StoreError>
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.
Sourcepub fn peer_record_get(
&self,
instance_id: &str,
agent_id: &str,
channel: &str,
key_fp: &str,
) -> Result<Option<WanKeyRecord>, StoreError>
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.
Sourcepub fn peer_record_put(&self, record: &WanKeyRecord) -> Result<(), StoreError>
pub fn peer_record_put(&self, record: &WanKeyRecord) -> Result<(), StoreError>
Cache a record whose chain the caller has checked.
Sourcepub fn peer_cache_clear(&self) -> Result<(), StoreError>
pub fn peer_cache_clear(&self) -> Result<(), StoreError>
Forget every cached peer record — on logout or account switch (§2.3).
Sourcepub fn known_instance_observe(
&self,
instance_id: &str,
host_hint: &str,
now: i64,
) -> Result<KnownInstance, StoreError>
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.
Sourcepub fn known_instance_record_revocation_check(
&self,
instance_id: &str,
revoked: bool,
now: i64,
) -> Result<(), StoreError>
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.
Sourcepub fn seen_sig_contains(
&self,
instance_id: &str,
agent_id: &str,
msg_id: &str,
) -> Result<bool, StoreError>
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.
Sourcepub fn seen_sig_record(
&self,
instance_id: &str,
agent_id: &str,
msg_id: &str,
expires_at: i64,
now: i64,
) -> Result<(), StoreError>
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.
Sourcepub fn agent_keys_delete(&self, names: &[String]) -> Result<usize, StoreError>
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§
impl !Freeze for WanIdentityStore
impl RefUnwindSafe for WanIdentityStore
impl Send for WanIdentityStore
impl Sync for WanIdentityStore
impl Unpin for WanIdentityStore
impl UnsafeUnpin for WanIdentityStore
impl UnwindSafe for WanIdentityStore
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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