Documentation ¶
Index ¶
- func GenerateHash(data ...[]byte) []byte
- func Initialize(c Crypto)
- func IsKSAccountUnlocked(addr common.Address) bool
- func SigToAddress(hash, sig []byte) ([]byte, error)
- func SigToVRS(sig []byte) (v byte, r []byte, s []byte)
- func Sign(hash []byte, signer common.Address) ([]byte, error)
- func SignTx(a common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func UnlockKSAccount(acc accounts.Account, passphrase string) error
- func VRSToSig(v byte, r, s []byte) ([]byte, error)
- func ValidateSignatureValues(v byte, r, s []byte) bool
- type Crypto
- type EthCrypto
- func (c EthCrypto) GenerateHash(data ...[]byte) []byte
- func (c EthCrypto) SigToAddress(hashPre, sig []byte) ([]byte, error)
- func (c EthCrypto) SigToVRS(sig []byte) (v byte, r []byte, s []byte)
- func (c EthCrypto) VRSToSig(v byte, r, s []byte) (sig []byte, err error)
- func (c EthCrypto) ValidateSignatureValues(v byte, r, s []byte) bool
- type EthKSCrypto
- func (c EthKSCrypto) IsUnlocked(addr common.Address) bool
- func (c EthKSCrypto) Sign(hashPre []byte, signerAddr common.Address) ([]byte, error)
- func (c EthKSCrypto) SignTx(addr common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (c EthKSCrypto) UnlockAccount(acc accounts.Account, passphrase string) error
- type EthPrivateKeyCrypto
- func (c EthPrivateKeyCrypto) Address() common.Address
- func (h *EthPrivateKeyCrypto) MarshalText() ([]byte, error)
- func (c EthPrivateKeyCrypto) Sign(hashPre []byte, signerAddr common.Address) ([]byte, error)
- func (c EthPrivateKeyCrypto) SignTx(addr common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
- func (h *EthPrivateKeyCrypto) UnmarshalText(input []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateHash ¶
func Initialize ¶
func Initialize(c Crypto)
func IsKSAccountUnlocked ¶
func SigToAddress ¶
func SignTx ¶
func SignTx(a common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
func ValidateSignatureValues ¶
Types ¶
type Crypto ¶
type Crypto interface { //签名验证 ValidateSignatureValues(v byte, r, s []byte) bool //生成hash GenerateHash(data ...[]byte) []byte //签名 Sign(hash []byte, signer common.Address) ([]byte, error) //签名恢复到地址 SigToAddress(hash, sig []byte) ([]byte, error) //生成sig VRSToSig(v byte, r, s []byte) ([]byte, error) SigToVRS(sig []byte) (v byte, r []byte, s []byte) SignTx(a common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) }
type EthCrypto ¶
type EthCrypto struct {
// contains filtered or unexported fields
}
func (EthCrypto) SigToAddress ¶
签名回复到地址
type EthKSCrypto ¶
type EthKSCrypto struct { EthCrypto // contains filtered or unexported fields }
func NewKSCrypto ¶
func NewKSCrypto(homestead bool, ks *keystore.KeyStore) EthKSCrypto
func (EthKSCrypto) IsUnlocked ¶
func (c EthKSCrypto) IsUnlocked(addr common.Address) bool
func (EthKSCrypto) SignTx ¶
func (c EthKSCrypto) SignTx(addr common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
func (EthKSCrypto) UnlockAccount ¶
func (c EthKSCrypto) UnlockAccount(acc accounts.Account, passphrase string) error
type EthPrivateKeyCrypto ¶
type EthPrivateKeyCrypto struct { EthCrypto // contains filtered or unexported fields }
func NewPrivateKeyCrypto ¶
func NewPrivateKeyCrypto(homestead bool, privateKeyHex string) (EthPrivateKeyCrypto, error)
func (EthPrivateKeyCrypto) Address ¶
func (c EthPrivateKeyCrypto) Address() common.Address
func (*EthPrivateKeyCrypto) MarshalText ¶
func (h *EthPrivateKeyCrypto) MarshalText() ([]byte, error)
func (EthPrivateKeyCrypto) SignTx ¶
func (c EthPrivateKeyCrypto) SignTx(addr common.Address, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
func (*EthPrivateKeyCrypto) UnmarshalText ¶
func (h *EthPrivateKeyCrypto) UnmarshalText(input []byte) error
Click to show internal directories.
Click to hide internal directories.