Documentation
¶
Index ¶
Constants ¶
const ( FieldPath = "path" FieldPassword = "password" )
const ( FieldAddress = "address" FieldURL = "url" )
Variables ¶
var (
ErrUnknownSignerMethod = fmt.Errorf("unknown signer method")
)
Functions ¶
func NewLocalConfig ¶
func NewLocalConfig(cfg SignerConfig) (types.KeystoreFileConfig, error)
NewLocalConfig creates a KeystoreFileConfig (specific config) from a SignerConfig
Types ¶
type LocalSign ¶
type LocalSign struct {
// contains filtered or unexported fields
}
LocalSign is a signer that uses a local keystore file
func NewLocalSign ¶
func NewLocalSign(name string, logger commontypes.Logger, file types.KeystoreFileConfig) *LocalSign
NewLocalSign creates a new LocalSign based on config
func NewLocalSignFromPrivateKey ¶
func NewLocalSignFromPrivateKey(name string, logger commontypes.Logger, privateKey *ecdsa.PrivateKey) *LocalSign
NewLocalSignFromPrivateKey creates a new LocalSign based on a private key
func (*LocalSign) Initialize ¶
Initialize initializes the LocalSign, read key if needed
func (*LocalSign) PublicAddress ¶
type SignMethod ¶
type SignMethod string
var ( MethodLocal SignMethod = "local" MethodWeb3Signer SignMethod = "web3signer" )
func (SignMethod) String ¶
func (m SignMethod) String() string
type Signer ¶
type Signer interface {
// Initialize the signer
Initialize(context.Context) error
// SignHash signs the hash using the private key
SignHash(context.Context, common.Hash) ([]byte, error)
// PublicKey returns the public key of the signer
PublicAddress() common.Address
// String returns a string representation of the signer (no secrets)
String() string
}
type SignerConfig ¶
type SignerConfig struct {
// Method is the method to use to sign
Method SignMethod `jsonschema:"enum=local, enum=web3signer" mapstructure:"Method"`
// Config is the configuration for the signer (depend on Method field)
Config map[string]any `jsonschema:"omitempty" mapstructure:",remain"`
}
SignerConfig is the configuration for the Signer. It's generic because it support multiple methods of signing. In order to get yourself familiarized with t he exact parameters you must check local.go and web3signer.go Examples of valid values: { Method="Local", Path="path/to/keystore", Password="password" } { Method="Web3Signer", URL="http://localhost:9000", Address="0x1234567890abcdef" }
func NewLocalSignerConfig ¶
func NewLocalSignerConfig(path, pass string) SignerConfig
NewLocalSignerConfig creates a generic config (SignerConfig)
type Web3SignerClienter ¶
type Web3SignerConfig ¶
type Web3SignerConfig struct {
// URL is the url of the web3 signer
URL string
// Address is the address of the account to use, if not specified the first account (if only 1 exposed) will be used
Address common.Address
}
func NewWeb3SignerConfig ¶
func NewWeb3SignerConfig(cfg SignerConfig) (Web3SignerConfig, error)
type Web3SignerSign ¶
type Web3SignerSign struct {
// contains filtered or unexported fields
}
func NewWeb3SignerSign ¶
func NewWeb3SignerSign(name string, logger types.Logger, client Web3SignerClienter, address common.Address) *Web3SignerSign
func NewWeb3SignerSignFromConfig ¶
func NewWeb3SignerSignFromConfig(name string, logger types.Logger, cfg Web3SignerConfig) *Web3SignerSign
func (*Web3SignerSign) Initialize ¶
func (e *Web3SignerSign) Initialize(ctx context.Context) error
func (*Web3SignerSign) PublicAddress ¶
func (e *Web3SignerSign) PublicAddress() common.Address
func (*Web3SignerSign) String ¶
func (e *Web3SignerSign) String() string