Skip to main content

MediaMetadata

Struct MediaMetadata 

Source
pub struct MediaMetadata {
Show 16 fields pub mime_type: String, pub file_name: String, pub file_size: u64, pub duration_ms: Option<u64>, pub width: Option<u32>, pub height: Option<u32>, pub thumbnail_base64: Option<String>, pub media_id: Option<String>, pub download_url: Option<String>, pub thumbnail_url: Option<String>, pub encryption_key: Option<String>, pub iv: Option<String>, pub ciphertext_hash: Option<String>, pub sticker_provider: Option<String>, pub sticker_remote_id: Option<String>, pub sticker_kind: Option<String>,
}
Expand description

Metadata describing a media attachment.

Fields§

§mime_type: String

MIME type (e.g. “image/jpeg”, “video/mp4”).

§file_name: String

Original file name.

§file_size: u64

File size in bytes.

§duration_ms: Option<u64>

Duration in milliseconds (audio/video/voice-note/video-note).

§width: Option<u32>

Width in pixels (images and video).

§height: Option<u32>

Height in pixels (images and video).

§thumbnail_base64: Option<String>

Small base64-encoded thumbnail (< 2 KB) for preview.

§media_id: Option<String>

Stable media identifier assigned by the application.

§download_url: Option<String>

URL to fetch the full media from (cloud-stored media).

§thumbnail_url: Option<String>

URL to fetch a thumbnail from (cloud-stored media).

§encryption_key: Option<String>

Content-encryption key for cloud-stored media (base64).

Secret material: must only travel inside an end-to-end-encrypted payload, never in cleartext message fields visible to relays. Enforced at the transport wire chokepoint, which strips it (via MediaMetadata::without_secrets) from every outbound cleartext frame, and by the telemetry scrubber, which redacts it unconditionally before events reach a sink.

§iv: Option<String>

Initialization vector for the cloud-media content encryption (base64). Secret material — same handling as Self::encryption_key.

§ciphertext_hash: Option<String>

Integrity hash of the encrypted cloud-media blob (base64).

§sticker_provider: Option<String>

Sticker pack provider (sticker messages).

§sticker_remote_id: Option<String>

Provider-scoped sticker identifier (sticker messages).

§sticker_kind: Option<String>

Sticker rendering kind (e.g. “static”, “animated”, “lottie”).

Implementations§

Source§

impl MediaMetadata

Source

pub fn has_secrets(&self) -> bool

True when any confidential field (Self::encryption_key, Self::iv) is set.

Source

pub fn without_secrets(&self) -> Self

Returns a copy with the confidential fields cleared.

The cloud-media content key (and its IV) grant access to the media itself, so they must only ever travel inside an end-to-end-encrypted payload. Every path that writes metadata into a cleartext surface — the transport wire encoders, the telemetry event scrubber — routes through this before emitting. The remaining fields (URLs, hashes, sticker identity, dimensions) are display hints, not secrets, and are preserved.

Trait Implementations§

Source§

impl Clone for MediaMetadata

Source§

fn clone(&self) -> MediaMetadata

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MediaMetadata

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MediaMetadata

Source§

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 Serialize for MediaMetadata

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more