Skip to main content

TrustedArtifact

Struct TrustedArtifact 

Source
pub struct TrustedArtifact {
    pub version: ArtifactVersion,
    pub artifact_id: String,
    pub payload: Value,
    pub payload_schema: Option<String>,
    pub canonical_payload_hash: [u8; 32],
    pub co_signatures: Vec<CoSignatureBlock>,
}
Expand description

A trusted artifact: payload + dimension attestations.

Fields§

§version: ArtifactVersion

Artifact format version.

§artifact_id: String

Unique artifact identifier — bound into every co-signature to prevent replay onto other artifacts.

§payload: Value

The domain payload (schema identified by $payload_schema).

§payload_schema: Option<String>

URI identifying the payload schema.

§canonical_payload_hash: [u8; 32]

SHA-256 of the JCS canonicalization of the payload.

§co_signatures: Vec<CoSignatureBlock>

The dimension attestations converging on this artifact.

Implementations§

Source§

impl TrustedArtifact

Source

pub fn new( version: ArtifactVersion, artifact_id: impl Into<String>, payload: Value, payload_schema: Option<String>, ) -> SignatifResult<Self>

Create a new artifact, computing the canonical payload hash.

§Errors

Propagates canonicalization errors.

Source

pub fn cosign_input(&self, dimension: &DimensionTag) -> Vec<u8>

The signing input for a co-signature: artifact identity bound to the canonical payload hash, so blocks are artifact-specific and cannot be replayed across artifacts.

Source

pub fn sign( &mut self, dimension: DimensionTag, algorithm: impl Into<String>, signer_cert_ref: impl Into<String>, signer_pubkey: Vec<u8>, chain_ref: impl Into<String>, signer: &dyn Fn(&[u8]) -> Vec<u8>, registry: &Registry, ) -> SignatifResult<()>

Produce a co-signature over this artifact (helper for signers).

§Errors

Propagates canonicalization errors.

Source

pub fn add_attestation( &mut self, block: CoSignatureBlock, registry: &Registry, ) -> SignatifResult<()>

Living artifacts: add a dimension attestation. The block must sign the original canonical payload hash — enforced because the signing input derives from the fixed hash and artifact id.

§Errors

Returns a registry error for unknown dimensions or unusable algorithms.

Source

pub fn verify_self( &self, registry: &Registry, verifier: &dyn SignatureVerifier, ) -> SignatifResult<()>

Verify the artifact’s self-consistency: the recorded canonical payload hash equals the hash of the current payload (detects any post-signing payload modification — signature wrapping prevention), and every block is verified independently against its own public key.

§Errors

SignatifError::ArtifactFormat on hash mismatch or an unknown/retired algorithm; SignatifError::BadSignature when a block fails to verify.

Source

pub fn dimensions_verified(&self) -> Vec<DimensionTag>

The distinct dimensions attested by currently-valid blocks.

Source

pub fn distinct_roots(&self) -> Vec<String>

The distinct chain (root) references across blocks — feeds the coverage report’s independent-root count.

Trait Implementations§

Source§

impl Clone for TrustedArtifact

Source§

fn clone(&self) -> TrustedArtifact

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 TrustedArtifact

Source§

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

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

impl<'de> Deserialize<'de> for TrustedArtifact

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 Serialize for TrustedArtifact

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

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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