func getCosignOptions()

in pkg/container/attestations.go [28:54]


func getCosignOptions(ctx context.Context) (*cosign.CheckOpts, error) {
	rekorPubKeys, err := cosign.GetRekorPubs(ctx)
	if err != nil {
		return nil, errors.Wrap(types.ErrInternal, err.Error())
	}

	ctPubKeys, err := cosign.GetCTLogPubs(ctx)
	if err != nil {
		return nil, errors.Wrap(types.ErrInternal, err.Error())
	}

	roots, err := fulcio.GetRoots()
	if err != nil {
		return nil, errors.Wrap(types.ErrInternal, err.Error())
	}
	intermediates, err := fulcio.GetIntermediates()
	if err != nil {
		return nil, errors.Wrap(types.ErrInternal, err.Error())
	}

	return &cosign.CheckOpts{
		RootCerts:         roots,
		IntermediateCerts: intermediates,
		RekorPubKeys:      rekorPubKeys,
		CTLogPubKeys:      ctPubKeys,
	}, nil
}