diff --git a/attestation/factory.go b/attestation/factory.go index 4bbb32f9..a0cab61b 100644 --- a/attestation/factory.go +++ b/attestation/factory.go @@ -90,6 +90,14 @@ func RegisterAttestation(name, predicateType string, run RunType, factoryFunc re attestationsByRun[run] = registrationEntry } +func RegisterAttestationWithTypes(name string, predicateTypes []string, run RunType, factoryFunc registry.FactoryFunc[Attestor], opts ...registry.Configurer) { + registrationEntry := attestorRegistry.Register(name, factoryFunc, opts...) + for _, predicateType := range predicateTypes { + attestationsByType[predicateType] = registrationEntry + } + attestationsByRun[run] = registrationEntry +} + func FactoryByType(uri string) (registry.FactoryFunc[Attestor], bool) { registrationEntry, ok := attestationsByType[uri] return registrationEntry.Factory, ok diff --git a/attestation/sbom/sbom.go b/attestation/sbom/sbom.go index e1245281..281c2ae8 100644 --- a/attestation/sbom/sbom.go +++ b/attestation/sbom/sbom.go @@ -48,7 +48,7 @@ var ( ) func init() { - attestation.RegisterAttestation(Name, Type, RunType, + attestation.RegisterAttestationWithTypes(Name, []string{Type, SPDXPredicateType, CycloneDxPredicateType}, RunType, func() attestation.Attestor { return NewSBOMAttestor() }, registry.BoolConfigOption( "export",