mchess-server/utils/passphrase.go

26 lines
384 B
Go
Raw Permalink Normal View History

2023-06-28 17:51:36 +00:00
package utils
import (
"strings"
)
type Passphrase string
func NewPassphrase() Passphrase {
var phrase string
var word string
var words = 3
2023-07-05 19:15:01 +00:00
//TODO make sure passphrases are unique
2023-06-28 17:51:36 +00:00
for words > 0 {
word = getCleanWord()
phrase = phrase + word + " "
2023-06-28 17:51:36 +00:00
words -= 1
}
return Passphrase(strings.TrimSpace(phrase))
}
func (p Passphrase) String() string {
return string(p)
}