forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cherry pick 2ea9cf4 * move sm2 from tendermint to sdk * fix bug * register sm2 * fix bug * fix test error * fix bug * fix bug * cherry-pick from cosmos#7817 * update tendermint version Co-authored-by: chengwenxi <vincent.ch.cn@gmail.com>
- Loading branch information
1 parent
5903586
commit d65ec00
Showing
32 changed files
with
1,109 additions
and
165 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
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
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
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
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,22 @@ | ||
package keys | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/tendermint/tendermint/crypto" | ||
tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" | ||
tmsm2 "github.com/tendermint/tendermint/crypto/sm2" | ||
|
||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" | ||
"github.com/cosmos/cosmos-sdk/crypto/keys/sm2" | ||
) | ||
|
||
func FromTmPubKey(pubkey crypto.PubKey) (crypto.PubKey, error) { | ||
switch pubkey.(type) { | ||
case tmed25519.PubKey: | ||
return &ed25519.PubKey{Key: pubkey.Bytes()}, nil | ||
case tmsm2.PubKeySm2: | ||
return &sm2.PubKey{Key: pubkey.Bytes()}, nil | ||
} | ||
return nil, fmt.Errorf("not support pubkey type: %s", pubkey.Type()) | ||
} |
Oops, something went wrong.