pub struct EncodedPostV1 {
pub post_id: Id,
pub signature: Signature,
pub header: EncodedPostHeaderV1,
pub post: String,
}Expand description
A single user post in its canonical, verifiable form as it travels across the network.
EncodedPostV1 bundles the post body together with everything a recipient needs to
authenticate it: the author’s EncodedPostHeaderV1 (verification key, PQ commitment,
timestamp, linked base IDs, and which signature mechanism is in use), the author’s
Signature over the canonical bytes, and a post_id which is simply the hash of the
signature (so every post has a deterministic, collision-free identifier).
On the wire the post body is compressed and optionally encrypted; this struct is the
decoded in-memory form. EncodedPostV1::bytes_without_body exists for callers who only
need the header portion — e.g. a timeline that is showing post previews without having
yet fetched the full body.
Fields§
§post_id: Id§signature: Signature§header: EncodedPostHeaderV1§post: StringImplementations§
Source§impl EncodedPostV1
impl EncodedPostV1
Sourcepub fn bytes_without_body(bytes: Bytes) -> Result<Bytes>
pub fn bytes_without_body(bytes: Bytes) -> Result<Bytes>
Returns the header portion of encoded post bytes (post_id + signature + version +
hashes + lengths + encrypted_header), excluding the encrypted body.
The result is suitable for passing to decode_from_bytes(bytes, password, false, false).
pub fn new( client_id: &ClientId, timestamp: TimeMillis, linked_base_ids: Vec<Id>, post: &str, ) -> Self
pub async fn encode_to_bytes_direct( &mut self, key_locker: &Arc<dyn KeyLocker>, ) -> Result<EncodedPostBytesV1>
pub fn decode_signature_from_bytes(bytes: &[u8]) -> Result<Signature>
pub fn decode_from_bytes( bytes: Bytes, password_base_id: &Id, expect_body: bool, decode_body: bool, ) -> Result<Self>
Trait Implementations§
Source§impl Clone for EncodedPostV1
impl Clone for EncodedPostV1
Source§fn clone(&self) -> EncodedPostV1
fn clone(&self) -> EncodedPostV1
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EncodedPostV1
impl Debug for EncodedPostV1
Source§impl PartialEq for EncodedPostV1
impl PartialEq for EncodedPostV1
impl StructuralPartialEq for EncodedPostV1
Auto Trait Implementations§
impl Freeze for EncodedPostV1
impl RefUnwindSafe for EncodedPostV1
impl Send for EncodedPostV1
impl Sync for EncodedPostV1
impl Unpin for EncodedPostV1
impl UnsafeUnpin for EncodedPostV1
impl UnwindSafe for EncodedPostV1
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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