GoPassword is a simple and powerful Go library to generate and save secure passwords.
To install GoPassword, run:
go get github.com/JustTimmm/GoPassword
Then import it into your project:
import "github.com/JustTimmm/GoPassword"
- Generate secure passwords with custom settings
- Save passwords as JSON files
With GoColor, you can apply text colors, background colors, and text styles (like bold, italic, etc.) to your strings. Here is a basic example:
package main
import (
"fmt"
"github.com/JustTimmm/GoPassword"
)
func main() {
password := GoPassword.GeneratePassword(16, true, true, true, true)
GoPassword.SavePassword("file", password)
}
GeneratePassword(width uint8, number, specialCharacter, uppercase, lowercase bool) string
Parameter | Type | Description |
---|---|---|
width |
uint8 |
Length of the password (8 to 128 characters) |
number |
bool |
Include digits (0-9) |
specialCharacter |
bool |
Include special characters (e.g. # , ? ) |
uppercase |
bool |
Include uppercase letters (A-Z) |
lowercase |
bool |
Include lowercase letters (a-z) |
Use SavePassword(filename string, password string)
to store your password in a JSON file:
{
"password": "Example123!"
}
The file will be saved as filename.json
.
This project is licensed under the MIT License. See the LICENSE file for details.