diff options
Diffstat (limited to 'vendor/github.com/xenolf/lego/acme/error.go')
-rw-r--r-- | vendor/github.com/xenolf/lego/acme/error.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/github.com/xenolf/lego/acme/error.go b/vendor/github.com/xenolf/lego/acme/error.go index 6d7013cf1..e4bc934c2 100644 --- a/vendor/github.com/xenolf/lego/acme/error.go +++ b/vendor/github.com/xenolf/lego/acme/error.go @@ -8,7 +8,10 @@ import ( "strings" ) -const tosAgreementError = "Must agree to subscriber agreement before any further actions" +const ( + tosAgreementError = "Must agree to subscriber agreement before any further actions" + invalidNonceError = "JWS has invalid anti-replay nonce" +) // RemoteError is the base type for all errors specific to the ACME protocol. type RemoteError struct { @@ -28,6 +31,12 @@ type TOSError struct { RemoteError } +// NonceError represents the error which is returned if the +// nonce sent by the client was not accepted by the server. +type NonceError struct { + RemoteError +} + type domainError struct { Domain string Error error @@ -73,6 +82,10 @@ func handleHTTPError(resp *http.Response) error { return TOSError{errorDetail} } + if errorDetail.StatusCode == http.StatusBadRequest && strings.HasPrefix(errorDetail.Detail, invalidNonceError) { + return NonceError{errorDetail} + } + return errorDetail } |