Struct CustodyReceiptCore
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: StringSchema version (custody-receipt/v1).
crypto_suite_id: u16Primitive bundle id.
protocol_version: StringAlbum protocol pin (YYYY-MM-DD).
server_id: StringThe server’s canonical origin — binds the receipt to one server.
server_key_id: Hash32Fingerprint of the attestation key that signed; survives rotation.
receipt_seq: u64Strictly 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: StringThe upload session that produced custody.
asset_id: StringThe asset id.
blob_role: Stringoriginal | derivative | metadata | provenance.
ciphertext_hash: Hash32The server-recomputed ciphertext content address.
size: u64Ciphertext 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: StringThe user that uploaded.
uploaded_by_device: Option<String>The device that uploaded, when known.
received_at: StringThe 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§
§impl CustodyReceiptCore
impl CustodyReceiptCore
pub fn signing_bytes(&self) -> Vec<u8> ⓘ
pub fn signing_bytes(&self) -> Vec<u8> ⓘ
The canonical bytes the attestation signature covers.
Trait Implementations§
§impl Clone for CustodyReceiptCore
impl Clone for CustodyReceiptCore
§fn clone(&self) -> CustodyReceiptCore
fn clone(&self) -> CustodyReceiptCore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CustodyReceiptCore
impl Debug for CustodyReceiptCore
§impl<'de> Deserialize<'de> for CustodyReceiptCore
impl<'de> Deserialize<'de> for CustodyReceiptCore
§fn deserialize<D>(
d: D,
) -> Result<CustodyReceiptCore, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
d: D,
) -> Result<CustodyReceiptCore, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for CustodyReceiptCore
§impl PartialEq for CustodyReceiptCore
impl PartialEq for CustodyReceiptCore
§fn eq(&self, other: &CustodyReceiptCore) -> bool
fn eq(&self, other: &CustodyReceiptCore) -> bool
self and other values to be equal, and is used by ==.§impl Serialize for CustodyReceiptCore
impl Serialize for CustodyReceiptCore
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for CustodyReceiptCore
Auto Trait Implementations§
impl Freeze for CustodyReceiptCore
impl RefUnwindSafe for CustodyReceiptCore
impl Send for CustodyReceiptCore
impl Sync for CustodyReceiptCore
impl Unpin for CustodyReceiptCore
impl UnsafeUnpin for CustodyReceiptCore
impl UnwindSafe for CustodyReceiptCore
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