@@ -22,13 +22,14 @@ import (
2222)
2323
2424// ElectAuthServer returns the default registry to use
25- // Deprecated: use registry.IndexServer instead
25+ //
26+ // Deprecated: use [registry.IndexServer] instead.
2627func ElectAuthServer (_ context.Context , _ Cli ) string {
2728 return registry .IndexServer
2829}
2930
3031// EncodeAuthToBase64 serializes the auth configuration as JSON base64 payload
31- func EncodeAuthToBase64 (authConfig types .AuthConfig ) (string , error ) {
32+ func EncodeAuthToBase64 (authConfig registrytypes .AuthConfig ) (string , error ) {
3233 buf , err := json .Marshal (authConfig )
3334 if err != nil {
3435 return "" , err
@@ -58,19 +59,19 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf
5859// ResolveAuthConfig is like registry.ResolveAuthConfig, but if using the
5960// default index, it uses the default index name for the daemon's platform,
6061// not the client's platform.
61- func ResolveAuthConfig (_ context.Context , cli Cli , index * registrytypes.IndexInfo ) types .AuthConfig {
62+ func ResolveAuthConfig (_ context.Context , cli Cli , index * registrytypes.IndexInfo ) registrytypes .AuthConfig {
6263 configKey := index .Name
6364 if index .Official {
6465 configKey = registry .IndexServer
6566 }
6667
6768 a , _ := cli .ConfigFile ().GetAuthConfig (configKey )
68- return types .AuthConfig (a )
69+ return registrytypes .AuthConfig (a )
6970}
7071
7172// GetDefaultAuthConfig gets the default auth config given a serverAddress
7273// If credentials for given serverAddress exists in the credential store, the configuration will be populated with values in it
73- func GetDefaultAuthConfig (cli Cli , checkCredStore bool , serverAddress string , isDefaultRegistry bool ) (types .AuthConfig , error ) {
74+ func GetDefaultAuthConfig (cli Cli , checkCredStore bool , serverAddress string , isDefaultRegistry bool ) (registrytypes .AuthConfig , error ) {
7475 if ! isDefaultRegistry {
7576 serverAddress = registry .ConvertToHostname (serverAddress )
7677 }
@@ -79,19 +80,19 @@ func GetDefaultAuthConfig(cli Cli, checkCredStore bool, serverAddress string, is
7980 if checkCredStore {
8081 authconfig , err = cli .ConfigFile ().GetAuthConfig (serverAddress )
8182 if err != nil {
82- return types .AuthConfig {
83+ return registrytypes .AuthConfig {
8384 ServerAddress : serverAddress ,
8485 }, err
8586 }
8687 }
8788 authconfig .ServerAddress = serverAddress
8889 authconfig .IdentityToken = ""
89- res := types .AuthConfig (authconfig )
90+ res := registrytypes .AuthConfig (authconfig )
9091 return res , nil
9192}
9293
9394// ConfigureAuth handles prompting of user's username and password if needed
94- func ConfigureAuth (cli Cli , flUser , flPassword string , authconfig * types .AuthConfig , isDefaultRegistry bool ) error {
95+ func ConfigureAuth (cli Cli , flUser , flPassword string , authconfig * registrytypes .AuthConfig , isDefaultRegistry bool ) error {
9596 // On Windows, force the use of the regular OS stdin stream. Fixes #14336/#14210
9697 if runtime .GOOS == "windows" {
9798 cli .SetIn (streams .NewIn (os .Stdin ))
@@ -181,14 +182,14 @@ func RetrieveAuthTokenFromImage(ctx context.Context, cli Cli, image string) (str
181182}
182183
183184// resolveAuthConfigFromImage retrieves that AuthConfig using the image string
184- func resolveAuthConfigFromImage (ctx context.Context , cli Cli , image string ) (types .AuthConfig , error ) {
185+ func resolveAuthConfigFromImage (ctx context.Context , cli Cli , image string ) (registrytypes .AuthConfig , error ) {
185186 registryRef , err := reference .ParseNormalizedNamed (image )
186187 if err != nil {
187- return types .AuthConfig {}, err
188+ return registrytypes .AuthConfig {}, err
188189 }
189190 repoInfo , err := registry .ParseRepositoryInfo (registryRef )
190191 if err != nil {
191- return types .AuthConfig {}, err
192+ return registrytypes .AuthConfig {}, err
192193 }
193194 return ResolveAuthConfig (ctx , cli , repoInfo .Index ), nil
194195}
0 commit comments