github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/mnemonic/mnemonic_test.go (about)

     1  /*
     2   * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved.
     3   * This software is released under GPL3.
     4   * The full license information can be found under:
     5   * https://www.gnu.org/licenses/gpl-3.0.en.html
     6   *
     7   */
     8  
     9  package mnemonic
    10  
    11  import (
    12  	"testing"
    13  
    14  	"github.com/ethereum/go-ethereum/crypto"
    15  	"github.com/stretchr/testify/assert"
    16  )
    17  
    18  func TestToECSDA(t *testing.T) {
    19  	privateKeyECDSA, err := ToECDSA("attend polar kite inner harvest solar answer proud best donor twenty space plunge repeat virus")
    20  	assert.NoError(t, err)
    21  	assert.NotNil(t, privateKeyECDSA)
    22  	privateKey := crypto.FromECDSA(privateKeyECDSA)
    23  
    24  	assert.Equal(
    25  		t,
    26  		[]byte{0x83, 0x9e, 0xc2, 0x6c, 0x5b, 0x76, 0xfb, 0x1b, 0xa, 0xf1, 0x3, 0xee, 0xb7, 0xeb, 0x11, 0x79, 0xc1, 0x4d, 0x9f, 0x56, 0x61, 0x9b, 0x88, 0x1d, 0xea, 0xa3, 0x8f, 0x46, 0x25, 0x8, 0xcc, 0xf9},
    27  		privateKey)
    28  }