Skip to main content

HostedSession

Struct HostedSession 

Source
pub struct HostedSession { /* private fields */ }
Expand description

A validated, connectable hosted-session configuration.

Building runs the fallible TLS/auth validation up front, so callers that must not leave partial on-disk artifacts (clone, push) — or that build the config on one thread and connect on another (lazy hydration) — can prevalidate before any irreversible work, then connect() afterwards. Callers with no such ordering constraint use HostedGrpcClient::open_session, which builds and connects in one call.

Implementations§

Source§

impl HostedSession

Source

pub fn build_stored_credential( user_config: &UserConfig, server_key: &str, ) -> Result<HostedSession, Error>

Build a session from the exact stored authority credential selected by an auth command. Unlike CredentialFallback, configured/env tokens cannot replace the selected bearer. The matching device proof key is required and validated before the command performs any mutation.

Source

pub fn build( user_config: &UserConfig, server_key: Option<String>, ) -> Result<HostedSession, Error>

Resolve auth + build the validated client config for a hosted session. Runs the single resolve_hosted_credential precedence (HEDDLE_CREDENTIAL → keystore → unauthenticated), server-key attachment, and proof-key attachment from either the resolved credential or the matching shared same-host device identity — the assembly the command modules used to hand-roll.

Source

pub fn with_allow_insecure(self, allow: bool) -> HostedSession

Explicitly allow cleartext to non-loopback hosts for this session (CLI --insecure or remote insecure = true). Does not disable an allow already set via user config / env.

Source

pub async fn connect( &self, addr: SocketAddr, ) -> Result<HostedGrpcClient, ProtocolError>

Connect and evaluate renewal for an eligible stored authority token.

The eligibility check runs immediately after connect and requires the active bearer to remain byte-for-byte identical to the stored one-block authority credential selected during HostedSession::build. Explicit config/env and attenuated tokens are never rotated here.

Source

pub async fn connect_channel( &self, channel: Channel, ) -> Result<HostedGrpcClient, ProtocolError>

Finish a validated session over a channel whose URI/TLS policy was already established by the auth command’s endpoint connector.

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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