Skip to content

Commit db0b711

Browse files
committed
fix(webhooks): encode webhook key in Base64 before verification
1 parent a546963 commit db0b711

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/imagekitio/resources/webhooks.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def unwrap(payload, headers:, key: @client.webhook_secret)
2323
raise ArgumentError.new("Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument")
2424
end
2525

26-
::StandardWebhooks::Webhook.new(key).verify(payload, headers)
26+
encoded_key = Base64.strict_encode64(key)
27+
::StandardWebhooks::Webhook.new(encoded_key).verify(payload, headers)
2728

2829
parsed = JSON.parse(payload, symbolize_names: true)
2930
Imagekitio::Internal::Type::Converter.coerce(Imagekitio::Models::UnwrapWebhookEvent, parsed)

0 commit comments

Comments
 (0)