| 1 |
// Copyright The Notary Project Authors. |
| 2 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 |
// you may not use this file except in compliance with the License. |
| 4 |
// You may obtain a copy of the License at |
| 5 |
// |
| 6 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 |
// |
| 8 |
// Unless required by applicable law or agreed to in writing, software |
| 9 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 |
// See the License for the specific language governing permissions and |
| 12 |
// limitations under the License. |
| 13 |
|
| 14 |
// Package registry provides access to signatures in a registry |
| 15 |
package registry |
| 16 |
|
| 17 |
import ( |
| 18 |
"context" |
| 19 |
|
| 20 |
ocispec "github.com/opencontainers/image-spec/specs-go/v1" |
| 21 |
) |
| 22 |
|
| 23 |
// Repository provides registry functionalities for storage and retrieval |
| 24 |
// of signature. |
| 25 |
type Repository interface { |
| 26 |
// Resolve resolves a reference(tag or digest) to a manifest descriptor |
| 27 |
Resolve(ctx context.Context, reference string) (ocispec.Descriptor, error) |
| 28 |
|
| 29 |
// ListSignatures returns signature manifests filtered by fn given the |
| 30 |
// target artifact's manifest descriptor |
| 31 |
ListSignatures(ctx context.Context, desc ocispec.Descriptor, fn func(signatureManifests []ocispec.Descriptor) error) error |
| 32 |
|
| 33 |
// FetchSignatureBlob returns signature envelope blob and descriptor for |
| 34 |
// given signature manifest descriptor |
| 35 |
FetchSignatureBlob(ctx context.Context, desc ocispec.Descriptor) ([]byte, ocispec.Descriptor, error) |
| 36 |
|
| 37 |
// PushSignature creates and uploads an signature manifest along with its |
| 38 |
// linked signature envelope blob. |
| 39 |
PushSignature(ctx context.Context, mediaType string, blob []byte, subject ocispec.Descriptor, annotations map[string]string) (blobDesc, manifestDesc ocispec.Descriptor, err error) |
| 40 |
} |