Example #1
0
// Prompts the user for a password
func getPassword() string {
	password, err := prompt.Password("Your password (if you're not sure what your password is, set it at https://www.asknestor.me/users/me/edit): ")
	if err != nil {
		os.Exit(1)
	}

	return password
}
Example #2
0
func ExamplePassword() ([]byte, error) {
	clear, err := prompt.Password("Password")
	if err != nil {
		return nil, err
	}

	return bcrypt.GenerateFromPassword([]byte(clear), bcrypt.DefaultCost)
}