boe

package
v0.0.0-...-d82d076 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: MIT, GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidParams     = errors.New("invalid params")
	ErrInitFailed        = errors.New("init failed")
	ErrReleaseFailed     = errors.New("release failed")
	ErrSignCheckFailed   = errors.New("recover pubkey failed")
	ErrHWSignFailed      = errors.New("hw sign failed")
	ErrUnknownEvent      = errors.New("unknown event")
	ErrIDNotMatch        = errors.New("id not match")
	ErrUpdateFailed      = errors.New("update failed")
	ErrUpdateAbortFailed = errors.New("update abort failed")
	ErrGetAccountFailed  = errors.New("get bind account failed")
	ErrSetAccountFailed  = errors.New("set bind account failed")
	ErrGetNextHashFailed = errors.New("get next hash failed")
	ErrGetSNFailed       = errors.New("get sn failed")
	ErrNoNeedUpdate      = errors.New("no need update")
	ErrHashVerifyFailed  = errors.New("verify hash failed")
	ErrHashTimeLimited   = errors.New("get hash time limited")
)

Functions

func HardwareRecoverCallback

func HardwareRecoverCallback()

func PostRecoverPubkey

func PostRecoverPubkey(boe *BoeHandle)

PostRecoverPubkey get result from hardware ecc-recover, and post the result to external module.

Types

type BoeHandle

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

func BoeGetInstance

func BoeGetInstance() *BoeHandle

func (*BoeHandle) ASyncValidateSign

func (boe *BoeHandle) ASyncValidateSign(txhash []byte, hash []byte, r []byte, s []byte, v byte) error

func (*BoeHandle) FWUpdate

func (boe *BoeHandle) FWUpdate() error

update boe firmware use bin downloaded from github

func (*BoeHandle) FWUpdateAbort

func (boe *BoeHandle) FWUpdateAbort() error

func (*BoeHandle) FWUpdateWithFile

func (boe *BoeHandle) FWUpdateWithFile(fpath string) error

update boe firmware with exist file

func (*BoeHandle) GetBindAccount

func (boe *BoeHandle) GetBindAccount() (string, error)

func (*BoeHandle) GetBoeId

func (boe *BoeHandle) GetBoeId() (string, error)

func (*BoeHandle) GetNextHash

func (boe *BoeHandle) GetNextHash(hash []byte) ([]byte, error)

func (*BoeHandle) GetNextHash_v2

func (boe *BoeHandle) GetNextHash_v2(hash []byte) ([]byte, error)

* New Hash algorithm, supported by boe firmware v1.0.0.2

func (*BoeHandle) GetRandom

func (boe *BoeHandle) GetRandom() ([]byte, error)

* Get real-random from boe hardware.

func (*BoeHandle) GetVersion

func (boe *BoeHandle) GetVersion() (TVersion, error)

get boe firmware version

func (*BoeHandle) HWCheck

func (boe *BoeHandle) HWCheck() bool

func (*BoeHandle) HW_Auth_Sign

func (boe *BoeHandle) HW_Auth_Sign(random []byte) ([]byte, error)

sign the data with specific private every boe board.

func (*BoeHandle) HW_Auth_Sign_With_Hid

func (boe *BoeHandle) HW_Auth_Sign_With_Hid(random []byte) ([]byte, error)

sign the data with specific private every boe board.

func (*BoeHandle) HW_Auth_Verify

func (boe *BoeHandle) HW_Auth_Verify(random []byte, cid []byte, signature []byte) bool

verify if signature is signed with current boe board.

func (*BoeHandle) HW_Auth_Verify_With_Hid

func (boe *BoeHandle) HW_Auth_Verify_With_Hid(random []byte, hid []byte, cid []byte, signature []byte) bool

verify if signature is signed with current boe board.

func (*BoeHandle) HashVerify

func (boe *BoeHandle) HashVerify(old []byte, next []byte) error

func (*BoeHandle) Init

func (boe *BoeHandle) Init() error

func (*BoeHandle) RegisterRecoverPubCallback

func (boe *BoeHandle) RegisterRecoverPubCallback(call BoeRecoverPubKeyFunc)

func (*BoeHandle) Release

func (boe *BoeHandle) Release() error

func (*BoeHandle) Sleep

func (boe *BoeHandle) Sleep()

Sleep boe.

func (*BoeHandle) ValidateSign

func (boe *BoeHandle) ValidateSign(hash []byte, r []byte, s []byte, v byte) ([]byte, error)

type BoeRecoverPubKeyFunc

type BoeRecoverPubKeyFunc func(RecoverPubkey, error)

type RecoverPubkey

type RecoverPubkey struct {
	TxHash []byte // recover tx's hash
	Hash   []byte
	Sig    []byte // signature
	Pub    []byte // recovered pubkey
}

result for recover pubkey

type Release

type Release struct {
	Hv   int    `json:"hv"`
	Mv   int    `json:"mv"`
	Fv   int    `json:"fv"`
	Dv   int    `json:"dv"`
	File string `json:"file"`
	Time string `json:"time"`
}

type TVersion

type TVersion struct {
	H int // hardware version
	M int // matched with software version
	F int // function version
	D int // debug version
}

boe version struct

func (TVersion) VersionString

func (t TVersion) VersionString() string

type TaskTh

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

Jump to

Keyboard shortcuts

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