key

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	*ecdsa.PrivateKey
	Ed25519Private  ed25519.PrivateKey
	ECIESPrivate    *ecies.PrivateKey
	EthereumAddress common.Address
}

Key is an ECDSA keypair with SECP256K1 curve which is compatible with Ethereum (ECDSA), ECIES and Ed25519 (BigchainDB, by deriving a key).

func DeriveFromPassword

func DeriveFromPassword(identity common.Hash, password string) *Key

DeriveFromPassword uses PBKDF2 with

func FromECDSA

func FromECDSA(key *ecdsa.PrivateKey) *Key

func Generate

func Generate() (*Key, error)

Generate creates new random ECDSA Key.

func Load

func Load(path string) (*Key, error)

Load loads a private key from the given file. the file must contain a 32-byte hex-encoded ECDSA private key with SECP256k1 curve.

func (*Key) Save

func (key *Key) Save(path string) error

Save saves a private key to the given file.

type Manager

type Manager interface {
	NodeKey() *Key
	EncryptData(*types.Data) (*types.EncryptedData, error)
	DecryptData(*types.EncryptedData) (*types.Data, error)
	Encrypt(string) ([]byte, error)
	Decrypt([]byte) (string, error)
	SignEthTx(*klayTypes.Transaction) (*klayTypes.Transaction, error)
}

Jump to

Keyboard shortcuts

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