Socket
Book a DemoInstallSign in
Socket

alexa_request_verifier

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alexa_request_verifier

0.1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Alexa Request Verifier

AlexaRequestVerifier is a gem created to verify that requests received within a Sinatra application originate from Amazon's Alexa API.

Build Status License

Requirements

AlexaRequestVerifier requires the following:

  • Ruby - version 2.0 or greater

Installation

Add this line to your application's Gemfile:

gem 'alexa_request_verifier'

Usage

This gem's main function is taking an [Sinatra][sinatra] request and verifying that it was sent by Amazon.

# within server.rb (or equivalent)

post '/' do
  AlexaRequestVerifier.valid!(request)
end

Methods

AlexaRequestVerifier has two main entry points, detailsed below:

MethodParameter typeReturns
AlexaRequestVerifier.valid!(request)Sinatra::Requesttrue on successful verification. Raises an error if unsuccessful.
AlexaRequestVerifier.valid?(request)Sinatra::Requesttrue on successful verificatipn. false if unsuccessful.

Handling errors

AlexaRequestVerifier#valid! will raise one of the following expected errors if verification cannot be performed.

Please note that all errors come with (hopefully) helpful accompanying messages.

ErrorDescription
AlexaRequestVerifier::InvalidCertificateURIErrorRaised when the certificate URI does not pass validation.
AlexaRequestVerifier::InvalidCertificateErrorRaised when the certificate itself does not pass validation e.g. out of date, does not contain the requires SAN extension, etc.
AlexaRequestVerifier::InvalidRequestErrorRaised when the request cannot be verified (not timely, not signed with the certificate, etc.)

Getting Started with Development

To clone the repository and set up the dependencies, run the following:

git clone https://github.com/mattrayner/alexa_request_verifier.git
cd alexa_request_verifier
bundle install

Running the tests

We use RSpec as our testing framework and tests can be run using:

bundle exec rake

Contributing

If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.

  • Fork the repository
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Ensure your changes are tested using Rspec
  • Create a new Pull Request

License

AlexaRequestVerifier is licensed under the MIT.

Code of Conduct

Everyone interacting in the AlexaRequestVerifier project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 21 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.