Skip to content

Commit

Permalink
feat(setup): infer nonce from client rather than taking it as a param…
Browse files Browse the repository at this point in the history
…eter
  • Loading branch information
pandatix committed Apr 10, 2024
1 parent 367ebb4 commit 9eb5b5a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion api/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func Test_F_CTF(t *testing.T) {
ThemeColor: "",
Start: "",
End: "",
Nonce: nonce,
})
if !assert.Nil(err, "got error: %s", err) {
return
Expand Down
3 changes: 1 addition & 2 deletions api/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type SetupParams struct {
ThemeColor string
Start string
End string
Nonce string // XXX this should not be part of the API, but is required
}

// WARNING: this endpoint is not officially supported.
Expand All @@ -51,7 +50,7 @@ func (client *Client) Setup(params *SetupParams, opts ...Option) error {
"start": params.Start,
"end": params.End,
"_submit": "Finish",
"nonce": params.Nonce,
"nonce": client.nonce,
}
if params.TeamSize != nil {
mp["team_size"] = strconv.Itoa(*params.TeamSize)
Expand Down
3 changes: 0 additions & 3 deletions api/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func Test_F_Setup(t *testing.T) {
ThemeColor: "",
Start: "",
End: "",
Nonce: nonce,
})
if !assert.Nil(err, "got error: %s", err) {
return
Expand Down Expand Up @@ -263,7 +262,6 @@ func Test_F_AdvancedSetup(t *testing.T) {
ThemeColor: "",
Start: "",
End: "",
Nonce: nonce,
})
if !assert.Nil(err, "got error: %s", err) {
return
Expand Down Expand Up @@ -367,7 +365,6 @@ func Test_F_UsersAndTeams(t *testing.T) {
ThemeColor: "",
Start: "",
End: "",
Nonce: nonce,
})
if !assert.Nil(err, "got error: %s", err) {
return
Expand Down
1 change: 0 additions & 1 deletion examples/setup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func main() {
ThemeColor: "",
Start: "",
End: "",
Nonce: nonce,
}); err != nil {
log.Fatalf("Setting up CTFd: %s", err)
}
Expand Down

0 comments on commit 9eb5b5a

Please sign in to comment.