View Source Buckets.Adapters.GCS.Signature (Buckets v1.2.0)

Google Cloud Storage V4 signed URL generation.

Implements the V4 signing process for creating signed URLs that allow temporary access to GCS objects without requiring authentication.

Summary

Functions

Generates a V4 signed URL for Google Cloud Storage.

Functions

Link to this function

generate_v4(credentials, bucket, object_path, opts \\ [])

View Source
@spec generate_v4(map(), String.t(), String.t(), keyword()) ::
  {:ok, String.t()} | {:error, term()}

Generates a V4 signed URL for Google Cloud Storage.

Options

  • :verb - HTTP method (default: "GET")
  • :expires - Expiration time in seconds from now (default: 3600)
  • :headers - Additional headers to include in the signature

Examples

iex> credentials = %{"client_email" => "test@example.com", "private_key" => "..."}
iex> Buckets.Adapters.GCS.Signature.generate_v4(credentials, "my-bucket", "path/to/object.jpg")
{:ok, "https://storage.googleapis.com/my-bucket/path%2Fto%2Fobject.jpg?X-Goog-Algorithm=..."}