Documentation
¶
Overview ¶
Package proxy implements a storage proxy that provides presigned URL generation
Index ¶
- Constants
- Variables
- func GenerateDownloadURL(ctx context.Context, file *storagetypes.File, duration time.Duration, ...) (string, error)
- func GenerateDownloadURLWithSecret(file *storagetypes.File, secret []byte, duration time.Duration, ...) (string, error)
- func ShouldBypassPresignInterceptor(ctx context.Context) bool
- func WithPresignInterceptorBypass(ctx context.Context) context.Context
Constants ¶
View Source
const ( // DefaultPresignDuration is the default duration for presigned URLs DefaultPresignDurationMinutes = 15 // SecretDivisor is used to split the secret into nonce and key components SecretDivisor = 2 )
Variables ¶
View Source
var ( // ErrMissingFileID indicates that the file ID is missing ErrMissingFileID = errors.New("missing file id") // ErrMissingObjectURI indicates that the file metadata is missing the object URI ErrMissingObjectURI = errors.New("file metadata missing object URI") // ErrInvalidSecretLength indicates that the secret must be 128 bytes when provided ErrInvalidSecretLength = errors.New("secret must be 128 bytes when provided") // ErrAuthenticatedUserRequired indicates that an authenticated user is required in the context ErrAuthenticatedUserRequired = errors.New("authenticated user required in context") )
View Source
var ( // ErrTokenManagerRequired indicates proxy signing is impossible without a token manager. ErrTokenManagerRequired = errors.New("proxy presign requires token manager") // ErrEntClientRequired indicates storing secrets requires an ent client. ErrEntClientRequired = errors.New("storing secrets requires ent client") )
Functions ¶
func GenerateDownloadURL ¶
func GenerateDownloadURL(ctx context.Context, file *storagetypes.File, duration time.Duration, cfg *storage.ProxyPresignConfig) (string, error)
GenerateDownloadURL builds a proxy download URL and persists the signing secret for validation.
func GenerateDownloadURLWithSecret ¶
func GenerateDownloadURLWithSecret(file *storagetypes.File, secret []byte, duration time.Duration, cfg *storage.ProxyPresignConfig) (string, error)
GenerateDownloadURLWithSecret builds a proxy download URL using the provided secret for testing.
func ShouldBypassPresignInterceptor ¶
ShouldBypassPresignInterceptor reports whether presign interceptors should be skipped.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.