aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Ballet <gballet@gmail.com>2019-03-23 15:45:08 +0800
committerGuillaume Ballet <gballet@gmail.com>2019-04-08 19:21:22 +0800
commit35b80f18656437784238320b7258627ab8af5a93 (patch)
treee5d5767eb1d8f22a30fcfc2b734ebf25bd063feb
parentbcf3c52ac98ad37ec2ce2c22ce1580f6c36e18fe (diff)
downloadgo-tangerine-35b80f18656437784238320b7258627ab8af5a93.tar
go-tangerine-35b80f18656437784238320b7258627ab8af5a93.tar.gz
go-tangerine-35b80f18656437784238320b7258627ab8af5a93.tar.bz2
go-tangerine-35b80f18656437784238320b7258627ab8af5a93.tar.lz
go-tangerine-35b80f18656437784238320b7258627ab8af5a93.tar.xz
go-tangerine-35b80f18656437784238320b7258627ab8af5a93.tar.zst
go-tangerine-35b80f18656437784238320b7258627ab8af5a93.zip
Fix linter issues
-rw-r--r--accounts/scwallet/securechannel.go8
-rw-r--r--accounts/scwallet/wallet.go22
2 files changed, 13 insertions, 17 deletions
diff --git a/accounts/scwallet/securechannel.go b/accounts/scwallet/securechannel.go
index 39db89a8c..7d57c4df9 100644
--- a/accounts/scwallet/securechannel.go
+++ b/accounts/scwallet/securechannel.go
@@ -135,7 +135,7 @@ func (s *SecureChannelSession) Unpair() error {
return fmt.Errorf("Cannot unpair: not paired")
}
- _, err := s.TransmitEncrypted(claSCWallet, insUnpair, s.PairingIndex, 0, []byte{})
+ _, err := s.transmitEncrypted(claSCWallet, insUnpair, s.PairingIndex, 0, []byte{})
if err != nil {
return err
}
@@ -180,7 +180,7 @@ func (s *SecureChannelSession) mutuallyAuthenticate() error {
return err
}
- response, err := s.TransmitEncrypted(claSCWallet, insMutuallyAuthenticate, 0, 0, data)
+ response, err := s.transmitEncrypted(claSCWallet, insMutuallyAuthenticate, 0, 0, data)
if err != nil {
return err
}
@@ -219,8 +219,8 @@ func (s *SecureChannelSession) pair(p1 uint8, data []byte) (*responseAPDU, error
})
}
-// TransmitEncrypted sends an encrypted message, and decrypts and returns the response.
-func (s *SecureChannelSession) TransmitEncrypted(cla, ins, p1, p2 byte, data []byte) (*responseAPDU, error) {
+// transmitEncrypted sends an encrypted message, and decrypts and returns the response.
+func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []byte) (*responseAPDU, error) {
if s.iv == nil {
return nil, fmt.Errorf("Channel not open")
}
diff --git a/accounts/scwallet/wallet.go b/accounts/scwallet/wallet.go
index c0bbe20bb..95a832543 100644
--- a/accounts/scwallet/wallet.go
+++ b/accounts/scwallet/wallet.go
@@ -97,10 +97,6 @@ const (
P1DeriveKeyFromMaster = uint8(0x00)
P1DeriveKeyFromParent = uint8(0x01)
P1DeriveKeyFromCurrent = uint8(0x10)
- deriveP1Assisted = uint8(0x01)
- deriveP1Append = uint8(0x80)
- deriveP2KeyPath = uint8(0x00)
- deriveP2PublicKey = uint8(0x01)
statusP1WalletStatus = uint8(0x00)
statusP1Path = uint8(0x01)
signP1PrecomputedHash = uint8(0x01)
@@ -803,7 +799,7 @@ func (s *Session) unpair() error {
// verifyPin unlocks a wallet with the provided pin.
func (s *Session) verifyPin(pin []byte) error {
- if _, err := s.Channel.TransmitEncrypted(claSCWallet, insVerifyPin, 0, 0, pin); err != nil {
+ if _, err := s.Channel.transmitEncrypted(claSCWallet, insVerifyPin, 0, 0, pin); err != nil {
return err
}
s.verified = true
@@ -813,7 +809,7 @@ func (s *Session) verifyPin(pin []byte) error {
// unblockPin unblocks a wallet with the provided puk and resets the pin to the
// new one specified.
func (s *Session) unblockPin(pukpin []byte) error {
- if _, err := s.Channel.TransmitEncrypted(claSCWallet, insUnblockPin, 0, 0, pukpin); err != nil {
+ if _, err := s.Channel.transmitEncrypted(claSCWallet, insUnblockPin, 0, 0, pukpin); err != nil {
return err
}
s.verified = true
@@ -849,7 +845,7 @@ type walletStatus struct {
// walletStatus fetches the wallet's status from the card.
func (s *Session) walletStatus() (*walletStatus, error) {
- response, err := s.Channel.TransmitEncrypted(claSCWallet, insStatus, statusP1WalletStatus, 0, nil)
+ response, err := s.Channel.transmitEncrypted(claSCWallet, insStatus, statusP1WalletStatus, 0, nil)
if err != nil {
return nil, err
}
@@ -882,7 +878,7 @@ func (s *Session) walletStatus() (*walletStatus, error) {
// derivationPath fetches the wallet's current derivation path from the card.
func (s *Session) derivationPath() (accounts.DerivationPath, error) {
- response, err := s.Channel.TransmitEncrypted(claSCWallet, insStatus, statusP1Path, 0, nil)
+ response, err := s.Channel.transmitEncrypted(claSCWallet, insStatus, statusP1Path, 0, nil)
if err != nil {
return nil, err
}
@@ -922,7 +918,7 @@ func (s *Session) initialize(seed []byte) error {
// Nasty hack to force the top-level struct tag to be context-specific
data[0] = 0xA1
- _, err = s.Channel.TransmitEncrypted(claSCWallet, insLoadKey, 0x02, 0, data)
+ _, err = s.Channel.transmitEncrypted(claSCWallet, insLoadKey, 0x02, 0, data)
return err
}
@@ -952,12 +948,12 @@ func (s *Session) derive(path accounts.DerivationPath) (accounts.Account, error)
}
}
- _, err = s.Channel.TransmitEncrypted(claSCWallet, insDeriveKey, p1, 0, data.Bytes())
+ _, err = s.Channel.transmitEncrypted(claSCWallet, insDeriveKey, p1, 0, data.Bytes())
if err != nil {
return accounts.Account{}, err
}
- response, err := s.Channel.TransmitEncrypted(claSCWallet, insSign, 0, 0, DerivationSignatureHash[:])
+ response, err := s.Channel.transmitEncrypted(claSCWallet, insSign, 0, 0, DerivationSignatureHash[:])
if err != nil {
return accounts.Account{}, err
}
@@ -991,7 +987,7 @@ type keyExport struct {
// publicKey returns the public key for the current derivation path.
func (s *Session) publicKey() ([]byte, error) {
- response, err := s.Channel.TransmitEncrypted(claSCWallet, insExportKey, exportP1Any, exportP2Pubkey, nil)
+ response, err := s.Channel.transmitEncrypted(claSCWallet, insExportKey, exportP1Any, exportP2Pubkey, nil)
if err != nil {
return nil, err
}
@@ -1022,7 +1018,7 @@ func (s *Session) sign(path accounts.DerivationPath, hash []byte) ([]byte, error
}
deriveTime := time.Now()
- response, err := s.Channel.TransmitEncrypted(claSCWallet, insSign, signP1PrecomputedHash, signP2OnlyBlock, hash)
+ response, err := s.Channel.transmitEncrypted(claSCWallet, insSign, signP1PrecomputedHash, signP2OnlyBlock, hash)
if err != nil {
return nil, err
}