WIP: HTTP-01 solver that stores challenge tokens in FrostFS #4

Draft
potyarkin wants to merge 9 commits from potyarkin/lego:feature/http-01-frostfs-solver into tcl/http-01-frostfs-solver
Showing only changes of commit 597d147c7d - Show all commits

View file

@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"strconv"
"strings"
"time"
"github.com/go-acme/lego/v4/challenge"
@ -46,7 +47,9 @@ func NewHTTPProvider(endpoint, cid, walletPath, walletAccount, walletPassword st
}
func (w *HTTPProvider) Present(domain, token, keyAuth string) error {
var err error
if strings.Contains(token, "/") {
return fmt.Errorf("token with slash character is not supported: %s", token)
}
if w.oid != "" {
return fmt.Errorf("%T is not safe to re-enter: object was saved and not yet cleaned up: %s", w, w.oid)
}
@ -54,6 +57,7 @@ func (w *HTTPProvider) Present(domain, token, keyAuth string) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
var err error
expires, err := w.frostfs.Epoch(ctx, time.Now().Add(tokenLifetime))
if err != nil {
return fmt.Errorf("failed to calculate token expiration: %w", err)