pub struct Caller {
pub subject: SubjectRef,
pub groups: Vec<String>,
pub surface: SurfaceKind,
pub origin: Origin,
pub presence_confirmed: bool,
pub paired_local: bool,
pub device: Option<String>,
}Expand description
The authenticated caller of an engine read or command (spec 3.3 §6, §11 S-I8).
The subject and its groups come from the server’s authentication, never from a request
body. So do the two facts that widen what a caller may decide —
presence_confirmed and paired_local —
which the web router reads from the request context the server’s extractor built. The
surface and origin a client declares can only narrow what it may decide: no surface allows
more than the web home.
§Example
use adk_surface::{Caller, Origin, SurfaceKind};
let caller = Caller::human("ana", SurfaceKind::Chat, Origin::Chat { channel: "Telegram".into() });
assert_eq!(caller.subject.id, "ana");
assert!(!caller.presence_confirmed);Fields§
§subject: SubjectRefWho: the session owner a surface checks every read and command against (S-I8).
groups: Vec<String>The groups authentication established, for the approval service’s eligibility check.
surface: SurfaceKindThe surface.
origin: OriginHow the input was given.
presence_confirmed: boolThe person confirmed it is them just now (a passkey or the device’s lock), which high-risk approvals on the web home and the phone need (spec 3.3 §7.2, §8.2).
paired_local: boolA terminal on the kernel’s own machine, paired, which may approve high-risk calls and resume after a stop (spec 3.3 §7.2, §11 S-I10).
device: Option<String>The paired device the caller acts from, when it authenticated with a device token (spec 3.3 §10 K2, §11): it reaches every audit record, so “Where you can say yes from” and the record name the device.
Implementations§
Source§impl Caller
impl Caller
Sourcepub fn human(
user_id: impl Into<String>,
surface: SurfaceKind,
origin: Origin,
) -> Self
pub fn human( user_id: impl Into<String>, surface: SurfaceKind, origin: Origin, ) -> Self
A person, by their user id.
Sourcepub fn with_groups(
self,
groups: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_groups( self, groups: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Sets the groups.
Sourcepub fn with_presence_confirmed(self) -> Self
pub fn with_presence_confirmed(self) -> Self
Marks that the person confirmed it is them just now. Set only from server-side authentication.
Sourcepub fn with_paired_local(self) -> Self
pub fn with_paired_local(self) -> Self
Marks a paired local terminal. Set only from the transport (the kernel’s socket or pipe) or a device token scoped to it.
Sourcepub fn with_device(self, id: impl Into<String>) -> Self
pub fn with_device(self, id: impl Into<String>) -> Self
Sets the paired device the caller acts from (spec 3.3 §10 K2, §11). Set only from server-side authentication: a device token’s context.
§Example
use adk_surface::{Caller, Origin, SurfaceKind};
let caller = Caller::human("ana", SurfaceKind::Phone, Origin::Touch).with_device("dev_1");
assert_eq!(caller.device.as_deref(), Some("dev_1"));Trait Implementations§
impl Eq for Caller
impl StructuralPartialEq for Caller
Auto Trait Implementations§
impl Forget for Caller
impl Freeze for Caller
impl Move for Caller
impl RefUnwindSafe for Caller
impl Send for Callerwhere
RawVecInner: Send,
impl Sync for Callerwhere
RawVecInner: Sync,
impl Unpin for Caller
impl UnsafeUnpin for Callerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
impl UnwindSafe for Callerwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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