personal

package
v0.79.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: MPL-2.0 Imports: 15 Imported by: 14

README

personal

This package contains Status integraton with personal_* RPC APIs more information on these APIs can be found on the Ethereum Wiki: https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal

In web3.js these methods are located in web3.personal namespace.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidPersonalSignAccount is returned when the account passed to
	// personal_sign isn't equal to the currently selected account.
	ErrInvalidPersonalSignAccount = errors.New("invalid account as only the selected one can generate a signature")
)

Functions

This section is empty.

Types

type PublicAPI

type PublicAPI struct {
	// contains filtered or unexported fields
}

PublicAPI represents a set of APIs from the `web3.personal` namespace.

func NewAPI

func NewAPI() *PublicAPI

NewAPI creates an instance of the personal API.

func (*PublicAPI) Recover

func (api *PublicAPI) Recover(rpcParams RecoverParams) (addr types.Address, err error)

Recover is an implementation of `personal_ecRecover` or `web3.personal.ecRecover` API

func (*PublicAPI) SetRPC

func (api *PublicAPI) SetRPC(rpcClient *rpc.Client, timeout time.Duration)

SetRPC sets RPC params (client and timeout) for the API calls.

func (*PublicAPI) Sign

func (api *PublicAPI) Sign(rpcParams SignParams, verifiedAccount *account.SelectedExtKey) (result types.HexBytes, err error)

Sign is an implementation of `personal_sign` or `web3.personal.sign` API

type RecoverParams added in v0.11.0

type RecoverParams struct {
	Message   string `json:"message"`
	Signature string `json:"signature"`
}

RecoverParams are for calling `personal_ecRecover`

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service represents out own implementation of personal sign operations.

func New

func New(am *accounts.Manager) *Service

New returns a new Service.

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs returns a list of new APIs.

func (*Service) Protocols

func (s *Service) Protocols() []p2p.Protocol

Protocols returns a new protocols list. In this case, there are none.

func (*Service) Start

func (s *Service) Start(server *p2p.Server) error

Start is run when a service is started. It does nothing in this case but is required by `node.Service` interface.

func (*Service) Stop

func (s *Service) Stop() error

Stop is run when a service is stopped. It does nothing in this case but is required by `node.Service` interface.

type SignParams added in v0.11.0

type SignParams struct {
	Data     interface{} `json:"data"`
	Address  string      `json:"account"`
	Password string      `json:"password"`
}

SignParams required to sign messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL