diff --git a/VERSION b/VERSION index 8f0916f..a918a2a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.0 +0.6.0 diff --git a/installer.go b/installer.go index 9338243..ff94431 100644 --- a/installer.go +++ b/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) diff --git a/main.go b/main.go index c9a5226..a13ce45 100644 --- a/main.go +++ b/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 {