From 5170838949f054624a205877464f0255ebb9e4ab Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Thu, 28 Mar 2019 11:33:48 +0100 Subject: [PATCH] move NormalChannel and Transmitter to io pkg --- {globalplatform => io}/normal_channel.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) rename {globalplatform => io}/normal_channel.go (78%) diff --git a/globalplatform/normal_channel.go b/io/normal_channel.go similarity index 78% rename from globalplatform/normal_channel.go rename to io/normal_channel.go index b823a8d..f0ca139 100644 --- a/globalplatform/normal_channel.go +++ b/io/normal_channel.go @@ -1,10 +1,14 @@ -package globalplatform +package io import ( + "github.com/ethereum/go-ethereum/log" "github.com/status-im/keycard-go/apdu" + "github.com/status-im/keycard-go/globalplatform" "github.com/status-im/keycard-go/hexutils" ) +var logger = log.New("package", "io") + // Transmitter defines an interface with one method to transmit raw commands and receive raw responses. type Transmitter interface { Transmit([]byte) ([]byte, error) @@ -41,8 +45,8 @@ func (c *NormalChannel) Send(cmd *apdu.Command) (*apdu.Response, error) { return nil, err } - if resp.Sw1 == Sw1ResponseDataIncomplete && (cmd.Cla != ClaISO7816 || cmd.Ins != InsGetResponse) { - getResponse := NewCommandGetResponse(resp.Sw2) + if resp.Sw1 == globalplatform.Sw1ResponseDataIncomplete && (cmd.Cla != globalplatform.ClaISO7816 || cmd.Ins != globalplatform.InsGetResponse) { + getResponse := globalplatform.NewCommandGetResponse(resp.Sw2) return c.Send(getResponse) }