diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2021-08-18 18:13:18 -0600 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2021-08-18 18:13:44 -0600 |
commit | a9d8aa2591cd03fe1a9da72bab8d311e4840e8f1 (patch) | |
tree | 98a32eb3a2719f10dc0d55a206851e3793e61388 /srv/cmd/userid-calc-cli | |
parent | bec64827d19d64aae86ca3d2b26de800b427a540 (diff) |
implemented basic userID generation
Diffstat (limited to 'srv/cmd/userid-calc-cli')
-rw-r--r-- | srv/cmd/userid-calc-cli/main.go | 27 | ||||
-rwxr-xr-x | srv/cmd/userid-calc-cli/userid-calc-cli | bin | 0 -> 2711927 bytes |
2 files changed, 27 insertions, 0 deletions
diff --git a/srv/cmd/userid-calc-cli/main.go b/srv/cmd/userid-calc-cli/main.go new file mode 100644 index 0000000..c86ae5d --- /dev/null +++ b/srv/cmd/userid-calc-cli/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "encoding/json" + "flag" + "fmt" + + "github.com/mediocregopher/blog.mediocregopher.com/srv/chat" +) + +func main() { + + secret := flag.String("secret", "", "Secret to use when calculating UserIDs") + name := flag.String("name", "", "") + password := flag.String("password", "", "") + flag.Parse() + + calc := chat.NewUserIDCalculator([]byte(*secret)) + userID := calc.Calculate(*name, *password) + + b, err := json.Marshal(userID) + if err != nil { + panic(err) + } + + fmt.Println(string(b)) +} diff --git a/srv/cmd/userid-calc-cli/userid-calc-cli b/srv/cmd/userid-calc-cli/userid-calc-cli Binary files differnew file mode 100755 index 0000000..ca18cc3 --- /dev/null +++ b/srv/cmd/userid-calc-cli/userid-calc-cli |