Skip to main content

qualia_cooperative_core/authoring/
human_authority.rs

1//! Attribution evidence is deliberately separate from a reusable permission.
2use super::PrincipalKind;
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
6#[serde(rename_all = "snake_case")]
7pub enum HumanAuthorityStatus {
8    /// Project admission and controller possession establish the acting actor;
9    /// the native human-root/adopted-chain adapter has not admitted this path.
10    UnverifiedLegacyAdmission,
11}
12
13/// A projection of verified owner state, never an authentication input.
14/// A Human capacity tag alone does not populate the human principal field.
15#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
16#[serde(deny_unknown_fields)]
17pub struct HumanAuthorityEvidence {
18    pub acting_subject: String,
19    pub acting_kind: PrincipalKind,
20    pub status: HumanAuthorityStatus,
21    pub human_principal_subject: Option<String>,
22    pub delegation_path: Vec<[u8; 32]>,
23}
24
25impl HumanAuthorityEvidence {
26    pub fn legacy(acting_subject: &str, acting_kind: PrincipalKind) -> Self {
27        Self {
28            acting_subject: acting_subject.into(),
29            acting_kind,
30            status: HumanAuthorityStatus::UnverifiedLegacyAdmission,
31            human_principal_subject: None,
32            delegation_path: Vec::new(),
33        }
34    }
35}