From 01169b24839e527060f6b48f42611e57c32b8d55 Mon Sep 17 00:00:00 2001 From: Herman Slatman Date: Tue, 9 Jan 2024 16:43:18 +0100 Subject: [PATCH] Make the `Target` optional in `Challenge` object This is a non-standard property in the ACME challenge response, so we shouldn't return it if it's not set. Also made it an optional field in the DB. --- acme/challenge.go | 2 +- acme/db/nosql/challenge.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acme/challenge.go b/acme/challenge.go index b2dd6b76..51c9b6a3 100644 --- a/acme/challenge.go +++ b/acme/challenge.go @@ -82,7 +82,7 @@ type Challenge struct { Token string `json:"token"` ValidatedAt string `json:"validated,omitempty"` URL string `json:"url"` - Target string `json:"target"` + Target string `json:"target,omitempty"` Error *Error `json:"error,omitempty"` } diff --git a/acme/db/nosql/challenge.go b/acme/db/nosql/challenge.go index e68fdeca..e7c9aa29 100644 --- a/acme/db/nosql/challenge.go +++ b/acme/db/nosql/challenge.go @@ -19,7 +19,7 @@ type dbChallenge struct { Status acme.Status `json:"status"` Token string `json:"token"` Value string `json:"value"` - Target string `json:"target"` + Target string `json:"target,omitempty"` ValidatedAt string `json:"validatedAt"` CreatedAt time.Time `json:"createdAt"` Error *acme.Error `json:"error"` // TODO(hs): a bit dangerous; should become db-specific type