Skip to content

Commit 405fe36

Browse files
mchack-workdehanj
authored andcommitted
Rename appbins latest -> current
- Latest() -> Current() - latestAppHash -> currentAppHash
1 parent 7fc0134 commit 405fe36

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

cmd/tkey-verification/appbins.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func (a *AppBin) Hash() []byte {
3030
}
3131

3232
type AppBins struct {
33-
Bins map[string]AppBin
34-
latest string
33+
Bins map[string]AppBin
34+
current string
3535
}
3636

3737
// Get returns an AppBin indexed by the app hash digest.
@@ -60,10 +60,10 @@ func (a AppBins) Tags() []string {
6060
return tags
6161
}
6262

63-
// Latest returns the currently used device app for device signing
63+
// Current returns the currently used device app for device signing
6464
// during provisioning.
65-
func (a AppBins) Latest() AppBin {
66-
return a.Bins[a.latest]
65+
func (a AppBins) Current() AppBin {
66+
return a.Bins[a.current]
6767
}
6868

6969
// NewAppBins initializes the embedded device apps. It expects the
@@ -127,7 +127,7 @@ func NewAppBins(latestHash string) (AppBins, error) {
127127
}
128128

129129
if _, ok := appBins.Bins[latestHash]; ok {
130-
appBins.latest = latestHash
130+
appBins.current = latestHash
131131
} else {
132132
return AppBins{}, MissingError{what: "latest app"}
133133
}

cmd/tkey-verification/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const currentVendorHash = "f8ecdcda53a296636a0297c250b27fb649860645626cc8ad935ea
1717

1818
// Hash digest of signing device app for device signature during
1919
// provisioning.
20-
const latestAppHash = "cd3c4f433f84648428113bd0a0cc407b2150e925a51b478006321e5a903c1638ce807138d1cc1f8f03cfb6236a87de0febde3ce0ddf177208e5483d1c169bac4"
20+
const currentAppHash = "cd3c4f433f84648428113bd0a0cc407b2150e925a51b478006321e5a903c1638ce807138d1cc1f8f03cfb6236a87de0febde3ce0ddf177208e5483d1c169bac4"
2121

2222
const progname = "tkey-verification"
2323

cmd/tkey-verification/remotesign.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ func remoteSign(server *Server, devPath string, verbose bool) {
3333
// Returns the currently used device app, UDI, pubkey, expected
3434
// firmware, and any error
3535
func signChallenge(devPath string, verbose bool) (AppBin, *tkey.UDI, []byte, Firmware, error) {
36-
appBins, err := NewAppBins(latestAppHash)
36+
appBins, err := NewAppBins(currentAppHash)
3737
if err != nil {
3838
fmt.Printf("Failed to init embedded device apps: %v\n", err)
3939
os.Exit(1)
4040
}
4141

42-
appBin := appBins.Latest()
42+
appBin := appBins.Current()
4343

4444
firmwares, err := NewFirmwares()
4545
if err != nil {

cmd/tkey-verification/servesigner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func serveSigner(conf Config, devPath string, verbose bool, checkConfigOnly bool
3838
os.Exit(1)
3939
}
4040

41-
appBins, err := NewAppBins(latestAppHash)
41+
appBins, err := NewAppBins(currentAppHash)
4242
if err != nil {
4343
fmt.Printf("Failed to init embedded device apps: %v\n", err)
4444
os.Exit(1)

cmd/tkey-verification/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ func readBuildInfo() string {
2828
}
2929

3030
func builtWith() {
31-
appBins, err := NewAppBins(latestAppHash)
31+
appBins, err := NewAppBins(currentAppHash)
3232
if err != nil {
3333
fmt.Printf("Failed to init embedded device apps: %v\n", err)
3434
os.Exit(1)
3535
}
3636

37-
deviceSignAppBin := appBins.Latest()
37+
deviceSignAppBin := appBins.Current()
3838

3939
vendorKeys, err := NewVendorKeys(appBins, currentVendorHash)
4040
if err != nil {

cmd/tkey-verification/verify.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ import (
2121
const verifyInfoURL = "https://www.tillitis.se/verify"
2222

2323
func verify(devPath string, verbose bool, showURLOnly bool, baseDir string, verifyBaseURL string) {
24-
25-
appBins, err := NewAppBins(latestAppHash)
24+
appBins, err := NewAppBins(currentAppHash)
2625
if err != nil {
2726
missing(fmt.Sprintf("no embedded device apps: %v", err))
2827
os.Exit(1)

0 commit comments

Comments
 (0)