mirror of
https://github.com/status-im/keycard-cli.git
synced 2025-02-28 11:50:43 +00:00
install NDEF by default with empty data
This commit is contained in:
parent
14a203452b
commit
acacf23199
17
installer.go
17
installer.go
@ -32,7 +32,7 @@ func NewInstaller(t keycardio.Transmitter) *Installer {
|
||||
}
|
||||
|
||||
// Install installs the applet from the specified capFile.
|
||||
func (i *Installer) Install(capFile *os.File, overwriteApplet bool, installKeycard bool, installCash bool, ndefRecordTemplate string) error {
|
||||
func (i *Installer) Install(capFile *os.File, overwriteApplet bool, installKeycard bool, installCash bool, installNDEF bool, ndefRecordTemplate string) error {
|
||||
logger.Info("installation started")
|
||||
startTime := time.Now()
|
||||
cmdSet := globalplatform.NewCommandSet(i.c)
|
||||
@ -87,10 +87,17 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool, installKeyca
|
||||
}
|
||||
}
|
||||
|
||||
if ndefRecordTemplate != "" {
|
||||
ndefURL, ndefRecord, err := i.buildNDEFRecordWithCashAppletData(ndefRecordTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
if installNDEF {
|
||||
var (
|
||||
ndefURL string
|
||||
ndefRecord []byte
|
||||
)
|
||||
|
||||
if ndefRecordTemplate != "" {
|
||||
ndefURL, ndefRecord, err = i.buildNDEFRecordWithCashAppletData(ndefRecordTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
logger.Info("setting NDEF url", "url", ndefURL)
|
||||
|
5
main.go
5
main.go
@ -29,9 +29,10 @@ var (
|
||||
flagCapFile = flag.String("a", "", "applet cap file path")
|
||||
flagKeycardApplet = flag.Bool("keycard-applet", true, "install keycard applet")
|
||||
flagCashApplet = flag.Bool("cash-applet", true, "install cash applet")
|
||||
flagNDEFApplet = flag.Bool("ndef-applet", true, "install NDEF applet")
|
||||
flagOverwrite = flag.Bool("f", false, "force applet installation if already installed")
|
||||
flagLogLevel = flag.String("l", "", `Log level, one of: "error", "warn", "info", "debug", and "trace"`)
|
||||
flagNdefTemplate = flag.String("ndef", "", "Specify a URL to use in the NDEF record. Use the {{.cashAddress}} variable to get the cash address: http://example.com/{{.cashAddress}}.")
|
||||
flagNDEFTemplate = flag.String("ndef", "", "Specify a URL to use in the NDEF record. Use the {{.cashAddress}} variable to get the cash address: http://example.com/{{.cashAddress}}.")
|
||||
)
|
||||
|
||||
func initLogger() {
|
||||
@ -238,7 +239,7 @@ func commandInstall(card *scard.Card) error {
|
||||
defer f.Close()
|
||||
|
||||
i := NewInstaller(card)
|
||||
return i.Install(f, *flagOverwrite, *flagKeycardApplet, *flagCashApplet, *flagNdefTemplate)
|
||||
return i.Install(f, *flagOverwrite, *flagKeycardApplet, *flagCashApplet, *flagNDEFApplet, *flagNDEFTemplate)
|
||||
}
|
||||
|
||||
func commandInfo(card *scard.Card) error {
|
||||
|
Loading…
x
Reference in New Issue
Block a user