-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: * Use auditor.Auditor in /client and /auditlog
- Loading branch information
Showing
17 changed files
with
349 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
protocol/auditlog_test.go → protocol/auditlog/auditlog_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package auditlog | ||
|
||
import ( | ||
"testing" | ||
|
||
p "github.com/coniks-sys/coniks-go/protocol" | ||
"github.com/coniks-sys/coniks-go/protocol/directory" | ||
) | ||
|
||
// NewTestAuditLog creates a ConiksAuditLog and corresponding | ||
// ConiksDirectory used for testing auditor-side CONIKS operations. | ||
// The new audit log can be initialized with the number of epochs | ||
// indicating the length of the directory history with which to | ||
// initialize the log; if numEpochs > 0, the history contains numEpochs+1 | ||
// STRs as it always includes the STR after the last directory update | ||
func NewTestAuditLog(t *testing.T, numEpochs int) ( | ||
*directory.ConiksDirectory, ConiksAuditLog, []*p.DirSTR) { | ||
d, pk := directory.NewTestDirectory(t, true) | ||
aud := New() | ||
|
||
var hist []*p.DirSTR | ||
for ep := 0; ep < numEpochs; ep++ { | ||
hist = append(hist, d.LatestSTR()) | ||
d.Update() | ||
} | ||
// always include the actual latest STR | ||
hist = append(hist, d.LatestSTR()) | ||
|
||
err := aud.Insert("test-server", pk, hist) | ||
if err != nil { | ||
t.Fatalf("Error inserting a new history with %d STRs", numEpochs+1) | ||
} | ||
|
||
return d, aud, hist | ||
} |
Oops, something went wrong.