This package provides a secure and customizable password generator in Go. It allows you to generate random passwords with optional parameters to include uppercase letters, numbers, and special characters.
package main
import (
"fmt"
password "github.com/InheritxSolution/password-generator"
)
func main() {
// Generate a password with default options (length 12, lowercase only)
pass1, err := password.GeneratePassword()
if err != nil {
fmt.Println("Error generating password:", err)
return
}
fmt.Println("Default Password:", pass1)
// Generate a password with custom options
pass2, err := password.GeneratePassword(
password.WithLength(16),
password.WithUpper(),
password.WithNumbers(),
password.WithSpecial(),
)
if err != nil {
fmt.Println("Error generating password:", err)
return
}
fmt.Println("Custom Password:", pass2)
}