keys

package
v0.0.0-...-21d70e9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	PublicKey    crypto.PublicKey `json:"pubkey"`
	PrivKeyArmor string           `json:"privkey.armor"`
}

KeyPair is the public information about a locally stored key

func NewKeyPair

func NewKeyPair(pub crypto.PublicKey, privArmor string) KeyPair

NewKeyPair with the given public key and priv armor key

func (KeyPair) GetAddress

func (kp KeyPair) GetAddress() types.Address

GetAddress for the given KeyPair

type Keybase

type Keybase interface {
	// CRUD on the keystore
	List() ([]KeyPair, error)
	Get(address types.Address) (KeyPair, error)
	Delete(address types.Address, passphrase string) error
	UnsafeDelete(address types.Address) error
	Update(address types.Address, oldpass string, newpass string) error
	GetCoinbase() (KeyPair, error)
	SetCoinbase(address types.Address) error
	// Sign some bytes, looking up the private key to use
	Sign(address types.Address, passphrase string, msg []byte) ([]byte, crypto.PublicKey, error)

	// Create a new KeyPair and encrypt it to disk using encryptPassphrase
	Create(encryptPassphrase string) (KeyPair, error)

	// ImportPrivKey using Armored private key string. Decrypts armor with decryptPassphrase, and stores locally using encryptPassphrase
	ImportPrivKey(armor, decryptPassphrase, encryptPassphrase string) (KeyPair, error)

	// ExportPrivKeyArmor using Armored private key string. Decrypts armor with decryptPassphrase, and encrypts result armor using the encryptPassphrase
	ExportPrivKeyEncryptedArmor(address types.Address, decryptPassphrase, encryptPassphrase, hint string) (armor string, err error)

	// ImportPrivateKeyObject using the raw unencrypted privateKey string and encrypts it to disk using encryptPassphrase
	ImportPrivateKeyObject(privateKey [64]byte, encryptPassphrase string) (KeyPair, error)

	// ExportPrivateKeyObject exports raw PrivKey object.
	ExportPrivateKeyObject(address types.Address, passphrase string) (crypto.PrivateKey, error)

	// CloseDB closes the database.
	CloseDB()
}

Keybase exposes operations on a generic keystore Keybase only supports Ed25519 key pairs Optimization: Merge Keybase interface with LazyKeybase and Keybase impl into a single type

func New

func New(name, dir string) Keybase

New creates a new instance of a lazy keybase.

func NewInMemory

func NewInMemory() Keybase

NewInMemory creates a transient keybase on top of in-memory storage instance useful for testing purposes and on-the-fly key generation.

type SigningAlgo

type SigningAlgo string

SigningAlgo defines an algorithm to derive key-pairs which can be used for cryptographic signing.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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