From 66a0a082fea8bb64193f6e78499fafae67612d52 Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Tue, 19 Nov 2019 12:38:41 +0100 Subject: [PATCH] add Installed to CashApplicationInfo --- cash_command_set.go | 4 ++-- types/cash_application_info.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cash_command_set.go b/cash_command_set.go index 5952051..1faf0d2 100644 --- a/cash_command_set.go +++ b/cash_command_set.go @@ -14,7 +14,8 @@ type CashCommandSet struct { func NewCashCommandSet(c types.Channel) *CashCommandSet { return &CashCommandSet{ - c: c, + c: c, + CashApplicationInfo: &types.CashApplicationInfo{}, } } @@ -23,7 +24,6 @@ func (cs *CashCommandSet) Select() error { cmd.SetLe(0) resp, err := cs.c.Send(cmd) if err = cs.checkOK(resp, err); err != nil { - cs.CashApplicationInfo = &types.CashApplicationInfo{} return err } diff --git a/types/cash_application_info.go b/types/cash_application_info.go index a63c1f5..c9d6b81 100644 --- a/types/cash_application_info.go +++ b/types/cash_application_info.go @@ -3,6 +3,7 @@ package types import "github.com/status-im/keycard-go/apdu" type CashApplicationInfo struct { + Installed bool PublicKey []byte PublicKeyData []byte Version []byte @@ -15,6 +16,8 @@ func ParseCashApplicationInfo(data []byte) (*CashApplicationInfo, error) { return nil, ErrWrongApplicationInfoTemplate } + info.Installed = true + pubKey, err := apdu.FindTag(data, apdu.Tag{TagApplicationInfoTemplate}, apdu.Tag{0x80}) if err != nil { return nil, err