Skip to main content

CustodyReceiptCore

Struct CustodyReceiptCore 

Source
pub struct CustodyReceiptCore {
Show 17 fields pub version: String, pub crypto_suite_id: u16, pub protocol_version: String, pub server_id: String, pub server_key_id: Hash32, pub receipt_seq: u64, pub prior_receipt_hash: Option<Hash32>, pub upload_id: String, pub asset_id: String, pub blob_role: String, pub ciphertext_hash: Hash32, pub size: u64, pub envelope_hash: Option<Hash32>, pub uploaded_by_user: String, pub uploaded_by_device: Option<String>, pub received_at: String, pub unknown: BTreeMap<String, Value>,
}
Expand description

The signed core of a CustodyReceipt — every field the server attestation key covers.

The one definition of the receipt’s signed core. capsule-server’s attestation module signs exactly this type rather than a mirror of it, because canonical CBOR sorts map keys and two definitions of a signed structure disagree the moment either gains a field. Canonical CBOR with the manifest wire-presence discipline (absent optionals encode as absent keys).

Unknown keys survive under the signature (Versioning — invariant 2): a receipt from a newer server that only adds a field decodes here, re-emits that field canonically, and so still verifies — an older client does not mistake it for a withheld receipt. Stripping the field fails verification.

Fields§

§version: String

Schema version (custody-receipt/v1).

§crypto_suite_id: u16

Primitive bundle id.

§protocol_version: String

Album protocol pin (YYYY-MM-DD).

§server_id: String

The server’s canonical origin — binds the receipt to one server.

§server_key_id: Hash32

Fingerprint of the attestation key that signed; survives rotation.

§receipt_seq: u64

Strictly monotonic per server.

§prior_receipt_hash: Option<Hash32>

SHA-256 over the previous receipt in the server’s log; absent only for the first receipt.

§upload_id: String

The upload session that produced custody.

§asset_id: String

The asset id.

§blob_role: String

original | derivative | metadata | provenance.

§ciphertext_hash: Hash32

The server-recomputed ciphertext content address.

§size: u64

Ciphertext size in bytes.

§envelope_hash: Option<Hash32>

SHA-256 over the asset’s signed manifest — its provenance-chain position — on the receipt for the provenance blob, and absent on every other receipt.

A SHA-256 by definition, not the blob’s content address. The two are equal under every suite that content-addresses with SHA-256 and they are not the same identifier: an address is whatever digest the suite selects, while a chain position is fixed at SHA-256 because prior_provenance_hash is. Deriving one from the other is correct by coincidence, which is a trap.

Present on one receipt per manifest, and that is the whole design. The provenance blob is the signed manifest, so its receipt names the manifest twice — once as the bytes taken custody of, once as the chain position — and the manifest itself commits to the other blobs’ hashes. So “this blob was accepted under this manifest” is provable from content addressing, and no other receipt needs to restate it. The server earlier hashed its own re-serialization of the JSON projection of the manifest, which no client outside this exact Rust type could reproduce and which reordering a struct field would have silently invalidated.

§uploaded_by_user: String

The user that uploaded.

§uploaded_by_device: Option<String>

The device that uploaded, when known.

§received_at: String

The server’s trusted clock at the finalization commit (RFC 3339).

§unknown: BTreeMap<String, Value>

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

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

Implementations§

Source§

impl CustodyReceiptCore

Source

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

The canonical bytes the attestation signature covers.

Trait Implementations§

Source§

impl Clone for CustodyReceiptCore

Source§

fn clone(&self) -> CustodyReceiptCore

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 CustodyReceiptCore

Source§

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

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

impl<'de> Deserialize<'de> for CustodyReceiptCore

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 CustodyReceiptCore

Source§

impl PartialEq for CustodyReceiptCore

Source§

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

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 CustodyReceiptCore

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