code: func ResolveAuthConfig(authConfigs map[string]types.AuthConfig, index *registrytypes.IndexInfo) types.AuthConfig {
  	configKey := GetAuthConfigKey(index)
  	// First try the happy case
  	if c, found := authConfigs[configKey]; found || index.Official {
  		return c
  	}
  
  	// Maybe they have a legacy config file, we will iterate the keys converting
  	// them to the new format and testing
  	for registry, ac := range authConfigs {
  		if configKey == ConvertToHostname(registry) {
  			return ac
  		}
  	}
  
  	// When all else fails, return an empty auth config
  	return types.AuthConfig{}
  }
docs: // ResolveAuthConfig matches an auth configuration to a server address or a URL