lib

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package lib provides helper utilities for ImageKit SDK This file contains custom helper functions - not generated

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HelperService

type HelperService struct {
	Options []option.RequestOption
	// contains filtered or unexported fields
}

HelperService contains utility methods for ImageKit SDK operations like URL building, transformation string generation, and authentication parameter generation.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHelperService method instead.

func NewHelperService

func NewHelperService(opts ...option.RequestOption) (r HelperService)

NewHelperService generates a new helper service that applies the given options. It extracts the private key from the options for use in signing and authentication.

func (*HelperService) BuildTransformationString

func (r *HelperService) BuildTransformationString(transformation []shared.TransformationParam) string

Builds a transformation string from the given transformations.

func (*HelperService) BuildURL

func (r *HelperService) BuildURL(opts shared.SrcOptionsParam) string

Builds a source URL with the given options.

func (*HelperService) GetAuthenticationParameters

func (r *HelperService) GetAuthenticationParameters(token string, expire int64) (map[string]interface{}, error)

Generates authentication parameters for client-side file uploads using ImageKit's Upload API V1. This method creates the required authentication signature that allows secure file uploads directly from the browser or mobile applications without exposing your private API key.

Parameters:

  • token: A unique token for this upload request. If empty, a UUID will be generated.
  • expire: Unix timestamp when this authentication should expire. If 0, defaults to 30 minutes from now.

Returns a map containing:

  • "token": The authentication token
  • "expire": The expiration timestamp
  • "signature": The HMAC signature

Jump to

Keyboard shortcuts

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