pub struct Change { /* private fields */ }Expand description
One acdp-change/1 entry (RFC-ACDP-0018 §4), CLOSED.
Built only through Self::from_value / Deserialize (which enforce
the schema, including each carried object’s own closed schema) or the
registry-side constructors Self::lifecycle, Self::superseded
and Self::key_revocation (which derive recorded_at and the ids
from the evidence, so they cannot disagree with it).
Parsing does not verify anything: see Self::check_consistency for
the pure cross-checks, and acdp-client’s verify_change for §7.
Implementations§
Source§impl Change
impl Change
Sourcepub fn from_value(value: &Value) -> Result<Self, AcdpError>
pub fn from_value(value: &Value) -> Result<Self, AcdpError>
Parse a change entry from wire JSON, enforcing the closed schema.
Failures are AcdpError::SchemaViolation.
Sourcepub fn lifecycle(
seq: u64,
lineage_id: LineageId,
agent_id: AgentDid,
raw_event: Value,
event_receipt: &EventReceipt,
) -> Result<Self, AcdpError>
pub fn lifecycle( seq: u64, lineage_id: LineageId, agent_id: AgentDid, raw_event: Value, event_receipt: &EventReceipt, ) -> Result<Self, AcdpError>
A lifecycle entry for the event at event_receipt.index of the
receipt’s context. raw_event is the stored event, verbatim;
recorded_at is the receipt’s accepted_at.
Sourcepub fn superseded(
seq: u64,
ctx_id: CtxId,
agent_id: AgentDid,
registry_receipt: &RegistryReceipt,
) -> Result<Self, AcdpError>
pub fn superseded( seq: u64, ctx_id: CtxId, agent_id: AgentDid, registry_receipt: &RegistryReceipt, ) -> Result<Self, AcdpError>
A superseded entry: ctx_id was superseded by the version
registry_receipt was minted for. The lineage is the receipt’s;
agent_id is the superseded context’s producer.
Sourcepub fn key_revocation(
seq: u64,
agent_id: AgentDid,
registry_receipt: &RegistryReceipt,
) -> Result<Self, AcdpError>
pub fn key_revocation( seq: u64, agent_id: AgentDid, registry_receipt: &RegistryReceipt, ) -> Result<Self, AcdpError>
A key_revocation entry for the revocation context
registry_receipt was minted for. agent_id is the revoked key’s
controller: metadata.revoked_key_controller when present, else
the revocation body’s agent_id (RFC-ACDP-0018 §4).
Sourcepub fn kind(&self) -> ChangeKind
pub fn kind(&self) -> ChangeKind
The entry’s kind.
Sourcepub fn lineage_id(&self) -> &LineageId
pub fn lineage_id(&self) -> &LineageId
The affected context’s lineage.
Sourcepub fn recorded_at(&self) -> DateTime<Utc>
pub fn recorded_at(&self) -> DateTime<Utc>
The registry’s clock at commit.
Sourcepub fn evidence(&self) -> &ChangeEvidence
pub fn evidence(&self) -> &ChangeEvidence
The evidence, by kind.
Sourcepub fn check_consistency(&self) -> Result<(), AcdpError>
pub fn check_consistency(&self) -> Result<(), AcdpError>
The pure cross-checks between an entry’s envelope and its evidence (RFC-ACDP-0018 §4), run before any network round-trip:
lifecycle: the event’s and the receipt’sctx_idare the entry’s;recorded_atequalsevent_receipt.accepted_at.superseded: the receipt is forsuperseded_by(not the entry’s own context) in the entry’s lineage;recorded_atequalsregistry_receipt.created_at.key_revocation: the receipt is for the entry’s context and lineage;recorded_atequalsregistry_receipt.created_at.
Signatures and the receipt’s binding to the event are NOT checked
here. Failures are AcdpError::SchemaViolation.