ledger_filecoin_go

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

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
	INSGetAddr        = 1
	INSSign           = 2
	INSSignDataCap    = 5
	INSSignClientDeal = 6
	INSSignRawBytes   = 7
)
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 CryptoCurve added in v1.0.0

type CryptoCurve uint64
const (
	SECP256K1 CryptoCurve = iota
	BLS
)

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) GetAddressPubKey added in v0.12.0

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

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

func (*LedgerFilecoin) GetAddressPubKeySECP256K1 deprecated

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

Deprecated: Use GetAddressPubKey instead.

func (*LedgerFilecoin) GetBip44bytes

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

func (*LedgerFilecoin) GetPublicKey added in v0.12.0

func (ledger *LedgerFilecoin) GetPublicKey(bip44Path []uint32, curve CryptoCurve) ([]byte, error)

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

func (*LedgerFilecoin) GetPublicKeySECP256K1 deprecated

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

Deprecated: Use GetPublicKey instead.

func (*LedgerFilecoin) GetVersion

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

GetVersion returns the current version of the Filecoin user app

func (*LedgerFilecoin) ShowAddressPubKey added in v0.12.0

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

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

func (*LedgerFilecoin) ShowAddressPubKeySECP256K1 deprecated

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

Deprecated: Use ShowAddressPubKey instead.

func (*LedgerFilecoin) Sign added in v0.12.0

func (ledger *LedgerFilecoin) Sign(bip44Path []uint32, transaction []byte, curve CryptoCurve) (*SignatureAnswer, error)

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

func (*LedgerFilecoin) SignSECP256K1 deprecated

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

Deprecated: Use Sign method instead.

type SignatureAnswer

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

func (*SignatureAnswer) SignatureBytes added in v0.11.0

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