Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBadSignature = errors.New("bad signature")
ErrBadSignature is returned when the signature does not verify the payload.
Functions ¶
Types ¶
type AddressRequest ¶ added in v0.2.3
type AddressRequest struct { Method string Address string // Hex-encoded (e.g. public wallet or contract address) Nonce int64 ExtraArgs []interface{} }
AddressRequest represents the components of an RPC request signed by an Ethereum address.
func (AddressRequest) Sign ¶ added in v0.2.3
func (r AddressRequest) Sign(privkey *ecdsa.PrivateKey) (string, error)
Sign produces a hex-encoded signature of the request.
func (AddressRequest) SignedArgs ¶ added in v0.2.3
func (r AddressRequest) SignedArgs(privkey *ecdsa.PrivateKey) ([]interface{}, error)
SignedArgs returns a slice of arguments with the first element containing the signature for the remaining arguments. This is a convenient form factor for doing signed RPC calls.
func (AddressRequest) Verify ¶ added in v0.2.3
func (r AddressRequest) Verify(sig string) error
Verify validates this request against a base64-encoded signature (presumably produced by Request.Sign).
type NodeRequest ¶ added in v0.2.3
type NodeRequest struct { Method string NodeID string // Hex-encoded (e.g. public wallet or contract address) Nonce int64 ExtraArgs []interface{} }
NodeRequest represents the components of an RPC request signed by an Ethereum address.
func (NodeRequest) Sign ¶ added in v0.2.3
func (r NodeRequest) Sign(privkey *ecdsa.PrivateKey) (string, error)
Sign produces a base64-encoded signature of the request.
func (NodeRequest) SignedArgs ¶ added in v0.2.3
func (r NodeRequest) SignedArgs(privkey *ecdsa.PrivateKey) ([]interface{}, error)
SignedArgs returns a slice of arguments with the first element containing the signature for the remaining arguments. This is a convenient form factor for doing signed RPC calls.
func (NodeRequest) Verify ¶ added in v0.2.3
func (r NodeRequest) Verify(sig string) error
Verify validates this request against a base64-encoded signature (presumably produced by NodeRequest.Sign).