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: ArtifactVersionArtifact format version.
artifact_id: StringUnique artifact identifier — bound into every co-signature to prevent replay onto other artifacts.
payload: ValueThe 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
impl TrustedArtifact
Sourcepub fn new(
version: ArtifactVersion,
artifact_id: impl Into<String>,
payload: Value,
payload_schema: Option<String>,
) -> SignatifResult<Self>
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.
Sourcepub fn cosign_input(&self, dimension: &DimensionTag) -> Vec<u8> ⓘ
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.
Sourcepub 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<()>
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.
Sourcepub fn add_attestation(
&mut self,
block: CoSignatureBlock,
registry: &Registry,
) -> SignatifResult<()>
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.
Sourcepub fn verify_self(
&self,
registry: &Registry,
verifier: &dyn SignatureVerifier,
) -> SignatifResult<()>
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.
Sourcepub fn dimensions_verified(&self) -> Vec<DimensionTag>
pub fn dimensions_verified(&self) -> Vec<DimensionTag>
The distinct dimensions attested by currently-valid blocks.
Sourcepub fn distinct_roots(&self) -> Vec<String>
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
impl Clone for TrustedArtifact
Source§fn clone(&self) -> TrustedArtifact
fn clone(&self) -> TrustedArtifact
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more