// PromptPassword - Prompts for masked password.
178130
func PromptPassword(entity string) string {
	for {
		value := prompt.PasswordMasked(entity)
		if value != "" {
			return value
		}
		logger.Printf("%s cannot be empty", entity)
	}
}
981572
func (tc *TeleportClient) AskPassword() (pwd string, err error) {
	fmt.Printf("Enter password for Teleport user %v:\n", tc.Config.Username)
	pwd, err = passwordFromConsole()
	if err != nil {
		fmt.Fprintln(tc.Stderr, err)
		return "", trace.Wrap(err)
	}

	return pwd, nil
}
452883
func (o *LoginUserParams) bindPassword(rawData []string, hasKey bool, formats strfmt.Registry) error {
	var raw string
	if len(rawData) > 0 {
		raw = rawData[len(rawData)-1]
	}

	// Required: false
	// AllowEmptyValue: false
	if raw == "" { // empty values pass all other validations
		return nil
	}

	o.Password = &raw

	return nil
}
324414
func (s *RedshiftDestinationConfiguration) SetPassword(v string) *RedshiftDestinationConfiguration {
	s.Password = &v
	return s
}
1220451
func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
	t.lock.Lock()
	defer t.lock.Unlock()

	oldPrompt := t.prompt
	t.prompt = []rune(prompt)
	t.echo = false

	line, err = t.readLine()

	t.prompt = oldPrompt
	t.echo = true

	return
}
468754
func (f PasswordFunc) AuthenticatePassword(ctx context.Context, user, password string) (*Response, bool, error) {
	return f(ctx, user, password)
}
782475
func (s *TemporaryCredential) SetPassword(v string) *TemporaryCredential {
	s.Password = &v
	return s
}
879275
func Prompt(msg string) (string, error) {
	stdin, err := OpenConsole(os.O_RDONLY)
	if err != nil {
		return "", err
	}
	defer stdin.Close()

	fmt.Print(msg)
	scanner := bufio.NewScanner(stdin)
	scanner.Scan()
	if err := scanner.Err(); err != nil {
		return "", err
	}

	input := scanner.Text()
	if input == "" {
		return "", ErrCanceled
	}
	return input, nil
}
994218
func Password(confirm bool, override *string) (string, error) {
	preferences, err := prefs.NewPreferences()
	if err != nil {
		return "", err
	}

	label := "Password"
	if override != nil {
		label = *override
	}

	if !ui.Attached() {
		return "", errs.ErrTerminalRequired
	}

	prompt := &promptui.Prompt{
		Label:     label,
		Mask:      pwMask,
		Validate:  promptui.ValidateFunc(validate.Password),
		IsVimMode: preferences.Core.Vim,
	}

	password, err := prompt.Run()
	if err != nil {
		return "", err
	}

	if !confirm {
		return password, err
	}

	prompt = &promptui.Prompt{
		Label:     "Confirm " + label,
		Mask:      pwMask,
		Validate:  promptui.ValidateFunc(validate.ConfirmPassword(password)),
		IsVimMode: preferences.Core.Vim,
	}

	_, err = prompt.Run()
	if err != nil {
		return "", convertErr(err)
	}

	return password, nil
}
408296
func (s *Secret) Password() string {
	s.Lock()
	defer s.Unlock()

	return s.password
}
593935
func (a *PromptingAuthLoader) Prompt() *clientauth.Info {
	auth := &clientauth.Info{}
	auth.User = promptForString("Username", a.reader)
	auth.Password = promptForString("Password", a.reader)

	return auth
}
990105
func (s *AuthServer) CheckPassword(user string, password []byte, otpToken string) error {
	err := s.CheckPasswordWOToken(user, password)
	if err != nil {
		return trace.Wrap(err)
	}

	err = s.CheckOTP(user, otpToken)
	return trace.Wrap(err)
}
1166045
func (auth *Auth) VerifyPassword(ctx context.Context, email, password string) (string, error) {
	resp, err := auth.client.VerifyPassword(&identitytoolkit.IdentitytoolkitRelyingpartyVerifyPasswordRequest{
		Email:    email,
		Password: password,
	}).Context(ctx).Do()
	if err != nil {
		return "", err
	}
	return resp.LocalId, nil
}
810310
func Password(prefix string) (string, error) {
	term, err := NewTerminal()
	if err != nil {
		return "", err
	}
	defer term.Close()

	return term.Password(prefix)
}
1045006
func (p *terminalPrompter) PromptPassword(prompt string) (passwd string, err error) {
	if p.supported {
		p.rawMode.ApplyMode()
		defer p.normalMode.ApplyMode()
		return p.State.PasswordPrompt(prompt)
	}
	if !p.warned {
		fmt.Println("!! Unsupported terminal, password will be echoed.")
		p.warned = true
	}
	// Just as in Prompt, handle printing the prompt here instead of relying on liner.
	fmt.Print(prompt)
	passwd, err = p.State.Prompt("")
	fmt.Println()
	return passwd, err
}
35861
func scrambleOldPassword(scramble []byte, password string) []byte {
	if len(password) == 0 {
		return nil
	}

	scramble = scramble[:8]

	hashPw := pwHash([]byte(password))
	hashSc := pwHash(scramble)

	r := newMyRnd(hashPw[0]^hashSc[0], hashPw[1]^hashSc[1])

	var out [8]byte
	for i := range out {
		out[i] = r.NextByte() + 64
	}

	mask := r.NextByte()
	for i := range out {
		out[i] ^= mask
	}

	return out[:]
}
146193
func (s *RedshiftDestinationUpdate) SetPassword(v string) *RedshiftDestinationUpdate {
	s.Password = &v
	return s
}