s3signer

package
v0.0.0-...-d88ec87 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CustomStorageHost is an internal HTTP Header that indicates a custom storage host usage
	CustomStorageHost = "X-Custom-Storage-Host-3kl1Sc29"
)

Variables

This section is empty.

Functions

func GetChunkSignatureLength

func GetChunkSignatureLength(chunkDataSize int64) int64

GetChunkSignatureLength - calculates the length of signature in the chunk

func GetCredential

func GetCredential(accessKeyID, location, service string, t time.Time) string

GetCredential generate a credential string.

func GetSignedChunkLength

func GetSignedChunkLength(chunkDataSize int64) int64

GetSignedChunkLength - calculates the length of chunk metadata

func PostPresignSignatureV2

func PostPresignSignatureV2(policyBase64, secretAccessKey string) string

PostPresignSignatureV2 - presigned signature for PostPolicy request.

func PostPresignSignatureV4

func PostPresignSignatureV4(policyBase64 string, t time.Time, secretAccessKey, location, service string) string

PostPresignSignatureV4 - presigned signature for PostPolicy requests.

func PreSignV2

func PreSignV2(req *http.Request, accessKeyID, secretAccessKey string, expires int64, ignoredCanonicalizedHeaders map[string]bool) *http.Request

PreSignV2 - presign the request in following style. https://${S3_BUCKET}.s3.amazonaws.com/${S3_OBJECT}?AWSAccessKeyId=${S3_ACCESS_KEY}&Expires=${TIMESTAMP}&Signature=${SIGNATURE}.

func PreSignV4

func PreSignV4(req *http.Request, accessKeyID, secretAccessKey, sessionToken, location, service string, expires int64) *http.Request

PreSignV4 presign the request, in accordance with http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html.

func SignV2

func SignV2(req *http.Request, accessKeyID, secretAccessKey string, ignoredCanonicalizedHeaders map[string]bool) *http.Request

SignV2 sign the request before Do() (AWS Signature Version 2).

func SignV4

func SignV4(req *http.Request, accessKeyID, secretAccessKey, sessionToken, location, service string) *http.Request

SignV4 sign the request before Do(), in accordance with http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html.

func SignV4WithIgnoredHeaders

func SignV4WithIgnoredHeaders(req *http.Request, accessKeyID, secretAccessKey, sessionToken, location, service string, ignoredHeaders map[string]bool) *http.Request

SignV4 sign the request before Do(), in accordance with http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html.

func StreamingSignV4

func StreamingSignV4(req *http.Request, accessKeyID, secretAccessKey, sessionToken,
	region, service string, dataLen int64, reqTime time.Time, isProxying bool) *http.Request

func StreamingSignV4WithIgnoredHeaders

func StreamingSignV4WithIgnoredHeaders(req *http.Request, accessKeyID, secretAccessKey, sessionToken,
	region, service string, dataLen int64, reqTime time.Time, ignoredHeaders map[string]bool, isProxying bool) *http.Request

StreamingSignV4 - provides chunked upload signatureV4 support by implementing io.Reader.

func VerifyV2

func VerifyV2(req *http.Request, secretAccessKey string, ignoredCanonicalizedHeaders map[string]bool) (bool, error)

VerifyV2 verify if v2 signature is correct

func VerifyV4

func VerifyV4(req *http.Request, secretAccessKey string) (bool, error)

VerifyV4 verify if v4 signature is correct

Types

type StreamingReader

type StreamingReader struct {
	// contains filtered or unexported fields
}

StreamingReader implements chunked upload signature as a reader on top of req.Body's ReaderCloser chunk header;data;... repeat

func (*StreamingReader) Close

func (s *StreamingReader) Close() error

Close - this method makes underlying io.ReadCloser's Close method available.

func (*StreamingReader) Read

func (s *StreamingReader) Read(buf []byte) (int, error)

Read - this method performs chunk upload signature providing a io.Reader interface.

Jump to

Keyboard shortcuts

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