2022-04-05 07:09:27 +00:00
|
|
|
//
|
|
|
|
// Copyright 2020 Wireline, Inc.
|
|
|
|
//
|
|
|
|
|
|
|
|
package utils
|
|
|
|
|
|
|
|
import "github.com/cosmos/go-bip39"
|
|
|
|
|
|
|
|
const (
|
|
|
|
mnemonicEntropySize = 256
|
|
|
|
)
|
|
|
|
|
|
|
|
func GenerateMnemonic() (string, error) {
|
|
|
|
entropySeed, err := bip39.NewEntropy(mnemonicEntropySize)
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
|
2022-09-06 16:47:11 +00:00
|
|
|
mnemonic, err := bip39.NewMnemonic(entropySeed)
|
2022-04-05 07:09:27 +00:00
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
|
|
|
|
return mnemonic, nil
|
|
|
|
}
|