Struct ApprovalPrincipal
pub struct ApprovalPrincipal {
pub source: ApprovalSource,
pub identity: Option<String>,
pub channel: Option<String>,
}Expand description
WHO resolved a gate and from WHERE. Recorded into the append-only ledger.
Fields§
§source: ApprovalSource§identity: Option<String>Best-effort identity: pairing subject / bearer principal / agent alias /
OS user for the loopback CLI. None for the system tick. Recorded, not trusted.
channel: Option<String>The back-channel that answered (WS connection id, “cli”, agent name).
Implementations§
Source§impl ApprovalPrincipal
impl ApprovalPrincipal
Sourcepub fn agent(agent_alias: &str) -> ApprovalPrincipal
pub fn agent(agent_alias: &str) -> ApprovalPrincipal
The in-agent tool. Constructed inside sop_approve ONLY, so the agent can
never claim another source.
Sourcepub fn cli(os_user: Option<String>) -> ApprovalPrincipal
pub fn cli(os_user: Option<String>) -> ApprovalPrincipal
The loopback CLI. Constructed in the gateway handler AFTER require_localhost.
Sourcepub fn ws(conn_id: String, subject: Option<String>) -> ApprovalPrincipal
pub fn ws(conn_id: String, subject: Option<String>) -> ApprovalPrincipal
The gateway WebSocket. Constructed from the resolved connection only.
Sourcepub fn http(subject: Option<String>) -> ApprovalPrincipal
pub fn http(subject: Option<String>) -> ApprovalPrincipal
The gateway HTTP route. Constructed from the resolved pairing subject only.
Sourcepub fn channel(channel_key: String, user: Option<String>) -> ApprovalPrincipal
pub fn channel(channel_key: String, user: Option<String>) -> ApprovalPrincipal
A chat-channel gate answer. channel_key is the answering channel
(discord.gnosis), user the platform user id that clicked/replied.
Sourcepub fn system() -> ApprovalPrincipal
pub fn system() -> ApprovalPrincipal
The daemon timeout tick.
Sourcepub fn is_out_of_band(&self) -> bool
pub fn is_out_of_band(&self) -> bool
True when this principal is a DIFFERENT principal than the running agent.
OutOfBandRequired mode requires this to clear a gate.
Sourcepub fn is_system(&self) -> bool
pub fn is_system(&self) -> bool
True for the synthetic timeout principal. A system approval is metered as
a timeout auto-approval rather than a human approval (matches the ledger
source == "system" reconstruction in rebuild_from_persistence).
Sourcepub fn actor_label(&self) -> String
pub fn actor_label(&self) -> String
Ledger actor string: prefer the identity, fall back to the source label.
Sourcepub fn voter_key(&self) -> String
pub fn voter_key(&self) -> String
Quorum-distinctness key. Qualified by the voter source (see
Self::voter_source) so a different identity on a different source stays
distinct, while the same paired credential over HTTP+WS counts once. Channel
voters are additionally namespaced by channel key so same-looking sender ids
from different channels/aliases cannot satisfy each other’s quorum. An
identity-less principal keys to its source (and channel, for channel answers)
so anonymous votes from one source count once and cannot inflate a quorum.
Sourcepub fn source_label(&self) -> &'static str
pub fn source_label(&self) -> &'static str
Stable wire label for the source (for ledger payloads / logs).
Trait Implementations§
Source§impl Clone for ApprovalPrincipal
impl Clone for ApprovalPrincipal
Source§fn clone(&self) -> ApprovalPrincipal
fn clone(&self) -> ApprovalPrincipal
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ApprovalPrincipal
impl Debug for ApprovalPrincipal
Source§impl<'de> Deserialize<'de> for ApprovalPrincipal
impl<'de> Deserialize<'de> for ApprovalPrincipal
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApprovalPrincipal, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApprovalPrincipal, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ApprovalPrincipal
impl PartialEq for ApprovalPrincipal
Source§fn eq(&self, other: &ApprovalPrincipal) -> bool
fn eq(&self, other: &ApprovalPrincipal) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ApprovalPrincipal
impl Serialize for ApprovalPrincipal
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for ApprovalPrincipal
impl StructuralPartialEq for ApprovalPrincipal
Auto Trait Implementations§
impl Freeze for ApprovalPrincipal
impl RefUnwindSafe for ApprovalPrincipal
impl Send for ApprovalPrincipal
impl Sync for ApprovalPrincipal
impl Unpin for ApprovalPrincipal
impl UnsafeUnpin for ApprovalPrincipal
impl UnwindSafe for ApprovalPrincipal
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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