pub struct DerivativeCore {Show 15 fields
pub version: String,
pub crypto_suite_id: u16,
pub protocol_version: Option<String>,
pub amk_version: Option<AmkVersion>,
pub source_asset_id: Uuid,
pub role: DerivativeRole,
pub format: String,
pub ciphertext_hash: Hash32,
pub nonce_prefix: [u8; 7],
pub generated_by_device: Uuid,
pub generated_by_client: String,
pub model_id: Option<String>,
pub model_version: Option<String>,
pub generated_at: String,
pub prior_provenance_hash: Option<Hash32>,
}Expand description
The signed core of a derivative manifest (thumbnail / preview / embedding).
Fields§
§version: StringSchema version string (derivative-manifest/v1).
crypto_suite_id: u16Primitive bundle.
protocol_version: Option<String>Date-based wire protocol version; matches the album pin. Wire-absent only on pre-binding fixtures; REQUIRED on every real write.
amk_version: Option<AmkVersion>The AMK epoch whose write-tier key produced write_sig — the verifier needs it to
select the verification key. Wire-absent only on pre-binding fixtures; REQUIRED on
every real write (a derivative without it cannot be authorization-verified).
source_asset_id: UuidThe asset this derivative is generated from.
role: DerivativeRoleWhich kind of derivative.
format: StringMIME/format string, e.g. image/avif or embedding/mobileclip-b.
A String, and deliberately so, even though the still formats are a closed set.
Two reasons, and both are about keeping a policy rejection from becoming a parse
failure:
- the same field carries the embedding-role grammar
embedding/{model_id}(crate::ml), which no still-format enum can model, so a single typed field would have to be an enum over both grammars; - a
#[serde(try_from = "String")]newtype would make an older manifest naming a future codec fail at deserialisation — before its signature is examined at all — turning “this receiver does not recognise that format” into “this manifest is unreadable”.
The closed set is enforced at the two boundaries instead: production, because
media::generate_still_derivatives only ever writes
DerivativeFormat::mime; and
verification, via
verify_still_format, which rejects a
still-role manifest whose value is outside the set and leaves the embedding-role grammar
alone.
Both live in crate::derivative_format, which is unconditional — deliberately not
behind the media feature. capsule-server and capsule-wasm build
default-features = false, and they are exactly the crates that receive a manifest they
did not author, so a check they could not link would be a closed set only its producer
could evaluate. SSoT: Thumbnails.
ciphertext_hash: Hash32Content-address digest over the derivative ciphertext.
nonce_prefix: [u8; 7]The STREAM nonce prefix the derivative ciphertext was produced under; folded into the file-key salt, so it also selects the key.
Required, not Option. Derivative bytes are encrypted client-side exactly like the
original (Encryption), so a receiver that
cannot recover this cannot decrypt the blob at all — an absent prefix would be an
unopenable derivative rather than a tolerable gap. It is safe to make it required
because no real derivative-manifest/v1 has ever been written to any store: derivatives
were unconditionally DeferredNoCodec until the decoder landed, and crate::ml
constructs no derivative manifest. There is nothing to stay compatible with, so the
schema string does not move.
generated_by_device: UuidDevice that generated the derivative.
generated_by_client: StringGenerating client version.
model_id: Option<String>Model id (embeddings only).
model_version: Option<String>Model version (embeddings only).
generated_at: StringRFC3339 generation time.
prior_provenance_hash: Option<Hash32>Chain link per (source_asset_id, role); null for the first of that role.
Implementations§
Source§impl DerivativeCore
impl DerivativeCore
Sourcepub fn signing_bytes(&self) -> Vec<u8> ⓘ
pub fn signing_bytes(&self) -> Vec<u8> ⓘ
The canonical bytes both signatures cover.
Sourcepub fn sign(
self,
device: &dyn Signer,
write_tier: &dyn Signer,
) -> Result<DerivativeManifest, CryptoError>
pub fn sign( self, device: &dyn Signer, write_tier: &dyn Signer, ) -> Result<DerivativeManifest, CryptoError>
Sign with the device DSK and epoch write-tier key. Fallible: the device signer may be hardware-backed.
Trait Implementations§
Source§impl Clone for DerivativeCore
impl Clone for DerivativeCore
Source§fn clone(&self) -> DerivativeCore
fn clone(&self) -> DerivativeCore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DerivativeCore
impl Debug for DerivativeCore
Source§impl<'de> Deserialize<'de> for DerivativeCore
impl<'de> Deserialize<'de> for DerivativeCore
Source§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>,
impl Eq for DerivativeCore
Source§impl PartialEq for DerivativeCore
impl PartialEq for DerivativeCore
Source§fn eq(&self, other: &DerivativeCore) -> bool
fn eq(&self, other: &DerivativeCore) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for DerivativeCore
impl Serialize for DerivativeCore
impl StructuralPartialEq for DerivativeCore
Auto Trait Implementations§
impl Freeze for DerivativeCore
impl RefUnwindSafe for DerivativeCore
impl Send for DerivativeCore
impl Sync for DerivativeCore
impl Unpin for DerivativeCore
impl UnsafeUnpin for DerivativeCore
impl UnwindSafe for DerivativeCore
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