encodeAuth creates a base64 encoded string to containing authorization information
(authConfig *types.AuthConfig)
| 282 | |
| 283 | // encodeAuth creates a base64 encoded string to containing authorization information |
| 284 | func encodeAuth(authConfig *types.AuthConfig) string { |
| 285 | if authConfig.Username == "" && authConfig.Password == "" { |
| 286 | return "" |
| 287 | } |
| 288 | |
| 289 | authStr := authConfig.Username + ":" + authConfig.Password |
| 290 | msg := []byte(authStr) |
| 291 | encoded := make([]byte, base64.StdEncoding.EncodedLen(len(msg))) |
| 292 | base64.StdEncoding.Encode(encoded, msg) |
| 293 | return string(encoded) |
| 294 | } |
| 295 | |
| 296 | // decodeAuth decodes a base64 encoded string and returns username and password |
| 297 | func decodeAuth(authStr string) (string, string, error) { |
no outgoing calls
searching dependent graphs…