vonage-ruby-sdk icon indicating copy to clipboard operation
vonage-ruby-sdk copied to clipboard

Add support for signing API requests

Open timcraft opened this issue 9 years ago • 4 comments

From the spec:

SHOULD allow a signature secret (used for some API requests,
and to validate WebHook signatures)

Using the signature secret to sign API requests is not yet supported.

timcraft avatar Nov 21 '16 10:11 timcraft

@timcraft any idea when you'd have time to implement this?

pRdm avatar Aug 24 '17 11:08 pRdm

@pRdm More a question of priorities than time, currently working on refactoring everything for v5 so things like this are easier to implement. Which API do you want to use it with?

timcraft avatar Aug 24 '17 13:08 timcraft

@timcraft thanks for the speedy response, my team needed it urgently and we've implemented on our end already.

On a side note, but related to signatures, the current README has an ambiguity in it. In your README:

To check signatures for incoming webhook requests you'll also need to specify the signature_secret argument:

client = Nexmo::Client.new(signature_secret: "signature")

But running the command yields an exception

client = Nexmo::Client.new(signature_secret: "signature")
# => KeyError: key not found: "NEXMO_API_KEY"

client = Nexmo::Client.new(key: "api_key", signature_secret: "signature")
# => KeyError: key not found: "NEXMO_API_SECRET"

client = Nexmo::Client.new(key: "api_key", secret: "secret", signature_secret: "signature")
# => #<Nexmo::Client:0x007fddfef9cbb0 @key="api_key", @secret="secret", @signature_secret="signature", @application_id=nil, @private_key=nil, @host="rest.nexmo.com", @api_host="api.nexmo.com", @sns_host="sns.nexmo.com", @user_agent="nexmo-ruby/4.7.0 ruby/2.4.1">

pRdm avatar Aug 25 '17 05:08 pRdm

@pRdm Appreciate that's confusing if you try to copy and paste the code. That should be resolved by making the key and secret optional in #92.

timcraft avatar Aug 31 '17 10:08 timcraft

My understanding is that this is implemented. Both for signing requests (where this is allowed by the API) and for validating webhooks.

superchilled avatar Nov 17 '23 13:11 superchilled