Skip to content

Commit

Permalink
feat: add new registry interface and renam Link
Browse files Browse the repository at this point in the history
Signed-off-by: Binbin Li <libinbin@microsoft.com>
  • Loading branch information
binbin-li committed Jun 24, 2022
1 parent 52fcb4a commit e391237
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions registry/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import (

// SignatureRepository provides a storage for signatures
type SignatureRepository interface {
// GetCoreSignatureManifest returns signature manifests for verification filterd by given subject digest
GetCoreSignatureManifest(ctx context.Context, subjectDigest digest.Digest) ([]CoreSignatureManifest, error)

// Lookup finds all signatures for the specified manifest
Lookup(ctx context.Context, manifestDigest digest.Digest) ([]digest.Digest, error)

Expand All @@ -18,6 +21,6 @@ type SignatureRepository interface {
// Put uploads the signature to the registry
Put(ctx context.Context, signature []byte) (notation.Descriptor, error)

// Link creates an signature artifact linking the manifest and the signature
Link(ctx context.Context, manifest, signature notation.Descriptor) (notation.Descriptor, error)
// CreateSignatureManifest creates an signature artifact linking the manifest and the signature
CreateSignatureManifest(ctx context.Context, manifest, signature notation.Descriptor) (notation.Descriptor, error)
}
9 changes: 7 additions & 2 deletions registry/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ type RepositoryClient struct {
remote.Repository
}

type CoreSignatureManifest struct {
Blobs []artifactspec.Descriptor
Annotations map[string]string
}

// NewRepositoryClient creates a new registry client.
func NewRepositoryClient(client remote.Client, ref registry.Reference, plainHTTP bool) *RepositoryClient {
return &RepositoryClient{
Expand Down Expand Up @@ -95,8 +100,8 @@ func (c *RepositoryClient) Put(ctx context.Context, signature []byte) (notation.
return notationDescriptorFromOCI(desc), nil
}

// Link creates an signature artifact linking the manifest and the signature
func (c *RepositoryClient) Link(ctx context.Context, manifest, signature notation.Descriptor) (notation.Descriptor, error) {
// CreateSignatureManifest creates an signature artifact linking the manifest and the signature
func (c *RepositoryClient) CreateSignatureManifest(ctx context.Context, manifest, signature notation.Descriptor) (notation.Descriptor, error) {
// generate artifact manifest
artifact := artifactspec.Manifest{
MediaType: artifactspec.MediaTypeArtifactManifest,
Expand Down

0 comments on commit e391237

Please sign in to comment.