Files
attest/pkg/oci/authn.go

22 lines
615 B
Go
Raw Permalink Normal View History

2024-06-18 11:55:30 -05:00
package oci
import (
ecr "github.com/awslabs/amazon-ecr-credential-helper/ecr-login"
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/v1/google"
"github.com/google/go-containerregistry/pkg/v1/remote"
)
func MultiKeychainOption() remote.Option {
return remote.WithAuthFromKeychain(MultiKeychainAll())
}
func MultiKeychainAll() authn.Keychain {
2024-06-25 13:44:18 -05:00
// Create a multi-keychain that will use the default Docker, Google, or ECR keychain
2024-06-18 11:55:30 -05:00
return authn.NewMultiKeychain(
authn.DefaultKeychain,
google.Keychain,
authn.NewKeychainFromHelper(ecr.NewECRHelper()),
)
}