-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(go-client): use ethsecp256k1 instead of cosmos'
This fixes the derivation of a seed phrase into a private key. It also makes the derivation path non-configurable, since it only makes sense when used with the Ethereum derivation path.
- Loading branch information
Showing
2 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package client | ||
|
||
import ( | ||
"encoding/base64" | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestNewIdentityFromSeed(t *testing.T) { | ||
seed := "exclude try nephew main caught favorite tone degree lottery device tissue tent ugly mouse pelican gasp lava flush pen river noise remind balcony emerge" | ||
|
||
id, err := NewIdentityFromSeed(seed) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
fmt.Printf("address: %s\n", id.Address.String()) | ||
fmt.Printf("private key: %s\n", base64.StdEncoding.EncodeToString(id.PrivKey.Bytes())) | ||
|
||
if id.Address.String() != "warden1d652c9nngq5cneak2whyaqa4g9ehr8pstxj0r5" { | ||
t.Fatalf("unexpected address: %s", id.Address.String()) | ||
} | ||
} |