sialedger

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: MIT Imports: 7 Imported by: 1

README

sialedger

GoDoc Go Report Card

go get lukechampine.com/sialedger

Go interface to the Sia Ledger Nano S app.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrCode

type ErrCode uint16

An ErrCode is returned by the various Sia app commands. The special code 0x9000 ("success") is converted to nil.

func (ErrCode) Error

func (c ErrCode) Error() string

type NanoS

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

NanoS represents a connected Nano S device.

func OpenNanoS

func OpenNanoS() (*NanoS, error)

OpenNanoS detects and connects to a Nano S device.

func (*NanoS) CalcTxnHash

func (n *NanoS) CalcTxnHash(txn types.Transaction, sigIndex uint16) (hash [32]byte, err error)

CalcTxnHash executes the calcTxnHash command, prompting the user to review the supplied transaction. If approved, the sighash for the specified transaction signature is displayed on the screen and returned.

func (*NanoS) Exchange

func (n *NanoS) Exchange(cmd byte, p1, p2 byte, data []byte) (resp []byte, err error)

Exchange exchanges an arbitrary command with the Nano S.

func (*NanoS) GetAddress

func (n *NanoS) GetAddress(index uint32, displayPubKey bool) (addr types.UnlockHash, spk types.SiaPublicKey, err error)

GetAddress executes the getPublicKey command, prompting the user to approve the generation of the specified address and public key. If approved, the address (or public key) is displayed on the device and returned.

func (*NanoS) GetVersion

func (n *NanoS) GetVersion() (version string, err error)

GetVersion executes the getVersion command, returning the version of the Sia app running on the Nano S.

func (*NanoS) SignHash

func (n *NanoS) SignHash(hash [32]byte, keyIndex uint32) (sig [64]byte, err error)

SignHash executes the signHash command, prompting the user to sign the supplied hash with the specified key. If approved, the signature is returned.

func (*NanoS) SignTxn

func (n *NanoS) SignTxn(txn types.Transaction, sigIndex uint16, keyIndex uint32) (sig [64]byte, err error)

SignTxn executes the calcTxnHash command with the SignHash flag, prompting the user to review and sign the supplied transaction. If approved, the specified sighash is signed and returned.

Jump to

Keyboard shortcuts

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