Skip to main content

ManifestCore

Struct ManifestCore 

Source
pub struct ManifestCore {
Show 22 fields pub version: String, pub crypto_suite_id: u16, pub protocol_version: String, pub file_id: Uuid, pub album_id: Uuid, pub amk_version: AmkVersion, pub ciphertext_hash: Hash32, pub plaintext_size: u64, pub chunk_size: u32, pub nonce_prefix: [u8; 7], pub key_mode: KeyMode, pub wrapped_file_key: Option<WrappedFileKey>, pub metadata_blob_hash: Option<Hash32>, pub created_by_user: Uuid, pub created_by_device: Uuid, pub client_version: String, pub timestamp: String, pub action: Action, pub prior_provenance_hash: Option<Hash32>, pub retention_until: Option<String>, pub upgraded_from: Option<UpgradeLineage>, pub unknown: BTreeMap<String, Value>,
}
Expand description

The signed core of an asset manifest — every field the two signatures cover.

Unknown keys survive under the signature (Versioning — invariant 2). A key this build does not know is kept verbatim in Self::unknown, re-emitted by the canonical encoder beside the known fields, and therefore covered by both signatures: a newer writer’s manifest that only adds a field verifies here, and stripping that field fails verification. The decoder is hand-written for that reason (see the Deserialize impl below): serde(flatten) buffers unknown values through serde’s private content type, which cannot hold a CBOR tag or an integer wider than 64 bits, so a future field carrying either would make the whole manifest undecodable instead of preserved.

Fields§

§version: String

Schema version string (asset-manifest/v1).

§crypto_suite_id: u16

The primitive bundle this manifest was produced under.

§protocol_version: String

Date-based wire protocol version; matches the album pin.

§file_id: Uuid

The asset’s file id.

§album_id: Uuid

The album the asset belongs to.

§amk_version: AmkVersion

The AMK epoch (and write-tier key) this manifest is authorized under.

§ciphertext_hash: Hash32

Content-address digest over the ciphertext.

§plaintext_size: u64

Total plaintext byte length.

§chunk_size: u32

Plaintext bytes per STREAM chunk.

§nonce_prefix: [u8; 7]

STREAM nonce prefix (random per file).

§key_mode: KeyMode

How the file key is obtained: derived (default; wire-absent) or wrapped (an adopted web-upload drop). Closed enum — see KeyMode for the wire-presence rule.

§wrapped_file_key: Option<WrappedFileKey>

The AMK-sealed file key; present iff key_mode = wrapped, wire-absent otherwise.

§metadata_blob_hash: Option<Hash32>

Content address of the asset’s encrypted metadata blob. Present on create | replace | metadata-update; wire-absent (key omitted, never null) on delete | derivative-* | trash-restore.

§created_by_user: Uuid

The account whose device signed this record.

Per-record, not per-asset: a delete written by a second device — or by a member of a shared album — names that writer, not the account that created the asset. The asset’s original creator is recoverable from the create record at the head of the append-only provenance chain, which is where it belongs.

The pairing with Self::created_by_device is load-bearing rather than descriptive: verify_asset resolves the device inside this account’s published directory (step 6) and verifies AssetManifest::device_sig under that entry’s key (step 8), so a record naming anyone but its own signer cannot verify. Album write authority is decided separately, by write_sig at step 10.

§created_by_device: Uuid

The device that signed this record, resolved in Self::created_by_user’s directory.

Per-record for the same reason and with the same consequence: it must be the device whose DSK produced AssetManifest::device_sig, or step 8 of verify_asset rejects the manifest. The server mirrors the resolvable half key-free as invariant 7 — the device must be in the calling account’s published directory, with added_at before the manifest’s timestamp.

§client_version: String

Producing client version string.

§timestamp: String

Self-asserted capture/write time (RFC3339). Audit-only; never load-bearing.

§action: Action

The lifecycle action.

§prior_provenance_hash: Option<Hash32>

SHA-256 of the previous manifest in this asset’s chain; null iff action = create.

§retention_until: Option<String>

Server-visible retention deadline (RFC3339); set only for action = delete.

§upgraded_from: Option<UpgradeLineage>

The album this asset’s album was forked from, when it is a fork.

The normative link between an upgraded album and its predecessor — never the MLS group name, which is an internal detail. A device that joins the fork reads this and can walk back to the album the asset came from; without it, a fork looks like an unrelated album full of assets that appeared from nowhere.

Wire-absent when there is none, never present-null. This is inside the signed core, so a present-null would change signing_bytes and silently break re-verification of every manifest written before the field existed — the same trap dek_public avoids, and the reason an_absent_lineage_is_wire_absent_and_does_not_move_the_signature exists.

§unknown: BTreeMap<String, Value>

Keys a newer writer added that this build does not know, preserved verbatim and signed over. Empty (and so wire-absent) on everything this build writes.

A key here must never collide with a known field name: the decoder only ever places the keys it did not recognise here, and a caller building a core by hand must do the same.

Implementations§

Source§

impl ManifestCore

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

Sign this core with the device DSK and the epoch write-tier key. Fallible because the device signer may be hardware-backed (the write-tier key is always software).

Trait Implementations§

Source§

impl Clone for ManifestCore

Source§

fn clone(&self) -> ManifestCore

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 ManifestCore

Source§

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

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

impl<'de> Deserialize<'de> for ManifestCore

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ManifestCore

Source§

impl PartialEq for ManifestCore

Source§

fn eq(&self, other: &ManifestCore) -> 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 ManifestCore

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 ManifestCore

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