github.com/cosmos/cosmos-sdk@v0.50.1/crypto/keyring/types.go (about) 1 package keyring 2 3 import ( 4 "github.com/cosmos/cosmos-sdk/crypto/hd" 5 cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" 6 ) 7 8 // Language is a language to create the BIP 39 mnemonic in. 9 // Currently, only english is supported though. 10 // Find a list of all supported languages in the BIP 39 spec (word lists). 11 type Language int 12 13 const ( 14 // English is the default language to create a mnemonic. 15 // It is the only supported language by this package. 16 English Language = iota + 1 17 // Japanese is currently not supported. 18 Japanese 19 // Korean is currently not supported. 20 Korean 21 // Spanish is currently not supported. 22 Spanish 23 // ChineseSimplified is currently not supported. 24 ChineseSimplified 25 // ChineseTraditional is currently not supported. 26 ChineseTraditional 27 // French is currently not supported. 28 French 29 // Italian is currently not supported. 30 Italian 31 ) 32 33 const ( 34 // DefaultBIP39Passphrase used for deriving seed from mnemonic 35 DefaultBIP39Passphrase = "" 36 37 // bits of entropy to draw when creating a mnemonic 38 defaultEntropySize = 256 39 addressSuffix = "address" 40 infoSuffix = "info" 41 ) 42 43 // KeyType reflects a human-readable type for key listing. 44 type KeyType uint 45 46 // Info KeyTypes 47 const ( 48 TypeLocal KeyType = 0 49 TypeLedger KeyType = 1 50 TypeOffline KeyType = 2 51 TypeMulti KeyType = 3 52 ) 53 54 var keyTypes = map[KeyType]string{ 55 TypeLocal: "local", 56 TypeLedger: "ledger", 57 TypeOffline: "offline", 58 TypeMulti: "multi", 59 } 60 61 // String implements the stringer interface for KeyType. 62 func (kt KeyType) String() string { 63 return keyTypes[kt] 64 } 65 66 type ( 67 // DeriveKeyFunc defines the function to derive a new key from a seed and hd path 68 DeriveKeyFunc func(mnemonic, bip39Passphrase, hdPath string, algo hd.PubKeyType) ([]byte, error) 69 // PrivKeyGenFunc defines the function to convert derived key bytes to a tendermint private key 70 PrivKeyGenFunc func(bz []byte, algo hd.PubKeyType) (cryptotypes.PrivKey, error) 71 )