internal

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PathPurposeBIP44 is set to 44 to indicate the use of the BIP-0044's hierarchy:
	// https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki.
	PathPurposeBIP44 uint32 = 44
	// PathPurposeConsensus is set to 43, matching ledger's Validator
	// app.  This uses the (proposed) BIP-0043 extension that specifies
	// the purpose of non-Bitcoin uses:
	// https://github.com/bitcoin/bips/pull/523/files
	PathPurposeConsensus uint32 = 43
	// PathSubPurposeConsensus is set to 0 to indicate it is to be used for
	// consensus-related things.
	PathSubPurposeConsensus uint32 = 0

	// ListingPathCoinType is set to 474, the index registered to Oasis in the SLIP-0044 registry.
	ListingPathCoinType uint32 = 474
	// ListingPathAccount is the account index used to list and connect to Ledger devices.
	ListingPathAccount uint32 = 0
	// ListingPathChange indicates an external chain.
	ListingPathChange uint32 = 0
	// ListingPathIndex is the address index used to list and connect to Ledger devices.
	ListingPathIndex uint32 = 0
)

Variables

View Source
var (
	// ListingDerivationPath is the path used to list and connect to Ledger devices.
	ListingDerivationPath = []uint32{
		PathPurposeBIP44, ListingPathCoinType, ListingPathAccount, ListingPathChange, ListingPathIndex,
	}

	// ErrSignRequestRejected is the error returned when the user
	// explicitly rejects a signature request.
	ErrSignRequestRejected = fmt.Errorf("ledger/oasis: transaction rejected on Ledger device")
)

Functions

func GetPath added in v1.1.0

func GetPath(index uint32) []uint32

GetPath returns the BIP32 path for the given account index.

Types

type AppInfo

type AppInfo struct {
	WalletID wallet.ID
	Version  VersionInfo
}

func ListApps

func ListApps(path []uint32) []*AppInfo

ListApps returns a list of Oasis Ledger Apps that could be connected to.

type LedgerAppMode

type LedgerAppMode int
const (
	ValidatorMode LedgerAppMode = 1 + iota
	ConsumerMode
	UnknownMode
)

type LedgerOasis

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

LedgerOasis represents a connection to the Ledger app.

func ConnectApp

func ConnectApp(walletID *wallet.ID, path []uint32) (*LedgerOasis, error)

ConnectApp connects to the Oasis Ledger App with the given wallet ID.

NOTE: If wallet ID is not given and there is a single device connected to the system, it connects to this device's Oasis Ledger App.

func FindApp

func FindApp() (*LedgerOasis, error)

FindApp finds the Oasis Ledger App running on the given Ledger device.

func (*LedgerOasis) CheckVersion

func (ledger *LedgerOasis) CheckVersion(ver VersionInfo) error

CheckVersion returns nil if the App version is supported by this library.

func (*LedgerOasis) Close

func (ledger *LedgerOasis) Close() error

Close closes a connection with the Oasis user app.

func (*LedgerOasis) GetAddressPubKeyEd25519

func (ledger *LedgerOasis) GetAddressPubKeyEd25519(bip44Path []uint32) (pubkey []byte, addr string, err error)

GetAddressPubKeyEd25519 returns the pubkey and address (Bech32-encoded).

NOTE: This command DOES NOT require user confirmation on the device.

func (*LedgerOasis) GetPublicKeyEd25519

func (ledger *LedgerOasis) GetPublicKeyEd25519(bip44Path []uint32) ([]byte, error)

GetPublicKeyEd25519 retrieves the public key for the corresponding BIP44 derivation path.

NOTE: This command DOES NOT require user confirmation on the device.

func (*LedgerOasis) GetVersion

func (ledger *LedgerOasis) GetVersion() (*VersionInfo, error)

GetVersion returns the current version of the Oasis user app.

func (*LedgerOasis) ShowAddressPubKeyEd25519

func (ledger *LedgerOasis) ShowAddressPubKeyEd25519(bip44Path []uint32) (pubkey []byte, addr string, err error)

ShowAddressPubKeyEd25519 returns the pubkey (compressed) and address (Bech32-encoded).

NOTE: This command requires user confirmation on the device.

func (*LedgerOasis) SignEd25519

func (ledger *LedgerOasis) SignEd25519(bip44Path []uint32, context, transaction []byte) ([]byte, error)

SignEd25519 signs a transaction using Oasis user app

NOTE: This command requires user confirmation on the device.

type VersionInfo

type VersionInfo struct {
	AppMode uint8
	Major   uint8
	Minor   uint8
	Patch   uint8
}

VersionInfo contains app version information.

func (VersionInfo) String

func (c VersionInfo) String() string

type VersionRequiredError

type VersionRequiredError struct {
	Found    VersionInfo
	Required VersionInfo
}

VersionRequiredError the command is not supported by this app.

func (VersionRequiredError) Error

func (e VersionRequiredError) Error() string

Jump to

Keyboard shortcuts

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