mirror of
https://github.com/status-im/keycard-go.git
synced 2025-01-19 00:10:55 +00:00
add install, delete, and status commands to main executable
This commit is contained in:
parent
010ab44d06
commit
cb0a7d3cc4
@ -35,7 +35,7 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool) (*Secrets, e
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
installed, err := i.IsAppletInstalled()
|
installed, err := i.isAppletInstalled()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -57,7 +57,25 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool) (*Secrets, e
|
|||||||
return secrets, nil
|
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)
|
cmd := globalplatform.NewCommandGetStatus(statusAppletAID, globalplatform.P1GetStatusApplications)
|
||||||
resp, err := i.send("get status", cmd, globalplatform.SwOK, globalplatform.SwReferencedDataNotFound)
|
resp, err := i.send("get status", cmd, globalplatform.SwOK, globalplatform.SwReferencedDataNotFound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user