pub struct SharedAsset {
pub asset_id: Uuid,
pub content_hash: Hash32,
pub content_type: String,
pub size: u64,
pub amk_version: u32,
pub nonce_prefix: [u8; 7],
pub key_mode: KeyMode,
pub wrapped_file_key: Option<WrappedFileKey>,
pub sidecar: Option<Vec<u8>>,
}Expand description
One covered asset as a share viewer is served it: every key-free parameter it needs to
fetch the asset’s ciphertext and decrypt it under the opened ScopeMaterial.
The field names and wire rules mirror the signed manifest’s
(ManifestCore): key_mode is wire-absent when
derived, and wrapped_file_key is present iff key_mode = wrapped. Nothing here is a key:
the nonce prefix is public by construction and the wrapped key is AMK-sealed ciphertext.
The asset’s capture metadata travels only in sidecar, the copy the issuing
client already passed through the Privacy on Export strip (sidecar_for_export, a
native item) before sealing. Every other field
is key-free crypto plumbing; a field that adds capture metadata is a boundary-crossing field
and must be added already stripped.
Fields§
§asset_id: UuidThe asset’s file id — the id its per-file key is derived or unwrapped for.
content_hash: Hash32The ciphertext’s content address: the {hash} of /s/{opaque-id}/blob/{hash}.
content_type: StringThe plaintext media type, which the viewer wraps the decrypted bytes in.
size: u64The plaintext byte length.
amk_version: u32The AMK epoch the asset was written under; 0 for an asset-scoped grant, whose key the
scope material carries directly.
nonce_prefix: [u8; 7]The STREAM nonce prefix the ciphertext was written with.
key_mode: KeyModeHow the file key is obtained; wire-absent when derived.
wrapped_file_key: Option<WrappedFileKey>The AMK-sealed file key; present iff key_mode = wrapped.
sidecar: Option<Vec<u8>>Canonical CBOR of the asset’s export sidecar: the library sidecar after the
Privacy on Export strip, unsigned once anything was stripped. Wire-absent when the
issuer sent none, so a record without it encodes byte-identically to one written before
the field existed, and a reader that predates it ignores it. A native reader decodes
it with SharedAsset::exported_sidecar; the browser viewer carries it unread.
Implementations§
Sourcepub fn exported_sidecar(&self) -> Result<Option<SidecarV1>, SharingError>
pub fn exported_sidecar(&self) -> Result<Option<SidecarV1>, SharingError>
Decode the sidecar the issuer sealed for this asset, if any.
§Errors
SharingError::Malformed when the bytes are not a sidecar this reader understands, or
are the sidecar of another asset.
Trait Implementations§
Source§fn clone(&self) -> SharedAsset
fn clone(&self) -> SharedAsset
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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§fn eq(&self, other: &SharedAsset) -> bool
fn eq(&self, other: &SharedAsset) -> bool
self and other values to be equal, and is used by ==.Auto Trait Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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<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