@@ -25,6 +25,13 @@ class Client < Imagekitio::Internal::Transport::BaseClient
2525 # @return [String, nil]
2626 attr_reader :password
2727
28+ # Your ImageKit webhook secret for verifying webhook signatures (starts with
29+ # `whsec_`). You can find this in the
30+ # [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only
31+ # required if you're using webhooks.
32+ # @return [String, nil]
33+ attr_reader :webhook_secret
34+
2835 # @return [Imagekitio::Resources::CustomMetadataFields]
2936 attr_reader :custom_metadata_fields
3037
@@ -80,6 +87,11 @@ def base_url_overridden? = @base_url_overridden
8087 # dummy value. You can ignore this field. Defaults to
8188 # `ENV["OPTIONAL_IMAGEKIT_IGNORES_THIS"]`
8289 #
90+ # @param webhook_secret [String, nil] Your ImageKit webhook secret for verifying webhook signatures (starts with
91+ # `whsec_`). You can find this in the
92+ # [ImageKit dashboard](https://imagekit.io/dashboard/developer/webhooks). Only
93+ # required if you're using webhooks. Defaults to `ENV["IMAGEKIT_WEBHOOK_SECRET"]`
94+ #
8395 # @param base_url [String, nil] Override the default base URL for the API, e.g.,
8496 # `"https://api.example.com/v2/"`. Defaults to `ENV["IMAGE_KIT_BASE_URL"]`
8597 #
@@ -93,6 +105,7 @@ def base_url_overridden? = @base_url_overridden
93105 def initialize(
94106 private_key: ENV["IMAGEKIT_PRIVATE_KEY"],
95107 password: ENV.fetch("OPTIONAL_IMAGEKIT_IGNORES_THIS", "do_not_set"),
108+ webhook_secret: ENV["IMAGEKIT_WEBHOOK_SECRET"],
96109 base_url: ENV["IMAGE_KIT_BASE_URL"],
97110 max_retries: self.class::DEFAULT_MAX_RETRIES,
98111 timeout: self.class::DEFAULT_TIMEOUT_IN_SECONDS,
@@ -109,6 +122,7 @@ def initialize(
109122
110123 @private_key = private_key.to_s
111124 @password = password.to_s
125+ @webhook_secret = webhook_secret&.to_s
112126
113127 super(
114128 base_url: base_url,
0 commit comments