Documentation ¶
Index ¶
- Constants
- func CheckVersion(ver VersionInfo, req VersionInfo) error
- func ConcatMessageAndChangePath(message []byte, path []string) []byte
- func NewVersionRequiredError(req VersionInfo, ver VersionInfo) error
- func RemoveDuplicates(elements []string) []string
- func SerializeChainID(chainID string) ([]byte, error)
- func SerializeHrp(hrp string) ([]byte, error)
- func SerializePath(path string) ([]byte, error)
- func SerializePathSuffix(path string) ([]byte, error)
- func VerifySignature(pubkey, hash, signature []byte) bool
- type LedgerAegon
- func (ledger *LedgerAegon) CheckVersion(ver VersionInfo) error
- func (ledger *LedgerAegon) Close() error
- func (ledger *LedgerAegon) GetPubKey(path string, show bool, hrp string, chainid string) (*ResponseAddr, error)
- func (ledger *LedgerAegon) GetVersion() (*VersionInfo, error)
- func (ledger *LedgerAegon) Sign(pathPrefix string, signingPaths []string, message []byte, changePaths []string) (*ResponseSign, error)
- func (ledger *LedgerAegon) SignHash(pathPrefix string, signingPaths []string, hash []byte) (*ResponseSign, error)
- func (ledger *LedgerAegon) VerifyMultipleSignatures(response ResponseSign, messageHash []byte, rootPath string, ...) error
- type LedgerError
- type ResponseAddr
- type ResponseSign
- type VersionInfo
- type VersionRequiredError
Constants ¶
const ( CLA = 0x80 CLA_ETH = 0xE0 CHUNK_SIZE = 250 HASH_LEN = 32 PAYLOAD_INIT = 0x00 PAYLOAD_ADD = 0x01 PAYLOAD_LAST = 0x02 FIRST_MESSAGE = 0x01 LAST_MESSAGE = 0x02 NEXT_MESSAGE = 0x03 P1_ONLY_RETRIEVE = 0x00 P1_SHOW_ADDRESS_IN_DEVICE = 0x01 INS_GET_VERSION = 0x00 INS_WALLET_ID = 0x01 INS_GET_ADDR = 0x02 INS_GET_EXTENDED_PUBLIC_KEY = 0x03 INS_SIGN_HASH = 0x04 INS_SIGN = 0x05 INS_SIGN_MSG = 0x06 HARDENED = 0x80000000 )
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 NewVersionRequiredError ¶
func NewVersionRequiredError(req VersionInfo, ver VersionInfo) error
func RemoveDuplicates ¶
func SerializeChainID ¶
SerializeChainID serializes a chain ID into a byte slice
func SerializeHrp ¶
SerializeHrp serializes an HRP into a byte slice
func SerializePath ¶
func SerializePathSuffix ¶
func VerifySignature ¶
VerifySignature checks that the given public key created signature over hash. The public key should be in compressed (33 bytes) or uncompressed (65 bytes) format. The signature should have the 64 byte [R || S] format.
Types ¶
type LedgerAegon ¶
type LedgerAegon struct {
// contains filtered or unexported fields
}
LedgerAegon represents a connection to the Aeg app in a Ledger device
func FindLedgerAegonApp ¶
func FindLedgerAegonApp() (_ *LedgerAegon, rerr error)
FindLedgerAegonApp FindLedgerAegonUserApp finds a Aeg user app running in a ledger device
func (*LedgerAegon) CheckVersion ¶
func (ledger *LedgerAegon) CheckVersion(ver VersionInfo) error
CheckVersion returns true if the App version is supported by this library
func (*LedgerAegon) Close ¶
func (ledger *LedgerAegon) Close() error
Close closes a connection with the Aegon user app
func (*LedgerAegon) GetPubKey ¶
func (ledger *LedgerAegon) GetPubKey(path string, show bool, hrp string, chainid string) (*ResponseAddr, error)
GetPubKey returns the pubkey and hash
func (*LedgerAegon) GetVersion ¶
func (ledger *LedgerAegon) GetVersion() (*VersionInfo, error)
GetVersion returns the current version of the Aegon user app
func (*LedgerAegon) Sign ¶
func (ledger *LedgerAegon) Sign(pathPrefix string, signingPaths []string, message []byte, changePaths []string) (*ResponseSign, error)
func (*LedgerAegon) SignHash ¶
func (ledger *LedgerAegon) SignHash(pathPrefix string, signingPaths []string, hash []byte) (*ResponseSign, error)
func (*LedgerAegon) VerifyMultipleSignatures ¶
func (ledger *LedgerAegon) VerifyMultipleSignatures(response ResponseSign, messageHash []byte, rootPath string, signingPaths []string, hrp string, chainID string) error
type LedgerError ¶
type LedgerError int
const ( U2FUnknown LedgerError = 1 U2FBadRequest LedgerError = 2 U2FConfigurationUnsupported LedgerError = 3 U2FDeviceIneligible LedgerError = 4 U2FTimeout LedgerError = 5 Timeout LedgerError = 14 NoErrors LedgerError = 0x9000 DeviceIsBusy LedgerError = 0x9001 ErrorDerivingKeys LedgerError = 0x6802 ExecutionError LedgerError = 0x6400 WrongLength LedgerError = 0x6700 EmptyBuffer LedgerError = 0x6982 OutputBufferTooSmall LedgerError = 0x6983 DataIsInvalid LedgerError = 0x6a80 ConditionsNotSatisfied LedgerError = 0x6985 TransactionRejected LedgerError = 0x6986 BadKeyHandle LedgerError = 0x6a81 InvalidP1P2 LedgerError = 0x6b00 InstructionNotSupported LedgerError = 0x6d00 AppDoesNotSeemToBeOpen LedgerError = 0x6e01 UnknownError LedgerError = 0x6f00 SignVerifyError LedgerError = 0x6f01 )
type ResponseAddr ¶
type ResponseSign ¶
func SignAndCollect ¶
func SignAndCollect(signingPaths []string, ledger *LedgerAegon) (*ResponseSign, error)
type VersionInfo ¶
VersionInfo contains app version information
func (VersionInfo) String ¶
func (c VersionInfo) String() string
type VersionRequiredError ¶
type VersionRequiredError struct { Found VersionInfo Required VersionInfo }
func (VersionRequiredError) Error ¶
func (e VersionRequiredError) Error() string