Documentation ¶
Index ¶
- Constants
- func CreateMnemonic(bitSize int) (string, error)
- func PublicKeyForPrivateKey(key []byte) []byte
- type BipKey
- type KeyManager
- func (km *KeyManager) GetAccountKey(purpose, coinType, account uint32) (*bip32.Key, error)
- func (km *KeyManager) GetChangeKey(purpose, coinType, account, change uint32) (*bip32.Key, error)
- func (km *KeyManager) GetCoinTypeKey(purpose, coinType uint32) (*bip32.Key, error)
- func (km *KeyManager) GetKey(purpose, coinType, account, change, index uint32) (*BipKey, error)
- func (km *KeyManager) GetMasterKey() (*bip32.Key, error)
- func (km *KeyManager) GetMnemonic() string
- func (km *KeyManager) GetPassphrase() string
- func (km *KeyManager) GetPurposeKey(purpose uint32) (*bip32.Key, error)
- func (km *KeyManager) GetSeed() []byte
Constants ¶
View Source
const ( Zero uint32 = 0 ZeroQuote uint32 = 0x80000000 PurposeBIP44 uint32 = 0x8000002C // 44' BIP44 PurposeBIP49 uint32 = 0x80000031 // 49' BIP49 PurposeBIP84 uint32 = 0x80000054 // 84' BIP84 Apostrophe uint32 = 0x80000000 CoinType uint32 = 98055361 )
View Source
const PublicKeyCompressedLength = 33
Variables ¶
This section is empty.
Functions ¶
func CreateMnemonic ¶
func PublicKeyForPrivateKey ¶
PublicKeyForPrivateKey 私钥转公钥
Types ¶
type BipKey ¶
type BipKey struct { Bip32Key *bip32.Key // contains filtered or unexported fields }
func (*BipKey) CreateAddr ¶
func (k *BipKey) CreateAddr(AddrPre string) (crypto.AddressCoin, ed25519.PublicKey, ed25519.PrivateKey)
CreateAddr 通过助记词推导出私钥,再通过私钥生成地址
type KeyManager ¶
type KeyManager struct {
// contains filtered or unexported fields
}
func GeneratePrivate ¶
func GeneratePrivate(Seeds []byte, pwd []byte, Salt []byte, MnemonicLang []string) (*KeyManager, error)
GeneratePrivate 根据原始seed推导私钥 123 1234
func NewKeyManager ¶
func NewKeyManager(mnemonic string, passphrase string) (*KeyManager, error)
func (*KeyManager) GetAccountKey ¶
func (km *KeyManager) GetAccountKey(purpose, coinType, account uint32) (*bip32.Key, error)
GetAccountKey 根据account获取key
func (*KeyManager) GetChangeKey ¶
func (km *KeyManager) GetChangeKey(purpose, coinType, account, change uint32) (*bip32.Key, error)
GetChangeKey 获取指定路径的bip32.key
func (*KeyManager) GetCoinTypeKey ¶
func (km *KeyManager) GetCoinTypeKey(purpose, coinType uint32) (*bip32.Key, error)
GetCoinTypeKey 根据不同币种获取key
func (*KeyManager) GetKey ¶
func (km *KeyManager) GetKey(purpose, coinType, account, change, index uint32) (*BipKey, error)
GetKey KeyManager 兼容一下批量创建的时候
func (*KeyManager) GetMasterKey ¶
func (km *KeyManager) GetMasterKey() (*bip32.Key, error)
GetMasterKey 找根key
func (*KeyManager) GetPassphrase ¶
func (km *KeyManager) GetPassphrase() string
GetPassphrase 构造助记词密码返回
func (*KeyManager) GetPurposeKey ¶
func (km *KeyManager) GetPurposeKey(purpose uint32) (*bip32.Key, error)
GetPurposeKey 根据协议获取key
Click to show internal directories.
Click to hide internal directories.