2023-06-28 17:51:36 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Passphrase string
|
|
|
|
|
|
|
|
func NewPassphrase() Passphrase {
|
|
|
|
var phrase string
|
|
|
|
var word string
|
2024-04-30 21:55:27 +00:00
|
|
|
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 {
|
2024-04-30 21:55:27 +00:00
|
|
|
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)
|
|
|
|
}
|