From cb0a7d3cc4e8caf148a8213832518bb544d7cda9 Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Thu, 4 Oct 2018 17:02:10 +0200 Subject: [PATCH] add install, delete, and status commands to main executable --- lightwallet/installer.go | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lightwallet/installer.go b/lightwallet/installer.go index 5a73d09..cf5e7e0 100644 --- a/lightwallet/installer.go +++ b/lightwallet/installer.go @@ -35,7 +35,7 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool) (*Secrets, e return nil, err } - installed, err := i.IsAppletInstalled() + installed, err := i.isAppletInstalled() if err != nil { return nil, err } @@ -57,7 +57,25 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool) (*Secrets, e return secrets, nil } -func (i *Installer) IsAppletInstalled() (bool, error) { +func (i *Installer) Info() (bool, error) { + err := i.initSecureChannel(cardManagerAID) + if err != nil { + return false, err + } + + return i.isAppletInstalled() +} + +func (i *Installer) Delete() error { + err := i.initSecureChannel(cardManagerAID) + if err != nil { + return err + } + + return i.deleteAID(statusAppletAID, statusPkgAID) +} + +func (i *Installer) isAppletInstalled() (bool, error) { cmd := globalplatform.NewCommandGetStatus(statusAppletAID, globalplatform.P1GetStatusApplications) resp, err := i.send("get status", cmd, globalplatform.SwOK, globalplatform.SwReferencedDataNotFound) if err != nil {