Skip to main content

CertmeshHandle

Struct CertmeshHandle 

Source
pub struct CertmeshHandle { /* private fields */ }

Implementations§

Source§

impl CertmeshHandle

Source

pub fn core(&self) -> Result<Arc<CertmeshCore>, KoiError>

Source

pub async fn status(&self) -> CapabilityStatus

Source

pub async fn posture(&self) -> Result<Posture, KoiError>

This node’s current trust posture — the mode oracle (ADR-020 §0).

Works in both modes (wishlist 1.3): embedded reads the live watch value; a remote handle queries the daemon’s GET /v1/certmesh/posture (DAT-gated, so the handle must carry a token — adopted from the local breadcrumb or set via Builder::service_token). A remote query needs the network, hence async.

Source

pub fn on_posture(&self) -> Result<Receiver<Posture>, KoiError>

Subscribe to live posture transitions — a tokio::sync::watch receiver that fires on every Open↔Authenticated flip (ADR-020 §5 / wishlist 5.2).

Ergonomic shorthand for certmesh()?.core()?.watch_posture(). Embedded only; returns DisabledCapability in Remote mode.

Source

pub async fn local_identity(&self) -> Result<Option<Identity>, KoiError>

This node’s live identity, or None if it is Open (ADR-020 §7). Read-only; embedded only.

Source

pub async fn ensure_identity(&self) -> Result<Option<Identity>, KoiError>

Ensure this node holds a current identity, then return it (ADR-020 §7). Idempotent and mode-transparent; embedded only.

Source

pub async fn sign(&self, bytes: &[u8]) -> Result<Envelope, KoiError>

Sign bytes into an Envelope (ADR-020 §3). Mode-transparent: a freshness-stamped passthrough when Open, ES256-signed when Authenticated. Embedded only.

Source

pub async fn verify(&self, env: &Envelope) -> Result<Assurance, KoiError>

Verify an Envelope, returning an Assurance (ADR-020 §3). Read a trusted identity only via Assurance::identity(). Embedded only.

Source

pub async fn seal(&self, bytes: &[u8]) -> Result<Sealed, KoiError>

Seal bytes into a Sealed (ADR-020 §4). The confidentiality rung, today a signed-not-encrypted passthrough; the consumer codes against the final API now. Embedded only.

Source

pub async fn open(&self, sealed: &Sealed) -> Result<Opened, KoiError>

Open a SealedOpened (recovered bytes + trust state, ADR-020 §4). A tampered/rejected message errors rather than yielding bytes. Embedded only.

Source

pub async fn diagnose(&self) -> Result<TrustDiagnosis, KoiError>

Run the trust-doctor (ADR-020 §13) → a structured TrustDiagnosis: posture, identity + renewal health, on-disk-leaf integrity, self-revocation, and the CA trust-install state, each with an exact remedy. is_red()/exit_code() fail loud. Embedded only.

Source

pub async fn client_for(&self, peer: &Peer) -> Result<PeerClient, KoiError>

Build a posture-keyed client to a discovered Peer (ADR-020 §6): plain HTTP to an Open peer, mTLS to a secure peer — the caller writes one code path. Embedded only (a remote handle has no local identity to present).

Errors loudly (not via an opaque handshake failure) when the peer requires authentication but this node is Open, or when the peer anchors to a different mesh — see koi_certmesh::CertmeshCore::client_for.

Source

pub async fn reqwest_client_for(&self, peer: &Peer) -> Result<Client, KoiError>

Build a posture-keyed reqwest::Client for a discovered Peer — the full-traffic dual of client_for (wishlist 3.1).

Unlike PeerClient (GET + JSON-POST only), the returned reqwest::Client carries koi’s transport policy (plain HTTP to an Open peer; mTLS presenting this node’s leaf + pinning the mesh CA to a secure peer) while the consumer drives the full request surface itself — every verb, custom headers, SSE/streaming, large bodies. One mode-transparent client for all inter-node traffic, not just trivial GETs.

An Open peer yields a plain reqwest::Client (no TLS); a secure peer yields one configured with use_preconfigured_tls. Same loud errors as client_for (missing identity, different mesh). Embedded only.

The raw rustls::ClientConfig is available via certmesh().core()?.tls_client_config_for(peer) for consumers driving hyper or a tower service directly.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

impl<T> Instrument for T

Source§

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

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

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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

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

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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