pub struct GrantedSecret {
pub value: Secret,
pub expires_at: Instant,
}Expand description
A resolved secret value delivered to a sub-agent loop, paired with the absolute instant its originating grant expires.
Sent over the secret_tx/secret_rx channel
(see SubAgentHandle::secret_tx) instead of a
bare Secret so the spawned agent loop task — which has no further access to the
manager-side PermissionGrants once the value is delivered — can still re-validate the
TTL locally before every tool call and evict the value once it expires.
§Examples
use std::time::{Duration, Instant};
use zeph_common::secret::Secret;
use zeph_subagent::grants::GrantedSecret;
let granted = GrantedSecret {
value: Secret::new("sekrit"),
expires_at: Instant::now() + Duration::from_mins(5),
};
assert!(!granted.is_expired());Fields§
§value: SecretThe resolved vault secret value.
expires_at: InstantThe absolute instant after which this value must no longer be used.
Implementations§
Source§impl GrantedSecret
impl GrantedSecret
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Returns true if expires_at has already passed.
§Examples
use std::time::{Duration, Instant};
use zeph_common::secret::Secret;
use zeph_subagent::grants::GrantedSecret;
let expired = GrantedSecret {
value: Secret::new("sekrit"),
expires_at: Instant::now().checked_sub(Duration::from_secs(1)).unwrap(),
};
assert!(expired.is_expired());Trait Implementations§
Auto Trait Implementations§
impl Freeze for GrantedSecret
impl RefUnwindSafe for GrantedSecret
impl Send for GrantedSecret
impl Sync for GrantedSecret
impl Unpin for GrantedSecret
impl UnsafeUnpin for GrantedSecret
impl UnwindSafe for GrantedSecret
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
Mutably borrows from an owned value. Read more
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> ⓘ
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 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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request