ledger_filecoin_go

package module
v0.9.1-0...-c3dcc1b Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

ledger-filecoin-go

CircleCI

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

Documentation

Index

Constants

View Source
const (
	CLA = 0x06

	INSGetVersion       = 0
	INSGetAddrSECP256K1 = 1
	INSSignSECP256K1    = 2
)
View Source
const (
	PayloadChunkInit = 0
	PayloadChunkAdd  = 1
	PayloadChunkLast = 2
)
View Source
const HardenCount int = 2

Variables

This section is empty.

Functions

func CheckVersion

func CheckVersion(ver VersionInfo, req VersionInfo) error

CheckVersion compares the current version with the required version

func GetBip44bytes

func GetBip44bytes(bip44Path []uint32, hardenCount int) ([]byte, error)

func ListFilecoinDevices

func ListFilecoinDevices(path []uint32)

Displays existing Ledger Filecoin apps by address

func NewVersionRequiredError

func NewVersionRequiredError(req VersionInfo, ver VersionInfo) error

Types

type LedgerFilecoin

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

LedgerFilecoin represents a connection to the Ledger app

func ConnectLedgerFilecoinApp

func ConnectLedgerFilecoinApp(seekingAddress string, path []uint32) (*LedgerFilecoin, error)

ConnectLedgerFilecoinApp connects to Filecoin app based on address

func FindLedgerFilecoinApp

func FindLedgerFilecoinApp() (*LedgerFilecoin, error)

FindLedgerFilecoinApp finds the Filecoin app running in a Ledger device

func (*LedgerFilecoin) CheckVersion

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

VersionIsSupported returns true if the App version is supported by this library

func (*LedgerFilecoin) Close

func (ledger *LedgerFilecoin) Close() error

Close closes a connection with the Filecoin user app

func (*LedgerFilecoin) GetAddressPubKeySECP256K1

func (ledger *LedgerFilecoin) GetAddressPubKeySECP256K1(bip44Path []uint32) (pubkey []byte, addrByte []byte, addrString string, err error)

GetAddressPubKeySECP256K1 returns the pubkey and addresses this command does not require user confirmation

func (*LedgerFilecoin) GetBip44bytes

func (ledger *LedgerFilecoin) GetBip44bytes(bip44Path []uint32, hardenCount int) ([]byte, error)

func (*LedgerFilecoin) GetPublicKeySECP256K1

func (ledger *LedgerFilecoin) GetPublicKeySECP256K1(bip44Path []uint32) ([]byte, error)

GetPublicKeySECP256K1 retrieves the public key for the corresponding bip44 derivation path this command DOES NOT require user confirmation in the device

func (*LedgerFilecoin) GetVersion

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

GetVersion returns the current version of the Filecoin user app

func (*LedgerFilecoin) ShowAddressPubKeySECP256K1

func (ledger *LedgerFilecoin) ShowAddressPubKeySECP256K1(bip44Path []uint32) (pubkey []byte, addrByte []byte, addrString string, err error)

ShowAddressPubKeySECP256K1 returns the pubkey (compressed) and addresses this command requires user confirmation in the device

func (*LedgerFilecoin) SignSECP256K1

func (ledger *LedgerFilecoin) SignSECP256K1(bip44Path []uint32, transaction []byte) (*SignatureAnswer, error)

SignSECP256K1 signs a transaction using Filecoin user app this command requires user confirmation in the device

type SignatureAnswer

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

func (*SignatureAnswer) SignatureBytes

func (sa *SignatureAnswer) SignatureBytes() []byte

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