From 9cad88a6875fdc66f66a274ee217002d90f58f8f Mon Sep 17 00:00:00 2001 From: mrjoelkamp Date: Thu, 8 Aug 2024 13:06:56 -0500 Subject: [PATCH] fix: EmptyConfigImage digest --- pkg/attestation/attestation.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/attestation/attestation.go b/pkg/attestation/attestation.go index 306cf1b..c7050dc 100644 --- a/pkg/attestation/attestation.go +++ b/pkg/attestation/attestation.go @@ -1,6 +1,7 @@ package attestation import ( + "bytes" "context" "encoding/json" "fmt" @@ -329,3 +330,12 @@ func (i *EmptyConfigImage) RawManifest() ([]byte, error) { } return json.Marshal(mf) } + +func (i *EmptyConfigImage) Digest() (v1.Hash, error) { + mb, err := i.RawManifest() + if err != nil { + return v1.Hash{}, err + } + digest, _, err := v1.SHA256(bytes.NewReader(mb)) + return digest, err +}