wallet

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecoverAddressFromSignature

func RecoverAddressFromSignature(sig, rawContent []byte) (types.Address, error)

RecoverAddressFromSignature calculates keccak256 hash of provided rawContent and recovers signer address from given signature and hash

Types

type Account

type Account struct {
	Ecdsa *wallet.Key
	Bls   *bls.PrivateKey
}

Account is an account for key signatures

func GenerateAccount

func GenerateAccount() (*Account, error)

GenerateAccount generates a new random account

func NewAccountFromSecret

func NewAccountFromSecret(secretsManager secrets.SecretsManager) (*Account, error)

NewAccountFromSecret creates new account by using provided secretsManager

func (*Account) GetEcdsaPrivateKey

func (a *Account) GetEcdsaPrivateKey() (*ecdsa.PrivateKey, error)

func (*Account) Save

func (a *Account) Save(secretsManager secrets.SecretsManager) (err error)

Save persists ECDSA and BLS private keys to the SecretsManager

type ECDSASigner

type ECDSASigner struct {
	*Key
}

ECDSASigner implements ethgo.Key interface and it is used for signing using provided ECDSA key

func NewEcdsaSigner

func NewEcdsaSigner(ecdsaKey *Key) *ECDSASigner

func (*ECDSASigner) Sign

func (k *ECDSASigner) Sign(b []byte) ([]byte, error)

type Key

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

func NewKey

func NewKey(raw *Account) *Key

func (*Key) Address

func (k *Key) Address() ethgo.Address

Address returns ECDSA address

func (*Key) Sign

func (k *Key) Sign(digest []byte) ([]byte, error)

Sign signs the provided digest with BLS key Used only to sign transactions

func (*Key) SignIBFTMessage

func (k *Key) SignIBFTMessage(msg *proto.Message) (*proto.Message, error)

SignIBFTMessage signs the IBFT consensus message with ECDSA key

func (*Key) SignWithDomain

func (k *Key) SignWithDomain(digest, domain []byte) ([]byte, error)

SignWithDomain signs the provided digest with BLS key and provided domain

func (*Key) String

func (k *Key) String() string

String returns hex encoded ECDSA address

Jump to

Keyboard shortcuts

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