MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / NewCredentials

Function NewCredentials

internal/ociauth/auth.go:44–53  ·  view source on GitHub ↗

Get and validate OCI credentials by providing a repository URL

(repoURI, username, password string)

Source from the content-addressed store, hash-verified

42
43// Get and validate OCI credentials by providing a repository URL
44func 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//

Callers 4

FromCredentialsMethod · 0.92
TestFromCredentialsFunction · 0.92
TestNewCredentialsFunction · 0.85

Calls 1

validateOCICredentialsFunction · 0.85

Tested by 2

TestFromCredentialsFunction · 0.74
TestNewCredentialsFunction · 0.68