Skip to main content

SidecarV1

Struct SidecarV1 

Source
pub struct SidecarV1 {
Show 26 fields pub sidecar_schema: u16, pub crypto_suite_id: u16, pub uuid: Uuid, pub hash: Hash32, pub capture_timestamp: String, pub capture_timestamp_user: Lww<String>, pub import_timestamp: String, pub content_type: String, pub dimensions: Option<Dimensions>, pub lqip: Option<Lqip>, pub tags_user: OrSet<String>, pub tags_ai: OrSet<AiTag>, pub caption: Lww<String>, pub rating: Lww<u8>, pub stack_membership: Lww<Option<StackMembership>>, pub regions: Regions, pub cull: Lww<CullFlag>, pub hidden: Lww<bool>, pub camera_id: Option<CameraId>, pub device_id: Uuid, pub session_id: Uuid, pub gps: Option<Gps>, pub gps_user: Lww<Option<Gps>>, pub provenance_chain_hash: Option<Hash32>, pub unknown: BTreeMap<String, Value>, pub signature: Option<HybridSignature>,
}
Expand description

The signed CBOR sidecar v1.

Fields§

§sidecar_schema: u16

Schema version — serialized as integer field 0 (sorts first canonically).

§crypto_suite_id: u16

Matches the asset’s manifest.

§uuid: Uuid

Asset id (UUIDv7).

§hash: Hash32

Canonical plaintext digest.

§capture_timestamp: String

RFC3339 capture time as imported: what the original’s own metadata (or the exporter’s record it was folded with) said when the asset entered the library. A user’s correction never overwrites it; it lands in capture_timestamp_user, and effective_capture_timestamp is the instant the asset is dated by.

§capture_timestamp_user: Lww<String>

The user’s capture-time correction: an LWW register over an RFC3339 instant, written by Workspace::set_capture_timestamp. Wire-absent when never written, so every sidecar without a correction encodes byte-identically to before the field existed; an older reader keeps it verbatim as an unknown key.

§import_timestamp: String

RFC3339 import time.

§content_type: String

Closed content-type string per protocol version.

§dimensions: Option<Dimensions>

Pixel dimensions, if known.

§lqip: Option<Lqip>

Display placeholder.

§tags_user: OrSet<String>

User tags (OR-set).

§tags_ai: OrSet<AiTag>

AI tags (separate OR-set; cannot overwrite user tags).

§caption: Lww<String>

Caption LWW register (with superseded log).

§rating: Lww<u8>

Rating LWW register.

§stack_membership: Lww<Option<StackMembership>>

Stack membership: an LWW register over Option<StackMembership> so stack edits (join, move, leave = None) converge order-independently under the same (ts, device_id) rule as caption/rating — grouping is convergent by construction, not convention. Wire-absent default = the never-written register (distinct from an explicit removal, which is a stamped None).

§regions: Regions

Labelled image regions: region id (UUIDv7) to its register, a stamped None being a deleted region (owner: Organization — Labels). Merged by merge_regions, not as plain LWW. Wire-absent when empty, so every sidecar without regions encodes byte-identically to before the field existed; an older reader keeps it verbatim as an unknown key.

§cull: Lww<CullFlag>

Culling flag: LWW register over the trinary CullFlag. Wire-absent default = never flagged (Neutral).

§hidden: Lww<bool>

Hidden flag: LWW register; hidden assets are excluded from default views (owner: Asset Organization — Hidden Assets). Wire-absent default = visible.

§camera_id: Option<CameraId>

Camera identifier (export-stripped).

§device_id: Uuid

Importing device id (UUIDv4; export-stripped).

§session_id: Uuid

Importing session id (UUIDv7; export-stripped).

§gps: Option<Gps>

Geolocation as imported (export-rounded). A user’s location edit never overwrites it; it lands in gps_user, and effective_gps is the location the asset is placed at.

§gps_user: Lww<Option<Gps>>

The user’s location edit: an LWW register over Option<Gps>, written by Workspace::set_location with GpsSource::Manual. A stamped None is an explicit “no location”, which hides an as-imported fix without erasing it. Wire-absent when never written (export-rounded like gps).

§provenance_chain_hash: Option<Hash32>

The prior provenance head — the record preceding the write that seals this sidecar, always equal to that write’s manifest prior_provenance_hash (SSoT: Metadata — Provenance Binding and Sealing Order). Referencing the prior head (not the sealing write’s own record) keeps the binding well-founded — the manifest commits to this sidecar’s metadata_blob_hash, so a sidecar referencing that manifest would be a cycle. Wire-absent (None) exactly on the initial create.

§unknown: BTreeMap<String, Value>

Unknown CBOR keys preserved verbatim (re-sorted canonically; covered by signature).

§signature: Option<HybridSignature>

Hybrid signature over every byte above (the canonical map minus this field).

Implementations§

Source§

impl SidecarV1

Source

pub fn effective_capture_timestamp(&self) -> &str

The capture instant the asset is dated by: the user’s correction when one was ever written, else the as-imported capture_timestamp.

Source

pub fn effective_gps(&self) -> Option<&Gps>

The location the asset is placed at: the user’s edit when one was ever written (a stamped None meaning “no location”), else the as-imported gps.

Source

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

The canonical bytes the signature covers (everything except signature).

Source

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

The full canonical CBOR encoding (including the signature, if present).

Source

pub fn sign(&mut self, ik: &HybridSigningKey)

Sign the sidecar with the user IK, setting signature.

Source

pub fn verify(&self, ik_public: &HybridVerifyingKey) -> bool

Verify the sidecar’s signature against the user IK public key.

Source

pub fn max_add_counter_for(&self, device: &Uuid) -> Option<u64>

The highest add_id.counter device has written into any AddId-bearing OR-set of this sidecar — user tags, AI tags, and every region’s labels, live or deleted — or None if it wrote none. The floor a restarting device reseeds its counter from.

Source

pub fn from_canonical_slice( bytes: &[u8], max_known: u16, ) -> Result<Self, String>

Decode a sidecar from canonical CBOR bytes, refusing a schema newer than max_known (Schema Versioning Rules: an old client must not strip-and-resign a newer sidecar).

Trait Implementations§

Source§

impl Clone for SidecarV1

Source§

fn clone(&self) -> SidecarV1

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 SidecarV1

Source§

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

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

impl PartialEq for SidecarV1

Source§

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

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