pub struct EventContentV0 {
pub topic: TopicId,
pub publisher: PeerId,
pub seq: u64,
pub blocks: Vec<Block>,
pub file_ids: Vec<BlockId>,
pub key: Vec<u8>,
}
Expand description
Content of EventV0
Contains the objects of newly published Commit, its optional blocks, and optional FILES and their blocks. If a block is not present in the Event, its ID should be present in file_ids and the block should be put on the emitting broker beforehand with BlocksPut.
Fields§
§topic: TopicId
Pub/sub topic
publisher: PeerId
§seq: u64
Commit sequence number of publisher
blocks: Vec<Block>
Blocks with encrypted content. First in the list is always the commit block followed by its children, then its optional header and body blocks (and eventual children),
blocks of the FILES are optional (only sent here if user specifically want to push them to the pub/sub).
the first in the list MUST contain a commit_header_key
When saved locally (the broker keeps the associated event, until the topic is refreshed(the last heads retain their events) ),
so, this blocks
list is emptied (as the blocked are saved in the overlay storage anyway) and their IDs are kept on the side.
then when the event needs to be send in reply to a *TopicSyncReq, the blocks list is regenerated from the IDs,
so that a valid EventContent can be sent (and so that its signature can be verified successfully)
file_ids: Vec<BlockId>
Ids of additional Blocks (FILES or Objects) with encrypted content that are not to be pushed in the pub/sub they will be retrieved later by interested users
key: Vec<u8>
can be :
- Encrypted key for the Commit object (the first Block in blocks vec)
The ObjectKey is encrypted using ChaCha20:
- key: BLAKE3 derive_key (“NextGraph Event Commit ObjectKey ChaCha20 key”, RepoId + BranchId + branch_secret(ReadCapSecret of the branch) + publisher)
- nonce: commit_seq
- If it is a CertificateRefresh, both the blocks and file_ids vectors are empty.
the key here contains an encrypted ObjectRef to the new Certificate.
The whole ObjectRef is encrypted (including the ID) to avoid correlation of topics who will have the same Certificate ID (belong to the same repo)
Encrypted using ChaCha20, with :
- key: BLAKE3 derive_key (“NextGraph Event Certificate ObjectRef ChaCha20 key”, RepoId + BranchId + branch_secret(ReadCapSecret of the branch) + publisher) it is the same key as above, because the commit_seq will be different (incremented anyway)
- nonce: commit_seq
Trait Implementations§
Source§impl Clone for EventContentV0
impl Clone for EventContentV0
Source§fn clone(&self) -> EventContentV0
fn clone(&self) -> EventContentV0
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more