func prepareRequestV4(request *http.Request) *http.Request {
	necessaryDefaults := map[string]string{
		"Content-Type": "application/json",
		headerDate:     timestampV4(),
	}
	for header, value := range necessaryDefaults {
		if request.Header.Get(header) == "" {
			request.Header.Set(header, value)
		}
	}
	if request.URL.Path == "" {
		request.URL.Path += "/"
	}
	return request
}
Build Request Steps
package signature
import (
	"bytes"
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"errors"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"sort"
	"strings"
	"time"
)
const (
	headerPrefix      = "X-Hyper-"
	headerDate        = "X-Hyper-Date"
	headerContentHash = "X-Hyper-Content-Sha256"
	headerAuthz       = "Authorization"
	metaAlgorithm = "HYPER-HMAC-SHA256"
	keyPartsPrefix  = "HYPER"
	keyPartsRequest = "hyper_request"
	timeFormatV4 = "20060102T150405Z"
	reqExpiration = 5 * time.Minute
)
type AuthnHeader struct {
	Algorithm    string
	AccessKey    string
	Scope        string
	SignedHeader string
	Signature    string
	Date         string
}
func Signiture4(secretKey string, req *http.Request, header *AuthnHeader) (bool, error) {
	meta := &metadata{
		algorithm:       header.Algorithm,
		credentialScope: header.Scope,
		signedHeaders:   header.SignedHeader,
		date:            header.Date,
		region:          "us-west-1",
		service:         "hyper",
	}
	hashedCanonReq, ok := canonicalRequestV4FromMeta(req, meta)
	if !ok {
		return false, errors.New("payload check error")
	}
	stringToSign := metaToSignV4(req, hashedCanonReq, meta)
	signingKey := signingKeyV4(secretKey, meta.date, meta.region, meta.service)
	signature := signatureV4(signingKey, stringToSign)
	return signature == header.Signature, nil
}
func Sign4(accessKey, secretKey string, req *http.Request) *http.Request {
	prepareRequestV4(req)
	meta := &metadata{}
	hashedCanonReq := hashedCanonicalRequestV4(req, meta)
	stringToSign := stringToSignV4(req, hashedCanonReq, meta)
	signingKey := signingKeyV4(secretKey, meta.date, meta.region, meta.service)
	signature := signatureV4(signingKey, stringToSign)
	req.Header.Set(headerAuthz, buildAuthHeaderV4(accessKey, signature, meta))
	return req
}