proxy

package
v0.46.7 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package proxy implements a storage proxy that provides presigned URL generation

Index

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

func ShouldBypassPresignInterceptor(ctx context.Context) bool

ShouldBypassPresignInterceptor reports whether presign interceptors should be skipped.

func WithPresignInterceptorBypass

func WithPresignInterceptorBypass(ctx context.Context) context.Context

WithPresignInterceptorBypass marks the context so downstream Ent interceptors skip presign handling.

Types

This section is empty.

Jump to

Keyboard shortcuts

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