Documentation ¶
Overview ¶
Package keystore implements ethereum specific key handling functionality for the node software.
It provides wrapped types and methods for using ethereum keys, keystore and signing.
Index ¶
- Variables
- func FromECDSAPub(pub *ecdsa.PublicKey) []byte
- func Keccak256(data ...[]byte) []byte
- func PubkeyToAddress(p ecdsa.PublicKey) types.Address
- func SetLogger(moduleLogger log.LoggerInterface)
- func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)
- func VerifySignature(pubkey, hash, signature []byte) bool
- type Account
- type CryptoWrapperInterface
- type EthereumCryptoWrapper
- func (wrapper EthereumCryptoWrapper) FromECDSAPub(pub *ecdsa.PublicKey) []byte
- func (wrapper EthereumCryptoWrapper) Keccak256(data ...[]byte) []byte
- func (wrapper EthereumCryptoWrapper) PubkeyToAddress(p ecdsa.PublicKey) common.Address
- func (wrapper EthereumCryptoWrapper) SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)
- func (wrapper EthereumCryptoWrapper) VerifySignature(pubkey, hash, signature []byte) bool
- type Key
- type KeyStore
Constants ¶
This section is empty.
Variables ¶
var ( StandardScryptN = ethereumKeystore.StandardScryptN StandardScryptP = ethereumKeystore.StandardScryptP )
Standard parameter values for N,P in Scrypt algorithm used for encrypting keys stored on disk.
Functions ¶
func FromECDSAPub ¶
FromECDSAPub returns the byte representation of the ecdsa public key.
func PubkeyToAddress ¶
PubkeyToAddress derives and returns the ethereum specific onchain identity from the ecdsa the public key.
func SetLogger ¶
func SetLogger(moduleLogger log.LoggerInterface)
SetLogger sets the logger instance for this module.
func VerifySignature ¶
VerifySignature checks if the given ethereum address created the ecdsa signature over hash. The signature should be of size of 65 byte (in [R | S | V] format with V = 0/1).
Types ¶
type Account ¶
Account wraps the Account type defined in go-ethereum/accounts. It consists of onchain address and url to locate the key file in the backend.
func MakeAccount ¶
MakeAccount creates and returns and ethereum account (with empty url) from ethereum onchain id.
type CryptoWrapperInterface ¶
type CryptoWrapperInterface interface { SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error) PubkeyToAddress(p ecdsa.PublicKey) common.Address FromECDSAPub(pub *ecdsa.PublicKey) []byte VerifySignature(pubkey, hash, signature []byte) bool Keccak256(data ...[]byte) []byte }
CryptoWrapperInterface defines signatures for cryptography related function that will be used to handle ethereum keys.
var CryptoWrapperInstance CryptoWrapperInterface = EthereumCryptoWrapper{}
CryptoWrapperInstance defines the crypto wrapper instance that can be used by other modules.
type EthereumCryptoWrapper ¶
type EthereumCryptoWrapper struct { }
EthereumCryptoWrapper wraps the ethereum specific crypto related functions.
func (EthereumCryptoWrapper) FromECDSAPub ¶
func (wrapper EthereumCryptoWrapper) FromECDSAPub(pub *ecdsa.PublicKey) []byte
FromECDSAPub wraps the FromECDSAPub function from ethereum/crypto package.
func (EthereumCryptoWrapper) Keccak256 ¶
func (wrapper EthereumCryptoWrapper) Keccak256(data ...[]byte) []byte
Keccak256 wraps the Keccak256 function from ethereum/crypto package.
func (EthereumCryptoWrapper) PubkeyToAddress ¶
func (wrapper EthereumCryptoWrapper) PubkeyToAddress(p ecdsa.PublicKey) common.Address
PubkeyToAddress wraps the PubkeyToAddress function from ethereum/crypto package.
func (EthereumCryptoWrapper) SigToPub ¶
func (wrapper EthereumCryptoWrapper) SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)
SigToPub wraps the SigToPub function from ethereum/crypto package.
func (EthereumCryptoWrapper) VerifySignature ¶
func (wrapper EthereumCryptoWrapper) VerifySignature(pubkey, hash, signature []byte) bool
VerifySignature wraps the VerifySignature function from ethereum/crypto package.
type Key ¶
type Key struct {
*ethereumKeystore.Key
}
Key wraps the Key type from ethereumKeystore. It stores the private key in plain text and ethereum address corresponding to it.
type KeyStore ¶
type KeyStore struct {
*ethereumKeystore.KeyStore
}
KeyStore wraps the ethereum keystore that is used to manage a keys storage directory on disk.
func NewKeyStore ¶
NewKeyStore initializes and returns an new instance of ethereum keystore.
func (*KeyStore) Find ¶
Find retrieves and returns an unique account corresponding to the ethereum address from the keystore. If no account or multiple matching accounts are found, an error is returned.