getExtensionsSignatures returns signatures from the X-Registry-Supports-Signatures API extension, using the original data structures.
(ctx context.Context, ref dockerReference, manifestDigest digest.Digest)
| 1167 | // getExtensionsSignatures returns signatures from the X-Registry-Supports-Signatures API extension, |
| 1168 | // using the original data structures. |
| 1169 | func (c *dockerClient) getExtensionsSignatures(ctx context.Context, ref dockerReference, manifestDigest digest.Digest) (*extensionSignatureList, error) { |
| 1170 | if err := manifestDigest.Validate(); err != nil { // Make sure manifestDigest.String() does not contain any unexpected characters |
| 1171 | return nil, err |
| 1172 | } |
| 1173 | path := fmt.Sprintf(extensionsSignaturePath, reference.Path(ref.ref), manifestDigest) |
| 1174 | res, err := c.makeRequest(ctx, http.MethodGet, path, nil, nil, v2Auth, nil) |
| 1175 | if err != nil { |
| 1176 | return nil, err |
| 1177 | } |
| 1178 | defer res.Body.Close() |
| 1179 | if res.StatusCode != http.StatusOK { |
| 1180 | return nil, fmt.Errorf("downloading signatures for %s in %s: %w", manifestDigest, ref.ref.Name(), registryHTTPResponseToError(res)) |
| 1181 | } |
| 1182 | |
| 1183 | body, err := iolimits.ReadAtMost(res.Body, iolimits.MaxSignatureListBodySize) |
| 1184 | if err != nil { |
| 1185 | return nil, err |
| 1186 | } |
| 1187 | |
| 1188 | var parsedBody extensionSignatureList |
| 1189 | if err := json.Unmarshal(body, &parsedBody); err != nil { |
| 1190 | return nil, fmt.Errorf("decoding signature list: %w", err) |
| 1191 | } |
| 1192 | return &parsedBody, nil |
| 1193 | } |
| 1194 | |
| 1195 | // sigstoreAttachmentTag returns a sigstore attachment tag for the specified digest. |
| 1196 | func sigstoreAttachmentTag(d digest.Digest) (string, error) { |
no test coverage detected