dims

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VipsRequestCommands = map[string]operations.VipsRequestOperation{
	"watermark": operations.Watermark,
}

Functions

func DecryptAES128GCM added in v0.4.0

func DecryptAES128GCM(key []byte, base64EncryptedText string) (string, error)

DecryptAES128GCM takes a base64-encoded ciphertext and decrypts it using AES-128-GCM. The input must be encoded as: IV (12 bytes) | Ciphertext | Tag (16 bytes).

func DecryptURL added in v0.4.0

func DecryptURL(secretKey string, base64Eurl string) (string, error)

DecryptURL decrypts the given eurl string using a derived AES-128-GCM key.

func EncryptAES128GCM added in v0.4.0

func EncryptAES128GCM(key []byte, plaintext string) (string, error)

EncryptAES128GCM encrypts the given plaintext using AES-128-GCM with the provided key. The result is base64-encoded and includes IV (12 bytes) | ciphertext | tag (16 bytes).

func EncryptURL added in v0.4.0

func EncryptURL(secretKey string, url string) (string, error)

func EncryptionKey added in v0.4.0

func EncryptionKey(secretKey string) []byte

func HandleDimsStatus

func HandleDimsStatus(config core.EnvironmentConfig, debug bool, dev bool, w http.ResponseWriter, r *http.Request)

func Handler

func Handler(request Request, config core.Config, w http.ResponseWriter) error

func Sign_HmacSha256_128 added in v0.4.0

func Sign_HmacSha256_128(request Request) []byte

Sign returns a signed string using HMAC-SHA256-128.

func Sign_md5 added in v0.4.0

func Sign_md5(r Request) string

Sign returns a signed string using the MD5 algorithm.

Types

type ErrorImageGenerator added in v0.3.0

type ErrorImageGenerator interface {
	GenerateErrorImage(w http.ResponseWriter, status int, message string)
}

type ImageProcessor added in v0.3.0

type ImageProcessor interface {
	ProcessImage() (string, []byte, error)
}

type Request

type Request struct {
	HttpRequest            http.Request
	Id                     string      // The hash of the request -> hash(clientId + commands + imageUrl).
	Signature              string      // The signature of the request.
	Config                 core.Config // The global configuration.
	ClientId               string      // The client ID of this request.
	ImageUrl               string      // The image URL that is being manipulated.
	SendContentDisposition bool        // The content disposition of the request.
	RawCommands            string      // The commands ('resize/100x100', 'strip/true/format/png', etc).
	Error                  bool        // Whether the error image is being served.
	Timestamp              int64       // The timestamp of the request
	SourceImage            core.Image  // The source image.
	// contains filtered or unexported fields
}

func ParseAndValidateV4Request added in v0.4.0

func ParseAndValidateV4Request(r *http.Request, config core.Config) (*Request, error)

func ParseAndValidateV5Request added in v0.4.0

func ParseAndValidateV5Request(r *http.Request, config core.Config) (*Request, error)

func (*Request) Commands

func (r *Request) Commands() []operations.Command

func (*Request) LoadImage added in v0.4.0

func (r *Request) LoadImage(sourceImage *core.Image) (*vips.ImageRef, error)

func (*Request) ProcessImage

func (r *Request) ProcessImage(image *vips.ImageRef, errorImage bool) (string, []byte, error)

ProcessImage will execute the commands on the image.

func (*Request) SendError

func (r *Request) SendError(w http.ResponseWriter, err error) error

func (*Request) SendHeaders

func (r *Request) SendHeaders(w http.ResponseWriter)

func (*Request) SendImage

func (r *Request) SendImage(w http.ResponseWriter, status int, imageFormat string, imageBlob []byte) error

type Signer added in v0.4.0

type Signer interface {
	ValidateSignature(request Request) bool
	Sign(request Request) string
}

type UrlSigner added in v0.3.0

type UrlSigner interface {
	SignUrl() (string, error)
	ImageUrl() string
	Commands() []operations.Command
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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