Get and validate OCI credentials by providing a repository URL
(repoURI, username, password string)
| 42 | |
| 43 | // Get and validate OCI credentials by providing a repository URL |
| 44 | func NewCredentials(repoURI, username, password string) (authn.Keychain, error) { |
| 45 | repo, err := name.NewRepository(repoURI) |
| 46 | if err != nil { |
| 47 | return nil, fmt.Errorf("invalid repository URI: %w", err) |
| 48 | } |
| 49 | |
| 50 | // NOTE: NewRepository parses incorrectly URIs with schemas |
| 51 | c := &Credentials{username, password, repo.RegistryStr()} |
| 52 | return validateOCICredentials(c) |
| 53 | } |
| 54 | |
| 55 | // Resolve implements an authn.KeyChain |
| 56 | // |