keystore

package
v0.0.0-...-897bf55 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: BSD-3-Clause Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// CodecVersion is the current default codec version
	CodecVersion = 0
)

Variables

View Source
var (
	Codec       codec.Manager
	LegacyCodec codec.Manager
)

Codecs do serialization and deserialization

Functions

func GetKeychain

func GetKeychain(u User, addresses set.Set[ids.ShortID]) (*secp256k1fx.Keychain, error)

Keychain returns a new keychain from the [user]. If [addresses] is non-empty it fetches only the keys in addresses. If a key is missing, it will be ignored. If [addresses] is empty, then it will create a keychain using every address in the provided [user].

func NewKey

func NewKey(u User) (*crypto.PrivateKeySECP256K1R, error)

Create and store a new key that will be controlled by this user.

func NewKeys

func NewKeys(u User, numKeys int) ([]*crypto.PrivateKeySECP256K1R, error)

Create and store [numKeys] new keys that will be controlled by this user.

Types

type User

type User interface {
	io.Closer

	// Get the addresses controlled by this user
	GetAddresses() ([]ids.ShortID, error)

	// PutKeys persists [privKeys]
	PutKeys(privKeys ...*crypto.PrivateKeySECP256K1R) error

	// GetKey returns the private key that controls the given address
	GetKey(address ids.ShortID) (*crypto.PrivateKeySECP256K1R, error)
}

func NewUserFromDB

func NewUserFromDB(db *encdb.Database) User

NewUserFromDB tracks a keystore user from a database

func NewUserFromKeystore

func NewUserFromKeystore(ks keystore.BlockchainKeystore, username, password string) (User, error)

NewUserFromKeystore tracks a keystore user from the provided keystore

Jump to

Keyboard shortcuts

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