pub struct EncryptedCommonsPayload {
pub commitment: PayloadCommitment,
pub ciphertext: Vec<u8>,
pub storers: Vec<String>,
}Expand description
An encrypted payload in a permissive commons — content-addressed ciphertext that many parties may store (replicate) so it cannot be deleted (anti-erasure), but that is accessible only to holders of the right credential (the wrapped decryption key). Wide storage ≠ wide access: without a key the ciphertext is opaque.
Revocation acts on access (the credential’s key — see ConsentCredential::revoke), not on this
blob; the blob persists for other credential-holders and as un-erasable evidence. The person’s ultimate
control is crypto-shredding — once no credential can decrypt it (all keys destroyed), it is
permanently unreadable by anyone, effective erasure though the bytes survive (see
is_crypto_shredded).
Fields§
§commitment: PayloadCommitmentContent address / commitment of the ciphertext — its durable identifier (equals the
PayloadCommitment a credential and conduct record bind to).
ciphertext: Vec<u8>The envelope-encrypted bytes. Opaque without a credential; safe to replicate widely.
storers: Vec<String>The parties (by identifier) who hold a copy — the commons. Replication = durability: no single party’s deletion destroys the payload while another copy exists.
Implementations§
Source§impl EncryptedCommonsPayload
impl EncryptedCommonsPayload
pub fn new( commitment: PayloadCommitment, ciphertext: Vec<u8>, storers: Vec<String>, ) -> Self
Sourcepub fn replication(&self) -> usize
pub fn replication(&self) -> usize
Number of independent copies held — the anti-deletion / durability measure.
Sourcepub fn is_durable(&self) -> bool
pub fn is_durable(&self) -> bool
Durable against unilateral deletion (held by more than one storer). A single-copy payload is not yet in a resilient commons.
Sourcepub fn add_storer(&mut self, did: impl Into<String>)
pub fn add_storer(&mut self, did: impl Into<String>)
Add a storer (a party replicates a copy — increases durability). Idempotent.
Sourcepub fn drop_storer(&mut self, did: &str) -> bool
pub fn drop_storer(&mut self, did: &str) -> bool
One storer drops their copy. Returns true if copies remain (the payload survives) — the point
of the commons: unilateral deletion does not erase what others hold.
Trait Implementations§
Source§impl Clone for EncryptedCommonsPayload
impl Clone for EncryptedCommonsPayload
Source§fn clone(&self) -> EncryptedCommonsPayload
fn clone(&self) -> EncryptedCommonsPayload
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 EncryptedCommonsPayload
impl Debug for EncryptedCommonsPayload
Source§impl<'de> Deserialize<'de> for EncryptedCommonsPayload
impl<'de> Deserialize<'de> for EncryptedCommonsPayload
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>,
Source§impl PartialEq for EncryptedCommonsPayload
impl PartialEq for EncryptedCommonsPayload
Source§fn eq(&self, other: &EncryptedCommonsPayload) -> bool
fn eq(&self, other: &EncryptedCommonsPayload) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for EncryptedCommonsPayload
impl Serialize for EncryptedCommonsPayload
impl Eq for EncryptedCommonsPayload
impl StructuralPartialEq for EncryptedCommonsPayload
Auto Trait Implementations§
impl Freeze for EncryptedCommonsPayload
impl RefUnwindSafe for EncryptedCommonsPayload
impl Send for EncryptedCommonsPayload
impl Sync for EncryptedCommonsPayload
impl Unpin for EncryptedCommonsPayload
impl UnsafeUnpin for EncryptedCommonsPayload
impl UnwindSafe for EncryptedCommonsPayload
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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