ledger

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APDUStatusOk = 0x9000
)

Well known APDU status codes

Variables

This section is empty.

Functions

This section is empty.

Types

type APDUCommand

type APDUCommand struct {
	Cla     uint8
	Ins     uint8
	P1      uint8
	P2      uint8
	Data    []byte
	Raw     []byte
	ForceLc bool // Some applications (i.e. Tezos) might require Lc byte even if the data length is zero
}

APDUCommand represents parsed APDU (doesn't fully conform to ISO7816-4)

func (*APDUCommand) Bytes

func (a *APDUCommand) Bytes() []byte

Bytes returns packed APDU

type APDUError

type APDUError uint16

APDUError represents bare numeric APDU status code

func (APDUError) Error

func (a APDUError) Error() string

type APDUResponse

type APDUResponse struct {
	Data []byte
	SW   uint16
}

APDUResponse represents APDU response

type App

type App struct {
	Exchanger
}

App implements global commands available regardless of the running application

func (*App) GetAppVersion

func (a *App) GetAppVersion() (*Version, error)

GetAppVersion returns running app version

func (*App) QuitApp

func (a *App) QuitApp() error

QuitApp commands Ledger to close currently running application

type BluetoothSpec

type BluetoothSpec struct {
	ServiceUUID uuid.UUID
	NotifyUUID  uuid.UUID
	WriteUUID   uuid.UUID
}

BluetoothSpec represents BLE services

type DeviceInfo

type DeviceInfo struct {
	Path       string
	DeviceInfo *LedgerDeviceInfo
}

DeviceInfo contains device enumeration result

type Exchanger

type Exchanger interface {
	Exchange(req *APDUCommand) (*APDUResponse, error)
	Close() error
}

Exchanger is an interface implemented by an transport's abstract device

type LedgerDeviceInfo

type LedgerDeviceInfo struct {
	ID                 string
	ProductName        string
	ProductIDMM        uint8
	LegacyUSBProductID uint16
	USBOnly            bool
	MemorySize         int
}

LedgerDeviceInfo contains some hardcoded device information picked by the product ID https://github.com/LedgerHQ/ledgerjs/blob/master/packages/devices/src/index.js

type TCPTransport

type TCPTransport struct {
	Addr  string
	Model string
}

func (*TCPTransport) Enumerate

func (t *TCPTransport) Enumerate() ([]*DeviceInfo, error)

func (*TCPTransport) Open

func (t *TCPTransport) Open(path string) (Exchanger, error)

type Transport

type Transport interface {
	Enumerate() ([]*DeviceInfo, error)
	Open(path string) (Exchanger, error)
}

Transport represents transport backend such as USB HID or BLE

type USBHIDTransport

type USBHIDTransport struct{}

USBHIDTransport is a USB HID transport backend

func (*USBHIDTransport) Enumerate

func (u *USBHIDTransport) Enumerate() ([]*DeviceInfo, error)

Enumerate returns a list os attached Ledger devices

func (*USBHIDTransport) Open

func (u *USBHIDTransport) Open(path string) (Exchanger, error)

Open returns a new Exchanger

type Version

type Version struct {
	Name    string
	Version string
	Flags   int
}

Version contains application version info

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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