Add hashpw utility for generating password hashes
Simple CLI utility to generate bcrypt password hashes for admin users. Usage: hashpw <password> This utility helps administrators generate properly hashed passwords for use in configuration files or manual user setup.
This commit is contained in:
parent
c8e0281953
commit
f9ca2c0e68
1 changed files with 24 additions and 0 deletions
24
cmd/hashpw/main.go
Normal file
24
cmd/hashpw/main.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/rcourtman/pulse-go-rewrite/internal/auth"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) < 2 {
|
||||
fmt.Println("Usage: hashpw <password>")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
password := os.Args[1]
|
||||
hash, err := auth.HashPassword(password)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
fmt.Println(hash)
|
||||
}
|
||||
Loading…
Reference in a new issue