Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions cmd/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
package cmd

import (
"bufio"
"fmt"
"os"
"syscall"

"github.com/spf13/cobra"
Expand All @@ -28,16 +30,31 @@ var HashCmd = &cobra.Command{
Use: "hash",
Short: "hashes a password for use with example user store",
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Print("Enter Password: ")
bytePassword, err := terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
return err
var bytePassword []byte
var err error
isTerminal := terminal.IsTerminal(int(syscall.Stdin))
if isTerminal {
fmt.Print("Enter Password: ")
bytePassword, err = terminal.ReadPassword(int(syscall.Stdin))
if err != nil {
return err
}
} else {
bio := bufio.NewScanner(os.Stdin)
bio.Scan()
err = bio.Err()
if err != nil {
return err
}
bytePassword = bio.Bytes()
}
hashedPassword, err := hashPassword(bytePassword)
if err != nil {
return err
}
fmt.Println()
if isTerminal {
fmt.Println()
}
fmt.Println(string(hashedPassword))
return nil
},
Expand Down
54 changes: 37 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,63 @@ module github.com/amdonov/lite-idp

require (
github.com/PuerkitoBio/goquery v1.4.1
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 // indirect
github.com/alicebob/miniredis v0.0.0-20180911162847-3657542c8629
github.com/allegro/bigcache v1.2.1
github.com/amdonov/xmlsig v0.1.0
github.com/andybalholm/cascadia v1.0.0 // indirect
github.com/beevik/etree v1.1.0 // indirect
github.com/elazarl/go-bindata-assetfs v1.0.0
github.com/go-redis/redis v6.15.5+incompatible
github.com/golang/protobuf v1.3.2
github.com/google/uuid v1.3.0
github.com/gorilla/handlers v1.4.2
github.com/julienschmidt/httprouter v1.2.0
github.com/ma314smith/signedxml v0.0.0-20161222022618-9781f7e0c2f1
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.9.0
github.com/wrouesnel/certutils v0.0.0-20250530052121-3ad759073b52
golang.org/x/crypto v0.23.0
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6 // indirect
github.com/andybalholm/cascadia v1.0.0 // indirect
github.com/beevik/etree v1.1.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/uuid v1.1.1
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/handlers v1.4.2
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hpcloud/tail v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jtolds/gls v4.2.1+incompatible // indirect
github.com/julienschmidt/httprouter v1.2.0
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/ma314smith/signedxml v0.0.0-20161222022618-9781f7e0c2f1
github.com/magiconair/properties v1.8.1 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/onsi/ginkgo v1.6.0 // indirect
github.com/onsi/gomega v1.4.1 // indirect
github.com/paulgriffiths/pki v0.0.0-20200320011419-a59892a7d247 // indirect
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 // indirect
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/afero v1.14.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.2.2
github.com/spf13/pflag v1.0.5 // indirect
github.com/yuin/gopher-lua v0.0.0-20180912021107-ed65620d4bd7 // indirect
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.23.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

go 1.13
go 1.24.3

toolchain go1.24.4
Loading