Skip to main content

DerivativeCore

Struct DerivativeCore 

Source
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: String

Schema version string (derivative-manifest/v1).

§crypto_suite_id: u16

Primitive 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: Uuid

The asset this derivative is generated from.

§role: DerivativeRole

Which kind of derivative.

§format: String

MIME/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: Hash32

Content-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: Uuid

Device that generated the derivative.

§generated_by_client: String

Generating client version.

§model_id: Option<String>

Model id (embeddings only).

§model_version: Option<String>

Model version (embeddings only).

§generated_at: String

RFC3339 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

Source

pub fn signing_bytes(&self) -> Vec<u8> ⓘ

The canonical bytes both signatures cover.

Source

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

Source§

fn clone(&self) -> DerivativeCore

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 DerivativeCore

Source§

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

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

impl<'de> Deserialize<'de> for DerivativeCore

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 Eq for DerivativeCore

Source§

impl PartialEq for DerivativeCore

Source§

fn eq(&self, other: &DerivativeCore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DerivativeCore

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
Source§

impl StructuralPartialEq for DerivativeCore

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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>,

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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