laconicd/utils/mnemonic.go
0xmuralik ec3e8f7ce3 lint
2022-10-17 11:55:19 +05:30

26 lines
380 B
Go

//
// 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
}
mnemonic, err := bip39.NewMnemonic(entropySeed)
if err != nil {
return "", err
}
return mnemonic, nil
}