Fix linter issues
This commit is contained in:
parent
bcf3c52ac9
commit
35b80f1865
@ -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")
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user