keychain

package
v1.10.19-legacy-upgrad... Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package keychain is a generated GoMock package.

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")
)

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(l Ledger, numToDerive int) (Keychain, error)

NewLedgerKeychain creates a new Ledger with [numToDerive] addresses.

func NewLedgerKeychainFromIndices added in v1.9.3

func NewLedgerKeychainFromIndices(l Ledger, indices []uint32) (Keychain, error)

NewLedgerKeychainFromIndices creates a new Ledger with addresses taken from the given [indices].

type Ledger added in v1.9.6

type Ledger interface {
	Version() (v *version.Semantic, err error)
	Address(displayHRP string, addressIndex uint32) (ids.ShortID, error)
	Addresses(addressIndices []uint32) ([]ids.ShortID, error)
	SignHash(hash []byte, addressIndices []uint32) ([][]byte, error)
	Sign(unsignedTxBytes []byte, addressIndices []uint32) ([][]byte, error)
	Disconnect() error
}

Ledger interface for the ledger wrapper

type MockLedger added in v1.9.6

type MockLedger struct {
	// contains filtered or unexported fields
}

MockLedger is a mock of Ledger interface.

func NewMockLedger added in v1.9.6

func NewMockLedger(ctrl *gomock.Controller) *MockLedger

NewMockLedger creates a new mock instance.

func (*MockLedger) Address added in v1.9.6

func (m *MockLedger) Address(arg0 string, arg1 uint32) (ids.ShortID, error)

Address mocks base method.

func (*MockLedger) Addresses added in v1.9.6

func (m *MockLedger) Addresses(arg0 []uint32) ([]ids.ShortID, error)

Addresses mocks base method.

func (*MockLedger) Disconnect added in v1.9.6

func (m *MockLedger) Disconnect() error

Disconnect mocks base method.

func (*MockLedger) EXPECT added in v1.9.6

func (m *MockLedger) EXPECT() *MockLedgerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLedger) Sign added in v1.9.11

func (m *MockLedger) Sign(arg0 []byte, arg1 []uint32) ([][]byte, error)

Sign mocks base method.

func (*MockLedger) SignHash added in v1.9.6

func (m *MockLedger) SignHash(arg0 []byte, arg1 []uint32) ([][]byte, error)

SignHash mocks base method.

func (*MockLedger) Version added in v1.9.6

func (m *MockLedger) Version() (*version.Semantic, error)

Version mocks base method.

type MockLedgerMockRecorder added in v1.9.6

type MockLedgerMockRecorder struct {
	// contains filtered or unexported fields
}

MockLedgerMockRecorder is the mock recorder for MockLedger.

func (*MockLedgerMockRecorder) Address added in v1.9.6

func (mr *MockLedgerMockRecorder) Address(arg0, arg1 any) *gomock.Call

Address indicates an expected call of Address.

func (*MockLedgerMockRecorder) Addresses added in v1.9.6

func (mr *MockLedgerMockRecorder) Addresses(arg0 any) *gomock.Call

Addresses indicates an expected call of Addresses.

func (*MockLedgerMockRecorder) Disconnect added in v1.9.6

func (mr *MockLedgerMockRecorder) Disconnect() *gomock.Call

Disconnect indicates an expected call of Disconnect.

func (*MockLedgerMockRecorder) Sign added in v1.9.11

func (mr *MockLedgerMockRecorder) Sign(arg0, arg1 any) *gomock.Call

Sign indicates an expected call of Sign.

func (*MockLedgerMockRecorder) SignHash added in v1.9.6

func (mr *MockLedgerMockRecorder) SignHash(arg0, arg1 any) *gomock.Call

SignHash indicates an expected call of SignHash.

func (*MockLedgerMockRecorder) Version added in v1.9.6

func (mr *MockLedgerMockRecorder) Version() *gomock.Call

Version indicates an expected call of Version.

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