feat: add internal/auth package for credential-based login

This commit is contained in:
Mathis Maquenne
2026-07-29 11:33:50 +02:00
parent 3ce5c4d365
commit 56b0f404d6
4 changed files with 403 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package auth
import (
"bufio"
"fmt"
"os"
"strings"
"golang.org/x/term"
)
func PromptCredentials() (string, string, error) {
fmt.Print("Email: ")
line, err := bufio.NewReader(os.Stdin).ReadString('\n')
if err != nil {
return "", "", err
}
email := strings.TrimSpace(line)
fmt.Print("Password: ")
passwordBytes, err := term.ReadPassword(int(os.Stdin.Fd()))
fmt.Println()
if err != nil {
return "", "", err
}
return email, string(passwordBytes), nil
}