pub struct WriteProvenance {
pub id: Uuid,
pub memory_id: Uuid,
pub principal: String,
pub capability_id: Option<Uuid>,
pub session_id: Option<String>,
pub op: WriteOp,
pub authored_at: DateTime<Utc>,
pub flags: Vec<WriteFlag>,
pub prev_hash: Option<Vec<u8>>,
pub content_hash: Vec<u8>,
}Expand description
One tamper-evident provenance record for a single memory write.
Fields§
§id: Uuid§memory_id: Uuid§principal: String§capability_id: Option<Uuid>The capability the write was authorised under, if any.
session_id: Option<String>Session / trace id, so a whole session’s writes can be revoked together.
op: WriteOp§flags: Vec<WriteFlag>Write-time flags (e.g. an opaque-reasoning-payload shape match). Hashed
into content_hash, so a flag is tamper-evident.
prev_hash: Option<Vec<u8>>Previous record’s content_hash; None for the first record.
content_hash: Vec<u8>Implementations§
Source§impl WriteProvenance
impl WriteProvenance
Sourcepub fn new(
memory_id: Uuid,
principal: impl Into<String>,
capability_id: Option<Uuid>,
session_id: Option<String>,
op: WriteOp,
flags: Vec<WriteFlag>,
prev_hash: Option<Vec<u8>>,
) -> Self
pub fn new( memory_id: Uuid, principal: impl Into<String>, capability_id: Option<Uuid>, session_id: Option<String>, op: WriteOp, flags: Vec<WriteFlag>, prev_hash: Option<Vec<u8>>, ) -> Self
Build a provenance record chained onto prev_hash, computing its
content_hash. prev_hash is the previous record’s content_hash
(None for the first record in the store’s chain).
Sourcepub fn content_hash_valid(&self) -> bool
pub fn content_hash_valid(&self) -> bool
Recompute this record’s content_hash from its fields and compare
(constant-time) to the stored value. false = the record was mutated.
Trait Implementations§
Source§impl Clone for WriteProvenance
impl Clone for WriteProvenance
Source§fn clone(&self) -> WriteProvenance
fn clone(&self) -> WriteProvenance
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WriteProvenance
impl Debug for WriteProvenance
Source§impl<'de> Deserialize<'de> for WriteProvenance
impl<'de> Deserialize<'de> for WriteProvenance
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for WriteProvenance
impl PartialEq for WriteProvenance
Source§impl Serialize for WriteProvenance
impl Serialize for WriteProvenance
impl StructuralPartialEq for WriteProvenance
Auto Trait Implementations§
impl Freeze for WriteProvenance
impl RefUnwindSafe for WriteProvenance
impl Send for WriteProvenance
impl Sync for WriteProvenance
impl Unpin for WriteProvenance
impl UnsafeUnpin for WriteProvenance
impl UnwindSafe for WriteProvenance
Blanket Implementations§
impl<T> Allocation 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
Mutably borrows from an owned value. Read more
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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> 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> ⓘ
Converts
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> ⓘ
Converts
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