func (s *Signer) SignRequest(pubKeyID string, req *http.Request) error {
	req.Header.Add(dateHeader, date())
	logger.Debugf("Signing request for %s. Public key ID [%s]. Headers: %s", req.RequestURI, pubKeyID, req.Header)
	if err := s.signer().Sign(pubKeyID, req); err != nil {
		return fmt.Errorf("sign request with public key ID [%s]: %w", pubKeyID, err)
	}
	logger.Debugf("Signed request. Headers: %s", req.Header)
	return nil
}
SignRequest signs an HTTP request.
package httpsig
import (
	"fmt"
	"net/http"
	"time"
	"github.com/hyperledger/aries-framework-go/pkg/crypto"
	"github.com/hyperledger/aries-framework-go/pkg/kms"
	httpsig "github.com/igor-pavlenko/httpsignatures-go"
	"github.com/trustbloc/edge-core/pkg/log"
)
var logger = log.New("activitypub_httpsig")
const (
	dateHeader = "Date"
)
func DefaultGetSignerConfig() SignerConfig {
	return SignerConfig{
		Headers: []string{"(request-target)", "Date"},
	}
}
func DefaultPostSignerConfig() SignerConfig {
	return SignerConfig{
		Headers: []string{"(request-target)", "Date", "Digest"},
	}
}
type SignerConfig struct {
	Headers []string
}
type signer interface {
	Sign(secretKeyID string, r *http.Request) error
}
type Signer struct {
	SignerConfig
	signer func() signer
}
func NewSigner(cfg SignerConfig, cr crypto.Crypto, km kms.KeyManager, keyID string) *Signer {
	algo := NewSignerAlgorithm(cr, km, keyID)
	secretRetriever := &SecretRetriever{}
	return &Signer{
		SignerConfig: cfg,
		signer: func() signer {
			hs := httpsig.NewHTTPSignatures(secretRetriever)
			hs.SetDefaultSignatureHeaders(cfg.Headers)
			hs.SetSignatureHashAlgorithm(algo)
			return hs
		},
	}
}