README
¶
ledger-goclient
This project is work in progress. Some aspects are subject to change.
Get source
Apart from cloning, be sure you install dep dependency management tool https://github.com/golang/dep
Setup
Update dependencies using the following:
dep ensure
Building
go build ledger.go
Running
./ledger
Make sure that the app is launched in the Ledger before starting this command and Ledger is connected to the USB port. This command line tool will try to send a simple json transaction and will return a signature when user agrees to sign.
Documentation
¶
Index ¶
- Constants
- func DeserializePacket(channel uint16, buffer []byte, sequenceIdx uint16, ble bool) (result []byte, totalResponseLength uint16, err error)
- func ListDevices()
- func SerializePacket(channel uint16, command []byte, packetSize int, sequenceIdx uint16, ble bool) (result []byte, offset int, err error)
- func UnwrapResponseAPDU(channel uint16, pipe <-chan []byte, packetSize int, ble bool) ([]byte, error)
- func WrapCommandAPDU(channel uint16, command []byte, packetSize int, ble bool) (result []byte, err error)
- type Device
- type Ledger
- func (ledger *Ledger) Exchange(command []byte) ([]byte, error)
- func (ledger *Ledger) GetPublicKeyED25519(bip32_path []uint32) ([]byte, error)
- func (ledger *Ledger) GetPublicKeySECP256K1(bip32_path []uint32) ([]byte, error)
- func (ledger *Ledger) GetVersion() (*VersionInfo, error)
- func (ledger *Ledger) Hash(transaction []byte) ([]byte, error)
- func (ledger *Ledger) SignED25519(bip32_path []uint32, transaction []byte) ([]byte, error)
- func (ledger *Ledger) SignED25519_StdSignMsg(bip32_path []uint32, transaction []byte) ([]byte, error)
- func (ledger *Ledger) SignSECP256K1(bip32_path []uint32, transaction []byte) ([]byte, error)
- func (ledger *Ledger) SignSECP256K1_StdSignMsg(bip32_path []uint32, transaction []byte) ([]byte, error)
- func (ledger *Ledger) TestGetPublicKeyED25519() ([]byte, error)
- func (ledger *Ledger) TestGetPublicKeySECP256K1() ([]byte, error)
- func (ledger *Ledger) TestSignED25519(transaction []byte) ([]byte, error)
- func (ledger *Ledger) TestSignSECP256K1(transaction []byte) ([]byte, error)
- type VersionInfo
Constants ¶
View Source
const ( VendorLedger = 0x2c97 UsagePageLedger = 0xffa0 //ProductNano = 1 Channel = 0x0101 PacketSize = 64 CLA = 0x55 INSGetVersion = 0 INSPublicKeySECP256K1 = 1 INSPublicKeyED25519 = 2 // Sign sdk.Msg (transaction part of the message) INSSignSECP256K1 = 3 INSSignED25519 = 4 // Sign sdk.StdSignMsg (full message) INSSignSECP256K1_StdSignMsg = 5 INSSignED25519_StdSignMsg = 6 INSHash = 100 INSPublicKeySECP256K1Test = 101 INSPublicKeyED25519Test = 102 INSSignSECP256K1Test = 103 INSSignED25519Test = 104 MessageChunkSize = 250 )
Variables ¶
This section is empty.
Functions ¶
func DeserializePacket ¶
func ListDevices ¶
func ListDevices()
func SerializePacket ¶
Types ¶
type Device ¶
type Device interface { // Close closes the device and associated resources. Close() // Write writes an output report to device. The first byte must be the // report number to write, zero if the device does not use numbered reports. Write([]byte) error // ReadCh returns a channel that will be sent input reports from the device. // If the device uses numbered reports, the first byte will be the report // number. ReadCh() <-chan []byte // ReadError returns the read error, if any after the channel returned from // ReadCh has been closed. ReadError() error }
A Device provides access to a HID device.
type Ledger ¶
type Ledger struct { Logging bool // contains filtered or unexported fields }
func FindLedger ¶
func (*Ledger) GetPublicKeyED25519 ¶
func (*Ledger) GetPublicKeySECP256K1 ¶
func (*Ledger) GetVersion ¶
func (ledger *Ledger) GetVersion() (*VersionInfo, error)
func (*Ledger) SignED25519 ¶
func (*Ledger) SignED25519_StdSignMsg ¶
func (*Ledger) SignSECP256K1 ¶
func (*Ledger) SignSECP256K1_StdSignMsg ¶
func (*Ledger) TestGetPublicKeyED25519 ¶
func (*Ledger) TestGetPublicKeySECP256K1 ¶
func (*Ledger) TestSignED25519 ¶
Click to show internal directories.
Click to hide internal directories.