prysm-pulse/validator/keymanager/derived/mnemonic_test.go
Raul Jordan a81c863ddb
Rename Accounts-V2 to Accounts (#7545)
* rename accounts v2

* rename keymanager and fix imports

* rename accounts-v2 instances

* imports

* build

* build fix

* deepsource

* fix up broken aliases

* imports

* gaz

* Update validator/accounts/accounts_import_test.go

Co-authored-by: Ivan Martinez <ivanthegreatdev@gmail.com>

* fmt

Co-authored-by: Ivan Martinez <ivanthegreatdev@gmail.com>
2020-10-15 22:31:52 +00:00

21 lines
557 B
Go

package derived
import (
"testing"
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
"github.com/prysmaticlabs/prysm/shared/testutil/require"
"github.com/tyler-smith/go-bip39"
)
func TestMnemonic_Generate_CanRecover(t *testing.T) {
generator := &EnglishMnemonicGenerator{}
data := make([]byte, 32)
copy(data, "hello-world")
phrase, err := generator.Generate(data)
require.NoError(t, err)
entropy, err := bip39.EntropyFromMnemonic(phrase)
require.NoError(t, err)
assert.DeepEqual(t, data, entropy, "Expected to recover original data")
}