signer

package
v0.0.0-...-2d16766 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

README

GO SDK Demo

How to download the SDK

Click this link to download the latest version.

Documentation

Index

Constants

View Source
const (
	DateFormat           = "20060102T150405Z"
	SignAlgorithm        = "SDK-HMAC-SHA256"
	HeaderXDateTime      = "X-Sdk-Date"
	HeaderXHost          = "host"
	HeaderXAuthorization = "Authorization"
	HeaderXContentSha256 = "X-Sdk-Content-Sha256"
)

Variables

This section is empty.

Functions

func AuthHeaderValue

func AuthHeaderValue(signatureStr, accessKeyStr string, signedHeaders []string) string

Get the finalized value for the "Authorization" header. The signature parameter is the output from SignStringToSign

func CanonicalHeaders

func CanonicalHeaders(request *http.Request, signerHeaders []string) string

CanonicalHeaders

func CanonicalQueryString

func CanonicalQueryString(request *http.Request) string

CanonicalQueryString

func CanonicalRequest

func CanonicalRequest(request *http.Request, signedHeaders []string) (string, error)

Build a CanonicalRequest from a regular request string

func CanonicalURI

func CanonicalURI(request *http.Request) string

CanonicalURI returns request uri

func HexEncodeSHA256Hash

func HexEncodeSHA256Hash(body []byte) (string, error)

HexEncodeSHA256Hash returns hexcode of sha256

func RequestPayload

func RequestPayload(request *http.Request) ([]byte, error)

RequestPayload

func SignStringToSign

func SignStringToSign(stringToSign string, signingKey []byte) (string, error)

Create the HWS Signature.

func SignedHeaders

func SignedHeaders(r *http.Request) []string

SignedHeaders

func StringToSign

func StringToSign(canonicalRequest string, t time.Time) (string, error)

Create a "String to Sign".

Types

type Signer

type Signer struct {
	Key    string
	Secret string
}

Signature HWS meta

func (*Signer) Sign

func (s *Signer) Sign(request *http.Request) error

SignRequest set Authorization header

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL