OpenAgentID documentation
Source referencesRust module referenceoas-document

oas-document · governance

Declared module signatures, types, configuration, and source documentation.

Source: oas/oas/oas-document/src/governance.rs. SHA-256: a3080f49ab3529bad6cdbd7b4f6522a78abf72e1e43017e197a9c998ed7e7e6a.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

governance::GovernanceSection

Governance section attached to ENR identity documents.

Tracks the governing MHR, monotonic epoch counter, transition history, and governance policy constraints.

Invariants

  • epoch MUST strictly increase (no gaps, no rewinds).
  • current_mhr MUST reference a valid, non-revoked MHR DID.
  • Each transition's from MUST match the previous transition's to.

Examples

use oas_document::governance::GovernanceSection;

let json = r#"{
  "currentMhr": "did:oas:prod:mhr:council-alpha",
  "epoch": 1,
  "transitions": [],
  "policy": {
    "transitionRequires": "mhr_threshold",
    "signingKeyRotationRequires": "mhr_threshold",
    "maxTransitionsPerDay": 1,
    "timelockHours": 24
  }
}"#;
let gov: GovernanceSection = serde_json::from_str(json).unwrap();
assert_eq!(gov.epoch, 1);
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GovernanceSection {
/// DID of the MHR currently governing this ENR.

pub current_mhr: String,
/// Monotonically increasing epoch counter.

/// Incremented on every governance transition.

pub epoch: u64,
/// Complete history of governance transitions.

#[serde(default)]
pub transitions: Vec<GovernanceTransition>,
/// Governance policy constraints.

pub policy: GovernancePolicy
}

Source line: 42.

governance::GovernanceTransition

A single governance transition record.

Records the handoff from one MHR to another, including the cryptographic proof (FROST threshold signature from the outgoing MHR).

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GovernanceTransition {
/// DID of the outgoing MHR (None for the initial governance assignment).

#[serde(skip_serializing_if = "Option::is_none")]
pub from: Option<String>,
/// DID of the incoming MHR.

pub to: String,
/// Epoch at which this transition occurred.

pub epoch: u64,
/// Cryptographic proof of the transition.

pub proof: GovernanceTransitionProof
}

Source line: 64.

governance::GovernanceTransitionProof

Proof that a governance transition was authorized.

Contains a FROST threshold signature from the outgoing MHR members, proving that a quorum approved the handoff.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GovernanceTransitionProof {
/// Proof type identifier.

#[serde(rename = "type")]
pub proof_type: String,
/// FROST threshold signature from the outgoing MHR (base64url-encoded).

pub mhr_threshold_signature: String,
/// ISO 8601 timestamp of when the proof was created.

pub timestamp: String
}

Source line: 85.

governance::ENR_GOVERNANCE_PROOF_TYPE

The canonical proof type string for ENR governance transitions.

pub const ENR_GOVERNANCE_PROOF_TYPE: &str;

Source line: 98.

governance::GovernancePolicy

Policy constraints governing how ENR transitions may occur.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct GovernancePolicy {
/// What is required to transition governance (e.g., `"mhr_threshold"`).

pub transition_requires: String,
/// What is required to rotate the ENR signing key (e.g., `"mhr_threshold"`).

pub signing_key_rotation_requires: String,
/// Maximum number of governance transitions allowed per 24-hour period.

#[serde(default = "default_max_transitions")]
pub max_transitions_per_day: u32,
/// Mandatory delay (in hours) between initiating and confirming a transition.

#[serde(default = "default_timelock")]
pub timelock_hours: u32
}

Source line: 103.

governance::GovernancePolicy::default_policy

Creates a default governance policy with standard constraints.

pub fn default_policy() -> Self;

Source line: 129.

On this page