Skip to content

refactor(artifact)!: make artifact digests typed - #184

Merged
wolfv merged 2 commits into
mainfrom
artifact/typed-input
Aug 18, 2026
Merged

wolfv merged 2 commits into
mainfrom
artifact/typed-input

Conversation

@wolfv

@wolfv wolfv commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Makes artifact inputs explicit and type-safe before 1.0:

pub enum Artifact<'a> {
    Blob(&'a [u8]),
    Digest(ArtifactDigest),
}

ArtifactDigest carries its HashAlgorithm and validates the digest length at construction. Verification therefore rejects algorithm mismatches instead of interpreting arbitrary bytes according to whichever bundle field is inspected later.

Signing now accepts SHA-256 digest input as documented, signs it directly in prehashed mode, and uses the same value in the hashedrekord entry. Supplying a digest explicitly means the caller—not the library—is asserting the artifact identity.

Stack

  1. fix(sign): keep unbounded hashing and signing from starving the async executor #183: incremental/prehashed signing foundation
  2. This PR: typed blob and digest inputs
  3. feat(artifact)!: stream artifacts from sync and async readers #185: synchronous and asynchronous reader APIs

BREAKING CHANGE: digest inputs must use ArtifactDigest; untyped DigestBytes conversions are removed and Artifact::Bytes is renamed Artifact::Blob.

Signed-off-by: Wolf Vollprecht w.vollprecht@gmail.com

wolfv added 2 commits August 17, 2026 14:18
Replace ambiguous digest bytes with ArtifactDigest, which carries and validates its HashAlgorithm, and rename Artifact::Bytes to Artifact::Blob. Signing now accepts SHA-256 digests directly through prehashed ECDSA while verification rejects algorithm mismatches explicitly.

BREAKING CHANGE: Artifact digest inputs must use ArtifactDigest; untyped DigestBytes conversions are removed and Artifact::Bytes is renamed Artifact::Blob.

Signed-off-by: Wolf Vollprecht <w.vollprecht@gmail.com>
Signed-off-by: Wolf Vollprecht <w.vollprecht@gmail.com>
@wolfv
wolfv force-pushed the artifact/typed-input branch from e11173a to 9c58069 Compare August 17, 2026 12:18

@jku jku left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm -- although I actually reviewed the version 20 mins ago (before the rebase): I'm assuming it was a clean rebase, let me know if there were actual changes

@wolfv
wolfv merged commit 0559b32 into main Aug 18, 2026
17 checks passed
@wolfv
wolfv deleted the artifact/typed-input branch August 18, 2026 10:26
@wolfv wolfv mentioned this pull request Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants