keystore

package
v1.9.8-rc.11 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: BSD-3-Clause Imports: 13 Imported by: 2

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