ethkey

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 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

View Source
var NewSigner = func() ethereum.Signer {
	return geth.NewSigner(nil)
}

NewSigner points to a function which creates a new Ethereum signer used to verify signatures.

Functions

func AddressToPeerID

func AddressToPeerID(addr ethereum.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 ethereum.Signer) crypto.PrivKey

func NewPubKey

func NewPubKey(address ethereum.Address) crypto.PubKey

func PeerIDToAddress

func PeerIDToAddress(id peer.ID) ethereum.Address

func UnmarshalEthPrivateKey

func UnmarshalEthPrivateKey(data []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