pub struct AuditEnvelope {
pub event_id: Uuid,
pub event_version: u32,
pub schema_version: u32,
pub timestamp: DateTime<Utc>,
pub audit_key_id: KeyId,
pub actor_did_hash: [u8; 32],
pub actor_did_plain: Option<String>,
pub target_did_hash: Option<[u8; 32]>,
pub target_did_plain: Option<String>,
pub prev_hash: [u8; 32],
pub entry_hash: [u8; 32],
pub event: AuditEvent,
}Expand description
A persisted audit-log entry.
Fields§
§event_id: UuidStable identifier for this specific event. Becomes the secondary-key component for cursor-based queries.
event_version: u32Variant-specific schema version. Bumped on a breaking change
to a particular variant’s payload; the envelope’s
SCHEMA_VERSION tracks the wrapper-shape version
independently.
schema_version: u32Envelope-shape version. See SCHEMA_VERSION for the
semantics.
timestamp: DateTime<Utc>Wall-clock at write time. Drives the primary <timestamp>:<event_id>
audit-keyspace ordering.
audit_key_id: KeyIdIdentifier of the audit_key used to compute the hashes below. Verifiers walk the key history newest-first; this lets them skip the search when they already know the right key.
actor_did_hash: [u8; 32]HMAC-SHA256 of the actor DID under Self::audit_key_id.
Always present so RTBF can null the plaintext without losing
the correlation handle.
actor_did_plain: Option<String>Plaintext actor DID. None after an RTBF override has redacted
this row.
target_did_hash: Option<[u8; 32]>HMAC-SHA256 of the target DID, if the event has one. None
for events whose target is the community itself (e.g.
CommunityProfileUpdated).
target_did_plain: Option<String>Plaintext target DID. Same null-on-RTBF semantics as
Self::actor_did_plain.
prev_hash: [u8; 32]Tamper-evidence chain: the Self::entry_hash of the
immediately-preceding envelope, or GENESIS_HASH for the
first one. Linking each entry to its predecessor makes a
reorder/drop/duplicate of any envelope detectable by
verify_chain. default keeps pre-v2 rows deserializable.
entry_hash: [u8; 32]Tamper-evidence chain: SHA-256 commitment to this envelope’s
immutable content (see Self::chain_digest). Stamped at
write time; the next envelope’s Self::prev_hash points here.
default keeps pre-v2 rows deserializable (they come back as
GENESIS_HASH, i.e. unchained).
event: AuditEventThe tagged event payload.
Implementations§
Source§impl AuditEnvelope
impl AuditEnvelope
Sourcepub fn chain_digest(&self) -> [u8; 32]
pub fn chain_digest(&self) -> [u8; 32]
SHA-256 commitment over this envelope’s immutable content,
used to stamp Self::entry_hash at write time and to
re-derive it during verify_chain.
Deliberately covers prev_hash (so the link is part of the
commitment) but excludes:
entry_hashitself (it is this digest — self-reference),actor_did_plain/target_did_plain, which RTBF nulls after the fact. The HMAC hashes are covered, so attribution stays chained while a redaction of the plaintext does not break the chain.
The event payload is hashed via its serde_json encoding,
which is canonical in this workspace (maps serialize sorted,
and the store round-trips through the same encoder).
Trait Implementations§
Source§impl Clone for AuditEnvelope
impl Clone for AuditEnvelope
Source§fn clone(&self) -> AuditEnvelope
fn clone(&self) -> AuditEnvelope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuditEnvelope
impl Debug for AuditEnvelope
Source§impl<'de> Deserialize<'de> for AuditEnvelope
impl<'de> Deserialize<'de> for AuditEnvelope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for AuditEnvelope
Source§impl PartialEq for AuditEnvelope
impl PartialEq for AuditEnvelope
Source§impl Serialize for AuditEnvelope
impl Serialize for AuditEnvelope
impl StructuralPartialEq for AuditEnvelope
Auto Trait Implementations§
impl Freeze for AuditEnvelope
impl RefUnwindSafe for AuditEnvelope
impl Send for AuditEnvelope
impl Sync for AuditEnvelope
impl Unpin for AuditEnvelope
impl UnsafeUnpin for AuditEnvelope
impl UnwindSafe for AuditEnvelope
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
Source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<'de, T, C> DeserializeTyped<'de, C> for Twhere
T: Deserialize<'de>,
impl<'de, T, C> DeserializeTyped<'de, C> for Twhere
T: Deserialize<'de>,
fn deserialize_typed<S>(
_: &C,
deserializer: S,
) -> Result<T, <S as Deserializer<'de>>::Error>where
S: Deserializer<'de>,
impl<T, U> DeserializeTypedOwned<T> for Uwhere
U: for<'de> DeserializeTyped<'de, T>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
fn equivalent(&self, key: &K) -> bool
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
Source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T.