github.com/InjectiveLabs/sdk-go@v1.53.0/chain/crypto/keyring/options.go (about) 1 package keyring 2 3 import ( 4 "github.com/cosmos/cosmos-sdk/crypto/keyring" 5 "github.com/cosmos/cosmos-sdk/crypto/types" 6 7 cosmoshd "github.com/cosmos/cosmos-sdk/crypto/hd" 8 9 "github.com/InjectiveLabs/sdk-go/chain/crypto/ethsecp256k1" 10 "github.com/InjectiveLabs/sdk-go/chain/crypto/hd" 11 ) 12 13 // AppName defines the Ledger app used for signing. Evmos uses the Ethereum app 14 const AppName = "Ethereum" 15 16 var ( 17 // SupportedAlgorithms defines the list of signing algorithms used on Injective: 18 // - eth_secp256k1 (Ethereum) 19 // - secp256k1 (Tendermint) 20 SupportedAlgorithms = keyring.SigningAlgoList{hd.EthSecp256k1, cosmoshd.Secp256k1} 21 // SupportedAlgorithmsLedger defines the list of signing algorithms used on Evmos for the Ledger device: 22 // - secp256k1 (in order to comply with Cosmos SDK) 23 // The Ledger derivation function is responsible for all signing and address generation. 24 SupportedAlgorithmsLedger = keyring.SigningAlgoList{hd.EthSecp256k1} 25 // LedgerDerivation defines the Evmos Ledger Go derivation (Ethereum app with EIP-712 signing) 26 // LedgerDerivation = ledger.EvmosLedgerDerivation() 27 // CreatePubkey uses the ethsecp256k1 pubkey with Ethereum address generation and keccak hashing 28 CreatePubkey = func(key []byte) types.PubKey { return ðsecp256k1.PubKey{Key: key} } 29 // SkipDERConversion represents whether the signed Ledger output should skip conversion from DER to BER. 30 // This is set to true for signing performed by the Ledger Ethereum app. 31 SkipDERConversion = true 32 ) 33 34 // EthSecp256k1Option defines a function keys options for the ethereum Secp256k1 curve. 35 // It supports eth_secp256k1 keys for accounts. 36 func EthSecp256k1Option() keyring.Option { 37 return func(options *keyring.Options) { 38 options.SupportedAlgos = SupportedAlgorithms 39 options.SupportedAlgosLedger = SupportedAlgorithmsLedger 40 options.LedgerCreateKey = CreatePubkey 41 options.LedgerAppName = AppName 42 options.LedgerSigSkipDERConv = SkipDERConversion 43 } 44 }