Skip to content

Commit

Permalink
Move identity counter out of WitnessStatus.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiggoha committed Jan 30, 2024
1 parent ad2ae61 commit f4c9324
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ func (p *Status) Print() string {
status.WriteString(fmt.Sprintf("Version ....................: %d (%s)\n", p.Version, time.Unix(int64(p.Version), 0)))
status.WriteString(fmt.Sprintf("Runtime ....................: %s\n", p.Runtime))
status.WriteString(fmt.Sprintf("Link .......................: %v\n", p.Link))
status.WriteString(fmt.Sprintf("IdentityCounter ............: %d", p.IdentityCounter))
if p.Witness != nil {
status.WriteString(fmt.Sprintf("Witness/Identity ...........: %v\n", p.Witness.Identity))
status.WriteString(fmt.Sprintf("Witness/IP .................: %v", p.Witness.IP))
status.WriteString(fmt.Sprintf("Witness/IdentityCounter ....: %d", p.Witness.IdentityCounter))
} else {
status.WriteString(fmt.Sprint("Witness ....................: <no status>"))
}
Expand Down
38 changes: 19 additions & 19 deletions api/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ message Status {
string Runtime = 6;
bool Link = 7;
WitnessStatus Witness = 8;
// IdentityCounter is incremented when the device is recovered and the device
// needs a new witness identity.
uint32 IdentityCounter = 9;
}

/*
Expand All @@ -145,9 +148,6 @@ message WitnessStatus {
string Identity = 1;
// IP is a string representation of the witness applet's current IP address.
string IP = 2;
// IdentityCounter is incremented when the device is recovered and the device
// needs a new witness identity.
uint32 IdentityCounter = 3;
}

/*
Expand Down
3 changes: 0 additions & 3 deletions api/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ type WitnessStatus struct {
Identity string
// IP is the currently-assigned IP address of the witness applet.
IP string
// IdentityCounter is incremented when the device is recovered and the device
// needs a new witness identity.
IdentityCounter uint32
}

// FirmwareUpdate represents a firmware update.
Expand Down
1 change: 1 addition & 0 deletions trusted_os/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func getStatus() (s *api.Status) {
Build: Build,
Version: version,
Runtime: fmt.Sprintf("%s %s/%s", runtime.Version(), runtime.GOOS, runtime.GOARCH),
// TODO(jayhou): set IdentityCounter here.
}
if witnessStatus != nil {
s.Witness = &api.WitnessStatus{
Expand Down

0 comments on commit f4c9324

Please sign in to comment.