...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package signed
17
18 import (
19 "errors"
20
21 v1 "github.com/google/go-containerregistry/pkg/v1"
22
23 "github.com/sigstore/cosign/v2/pkg/oci"
24 "github.com/sigstore/cosign/v2/pkg/oci/empty"
25 )
26
27
28
29 func ImageIndex(i v1.ImageIndex) oci.SignedImageIndex {
30 return &index{
31 v1Index: i,
32 }
33 }
34
35 type v1Index v1.ImageIndex
36
37 type index struct {
38 v1Index
39 }
40
41 var _ oci.SignedImageIndex = (*index)(nil)
42
43
44 func (ii *index) SignedImage(h v1.Hash) (oci.SignedImage, error) {
45 i, err := ii.Image(h)
46 if err != nil {
47 return nil, err
48 }
49 return Image(i), nil
50 }
51
52
53 func (ii *index) SignedImageIndex(h v1.Hash) (oci.SignedImageIndex, error) {
54 i, err := ii.ImageIndex(h)
55 if err != nil {
56 return nil, err
57 }
58 return ImageIndex(i), nil
59 }
60
61
62 func (*index) Signatures() (oci.Signatures, error) {
63 return empty.Signatures(), nil
64 }
65
66
67 func (*index) Attestations() (oci.Signatures, error) {
68 return empty.Signatures(), nil
69 }
70
71
72 func (*index) Attachment(name string) (oci.File, error) {
73 return nil, errors.New("unimplemented")
74 }
75
View as plain text