keystore

package
v0.0.0-...-3fa05c8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

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) (*secp256k1.PrivateKey, error)

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

func NewKeys

func NewKeys(u User, numKeys int) ([]*secp256k1.PrivateKey, 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 ...*secp256k1.PrivateKey) error

	// GetKey returns the private key that controls the given address
	GetKey(address ids.ShortID) (*secp256k1.PrivateKey, 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