presigner

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const ISO8601BasicFormat = "20060102T150405Z"

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestPresigner

type RequestPresigner interface {
	// SignUploadURL creates and signs a URL that allows a PUT request to upload
	// data for the given digest/size to the service.
	//
	// The ttl parameter determines the number of seconds the signed URL will be
	// valid for.
	//
	// It returns a signed URL that will accept a PUT request, and a set of HTTP
	// headers that should also be sent with the request.
	SignUploadURL(ctx context.Context, digest multihash.Multihash, size uint64, ttl uint64) (url.URL, http.Header, error)
	// VerifyUploadURL ensures the upload URL was signed by this service. It
	// returns the _signed_ URL and headers or error if the signature is invalid.
	VerifyUploadURL(ctx context.Context, url url.URL, headers http.Header) (url.URL, http.Header, error)
}

type S3RequestPresigner

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

func NewS3RequestPresigner

func NewS3RequestPresigner(accessKeyID string, secretAcessKey string, endpoint url.URL, bucketName string) (*S3RequestPresigner, error)

NewS3RequestPresigner creates a signer that the S3 SDK to sign and verify requests. The bucketName parameter is optional and defaults to "blob".

Signed upload URLs take the form {endpoint}/{bucketName}/{b58digest}

func (*S3RequestPresigner) SignUploadURL

func (ss *S3RequestPresigner) SignUploadURL(ctx context.Context, digest multihash.Multihash, size uint64, ttl uint64) (url.URL, http.Header, error)

func (*S3RequestPresigner) VerifyUploadURL

func (ss *S3RequestPresigner) VerifyUploadURL(ctx context.Context, requestURL url.URL, requestHeaders http.Header) (url.URL, http.Header, error)

Jump to

Keyboard shortcuts

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