messagesigner

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0, MIT Imports: 17 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SigningBytes added in v1.20.0

func SigningBytes(msg *types.Message, sigType address.Protocol) ([]byte, error)

Types

type MessageSigner

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

MessageSigner keeps track of nonces per address, and increments the nonce when signing a message

func NewMessageSigner

func NewMessageSigner(wallet api.Wallet, mpool messagepool.MpoolNonceAPI, ds dtypes.MetadataDS) *MessageSigner

func (*MessageSigner) GetSignedMessage added in v1.17.2

func (ms *MessageSigner) GetSignedMessage(ctx context.Context, uuid uuid.UUID) (*types.SignedMessage, error)

func (*MessageSigner) NextNonce added in v1.19.0

func (ms *MessageSigner) NextNonce(ctx context.Context, addr address.Address) (uint64, error)

NextNonce gets the next nonce for the given address. If there is no nonce in the datastore, gets the nonce from the message pool.

func (*MessageSigner) SaveNonce added in v1.19.0

func (ms *MessageSigner) SaveNonce(ctx context.Context, addr address.Address, nonce uint64) error

SaveNonce increments the nonce for this address and writes it to the datastore

func (*MessageSigner) SignMessage

func (ms *MessageSigner) SignMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, cb func(*types.SignedMessage) error) (*types.SignedMessage, error)

SignMessage increments the nonce for the message From address, and signs the message

func (*MessageSigner) StoreSignedMessage added in v1.17.2

func (ms *MessageSigner) StoreSignedMessage(ctx context.Context, uuid uuid.UUID, message *types.SignedMessage) error

type MessageSignerConsensus added in v1.19.0

type MessageSignerConsensus struct {
	MsgSigner
	Consensus *consensus.Consensus
}

func NewMessageSignerConsensus added in v1.19.0

func NewMessageSignerConsensus(
	wallet api.Wallet,
	mpool messagepool.MpoolNonceAPI,
	ds dtypes.MetadataDS,
	consensus *consensus.Consensus) *MessageSignerConsensus

func (*MessageSignerConsensus) GetRaftState added in v1.19.0

func (ms *MessageSignerConsensus) GetRaftState(ctx context.Context) (*consensus.RaftState, error)

func (*MessageSignerConsensus) GetSignedMessage added in v1.19.0

func (ms *MessageSignerConsensus) GetSignedMessage(ctx context.Context, uuid uuid.UUID) (*types.SignedMessage, error)

func (*MessageSignerConsensus) IsLeader added in v1.19.0

func (ms *MessageSignerConsensus) IsLeader(ctx context.Context) bool

func (*MessageSignerConsensus) Leader added in v1.19.0

func (ms *MessageSignerConsensus) Leader(ctx context.Context) (peer.ID, error)

func (*MessageSignerConsensus) RedirectToLeader added in v1.19.0

func (ms *MessageSignerConsensus) RedirectToLeader(ctx context.Context, method string, arg interface{}, ret interface{}) (bool, error)

func (*MessageSignerConsensus) SignMessage added in v1.19.0

type MsgSigner added in v1.19.0

type MsgSigner interface {
	SignMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, cb func(*types.SignedMessage) error) (*types.SignedMessage, error)
	GetSignedMessage(ctx context.Context, uuid uuid.UUID) (*types.SignedMessage, error)
	StoreSignedMessage(ctx context.Context, uuid uuid.UUID, message *types.SignedMessage) error
	NextNonce(ctx context.Context, addr address.Address) (uint64, error)
	SaveNonce(ctx context.Context, addr address.Address, nonce uint64) error
}

Jump to

Keyboard shortcuts

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