(trustedRoot *root.TrustedRoot)
| 312 | } |
| 313 | |
| 314 | func newCustomVerifier(trustedRoot *root.TrustedRoot) (*verify.Verifier, error) { |
| 315 | // All we know about this trust root is its configuration so make some |
| 316 | // educated guesses as to what the policy should be. |
| 317 | verifierConfig := []verify.VerifierOption{} |
| 318 | // This requires some independent corroboration of the signing certificate |
| 319 | // (e.g. from Sigstore Fulcio) time, one of: |
| 320 | // - a signed timestamp from a timestamp authority in the trusted root |
| 321 | // - a transparency log entry (e.g. from Sigstore Rekor) |
| 322 | verifierConfig = append(verifierConfig, verify.WithObserverTimestamps(1)) |
| 323 | |
| 324 | // Infer verification options from contents of trusted root |
| 325 | if len(trustedRoot.RekorLogs()) > 0 { |
| 326 | verifierConfig = append(verifierConfig, verify.WithTransparencyLog(1)) |
| 327 | } |
| 328 | |
| 329 | gv, err := verify.NewVerifier(trustedRoot, verifierConfig...) |
| 330 | if err != nil { |
| 331 | return nil, fmt.Errorf("failed to create custom verifier: %v", err) |
| 332 | } |
| 333 | |
| 334 | return gv, nil |
| 335 | } |
| 336 | |
| 337 | func newGitHubVerifier(trustDomain string, tufMetadataDir o.Option[string], hc *http.Client) (*verify.Verifier, error) { |
| 338 | var tr string |
no test coverage detected