GetSignaturesWithFormat returns the image's signatures. It may use a remote (= slow) service. If instanceDigest is not nil, it contains a digest of the specific manifest instance to retrieve signatures for (when the primary manifest is a manifest list); this never happens if the primary manifest is
(ctx context.Context, instanceDigest *digest.Digest)
| 462 | // (when the primary manifest is a manifest list); this never happens if the primary manifest is not a manifest list |
| 463 | // (e.g. if the source never returns manifest lists). |
| 464 | func (s *dockerImageSource) GetSignaturesWithFormat(ctx context.Context, instanceDigest *digest.Digest) ([]signature.Signature, error) { |
| 465 | if err := s.c.detectProperties(ctx); err != nil { |
| 466 | return nil, err |
| 467 | } |
| 468 | var res []signature.Signature |
| 469 | switch { |
| 470 | case s.c.supportsSignatures: |
| 471 | if err := s.appendSignaturesFromAPIExtension(ctx, &res, instanceDigest); err != nil { |
| 472 | return nil, err |
| 473 | } |
| 474 | case s.c.signatureBase != nil: |
| 475 | if err := s.appendSignaturesFromLookaside(ctx, &res, instanceDigest); err != nil { |
| 476 | return nil, err |
| 477 | } |
| 478 | default: |
| 479 | return nil, errors.New("Internal error: X-Registry-Supports-Signatures extension not supported, and lookaside should not be empty configuration") |
| 480 | } |
| 481 | |
| 482 | if err := s.appendSignaturesFromSigstoreAttachments(ctx, &res, instanceDigest); err != nil { |
| 483 | return nil, err |
| 484 | } |
| 485 | return res, nil |
| 486 | } |
| 487 | |
| 488 | // manifestDigest returns a digest of the manifest, from instanceDigest if non-nil; or from the supplied reference, |
| 489 | // or finally, from a fetched manifest. |
nothing calls this directly
no test coverage detected