pub struct Change { /* private fields */ }Expand description
The operations that one replica made at one time, signed by the replica. The payload that holds them is sealed with a key of the change’s own, and kept beside the change, whose header holds the hashes of both.
In CBOR, a change is the array [1, header, signature]. docs/spec/log.md describes
the format.
Implementations§
Source§impl Change
impl Change
Sourcepub fn create(
space: SpaceId,
keys: &SpaceKeys,
author: &SigningKey,
draft: &Draft,
rng: &mut impl CryptoRng,
) -> Parcel
pub fn create( space: SpaceId, keys: &SpaceKeys, author: &SigningKey, draft: &Draft, rng: &mut impl CryptoRng, ) -> Parcel
Makes a change: seals the draft’s payload with a new change key, wraps that key
with the space’s newest key, and signs the change as author.
The replica that made the change.
Sourcepub const fn parents(&self) -> &SmallSet<ChangeId>
pub const fn parents(&self) -> &SmallSet<ChangeId>
The changes that the author’s log ended with when the author made this one.
Sourcepub const fn payload_hash(&self) -> &Hash
pub const fn payload_hash(&self) -> &Hash
The hash of the change’s sealed payload.
Sourcepub const fn sealed(&self) -> &BTreeMap<StatementId, Hash>
pub const fn sealed(&self) -> &BTreeMap<StatementId, Hash>
The secret statements sealed in the change’s payload, with the hashes of their record keys, by ID.
Sourcepub fn purges_or_restores(&self) -> bool
pub fn purges_or_restores(&self) -> bool
Whether the change purges or restores anything, which the same roles may do.
Sourcepub fn verify(&self) -> Result<(), LogError>
pub fn verify(&self) -> Result<(), LogError>
Checks the change’s signature.
§Errors
Returns LogError::InvalidSignature if the signature is not valid for the author.
Sourcepub fn open(
&self,
payload: &SealedPayload,
key: &WrappedChangeKey,
keys: &SpaceKeys,
) -> Result<Payload, LogError>
pub fn open( &self, payload: &SealedPayload, key: &WrappedChangeKey, keys: &SpaceKeys, ) -> Result<Payload, LogError>
Decrypts the change’s payload with the change’s key, which key holds wrapped. Sealed
statements stay sealed.
§Errors
Returns an error if the payload is not this change’s, if keys lack the space key of
the change’s epoch, if the wrapped key is not this change’s, or if the payload does
not have the form of a payload, or seals other statements than the header says.