mchess-server/utils/passphrase.go

26 lines
384 B
Go

package utils
import (
"strings"
)
type Passphrase string
func NewPassphrase() Passphrase {
var phrase string
var word string
var words = 3
//TODO make sure passphrases are unique
for words > 0 {
word = getCleanWord()
phrase = phrase + word + " "
words -= 1
}
return Passphrase(strings.TrimSpace(phrase))
}
func (p Passphrase) String() string {
return string(p)
}