keychain

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: BSD-3-Clause Imports: 3 Imported by: 4 modules, 20 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

Overview

Package keychain provides shared keychain interfaces and implementations for hardware wallets and software signers in the Lux ecosystem.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidIndicesLength    = errors.New("number of indices should be greater than 0")
	ErrInvalidNumAddrsToDerive = errors.New("number of addresses to derive should be greater than 0")
	ErrInvalidNumAddrsDerived  = errors.New("incorrect number of ledger derived addresses")
	ErrInvalidNumSignatures    = errors.New("incorrect number of signatures")
)
View Source
var NewLedgerKeychainFromIndices = NewLedgerKeychain

NewLedgerKeychain creates a new ledger keychain NewLedgerKeychainFromIndices is an alias for NewLedgerKeychain

Functions

This section is empty.

Types

type Keychain

type Keychain interface {
	// The returned Signer can provide a signature for [addr]
	Get(addr ids.ShortID) (Signer, bool)
	// Returns the set of addresses for which the accessor keeps an associated
	// signer
	Addresses() set.Set[ids.ShortID]
}

Keychain maintains a set of addresses together with their corresponding signers

func NewLedgerKeychain

func NewLedgerKeychain(ledger Ledger, indices []uint32) (Keychain, error)

type Ledger

type Ledger interface {
	Address(displayHRP string, addressIndex uint32) (ids.ShortID, error)
	SignHash(hash []byte, addressIndex uint32) ([]byte, error)
	Sign(hash []byte, addressIndex uint32) ([]byte, error)
	SignTransaction(rawUnsignedHash []byte, addressIndices []uint32) ([][]byte, error)
	GetAddresses(addressIndices []uint32) ([]ids.ShortID, error)
	Disconnect() error
}

Ledger interface for hardware wallet support

type Signer

type Signer interface {
	SignHash([]byte) ([]byte, error)
	Sign([]byte) ([]byte, error)
	Address() ids.ShortID
}

Signer implements functions for a keychain to return its main address and to sign a hash

Jump to

Keyboard shortcuts

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