ethkey

package
v0.0.0-...-6378e9d Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const KeyTypeID cryptoPB.KeyType = 10

KeyTypeID uses the Ethereum keys to sign and verify messages.

Variables

This section is empty.

Functions

func AddressToPeerID

func AddressToPeerID(addr types.Address) peer.ID

AddressToPeerID converts an Ethereum address to a peer ID. If address is invalid then empty ID will be returned.

func HexAddressToPeerID

func HexAddressToPeerID(a string) peer.ID

HexAddressToPeerID converts an Ethereum address given as hex string to a peer ID. If address is invalid then empty ID will be returned.

func NewPrivKey

func NewPrivKey(signer wallet.Key) crypto.PrivKey

func NewPubKey

func NewPubKey(address types.Address) crypto.PubKey

func PeerIDToAddress

func PeerIDToAddress(id peer.ID) types.Address

func UnmarshalEthPrivateKey

func UnmarshalEthPrivateKey(_ []byte) (crypto.PrivKey, error)

UnmarshalEthPrivateKey should return private key from input bytes, but this not supported for ethereum keys.

func UnmarshalEthPublicKey

func UnmarshalEthPublicKey(data []byte) (crypto.PubKey, error)

UnmarshalEthPublicKey returns a public key from input bytes.

Types

type PrivKey

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

func (*PrivKey) Bytes

func (p *PrivKey) Bytes() ([]byte, error)

Bytes implements the crypto.Key interface.

func (*PrivKey) Equals

func (p *PrivKey) Equals(key crypto.Key) bool

Equals implements the crypto.Key interface.

func (*PrivKey) GetPublic

func (p *PrivKey) GetPublic() crypto.PubKey

GetPublic implements the crypto.PrivateKey interface.

func (*PrivKey) Raw

func (p *PrivKey) Raw() ([]byte, error)

Raw implements the crypto.Key interface.

func (*PrivKey) Sign

func (p *PrivKey) Sign(bytes []byte) ([]byte, error)

Sign implements the crypto.PrivateKey interface.

func (*PrivKey) Type

func (p *PrivKey) Type() cryptoPB.KeyType

Type implements the crypto.Key interface.

type PubKey

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

func (*PubKey) Bytes

func (p *PubKey) Bytes() ([]byte, error)

Bytes implements the crypto.Key interface.

func (*PubKey) Equals

func (p *PubKey) Equals(key crypto.Key) bool

Equals implements the crypto.Key interface.

func (*PubKey) Raw

func (p *PubKey) Raw() ([]byte, error)

Raw implements the crypto.Key interface.

func (*PubKey) Type

func (p *PubKey) Type() cryptoPB.KeyType

Type implements the crypto.Key interface.

func (*PubKey) Verify

func (p *PubKey) Verify(data []byte, sig []byte) (bool, error)

Verify implements the crypto.PubKey interface.

Jump to

Keyboard shortcuts

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