Giter Site home page Giter Site logo

alexa_request_verifier's Introduction

AlexaRequestVerifier

Description

The Pylon Alexa Request Verifier is an updated fork of Charlie Graham's library. As of June 28, 2018, Amazon switched to using their own certificate authority to sign requests, a change which broke this library. This updated version fixes that issue, along with bringing the library up to Elixir 1.6.

This version also adds a new feature: the ability to verify an incoming request with a single function call instead of registering the verifier as part of the request pipeline. To verify requests this way, follow steps 1-3 of the installation instructions below, but instead of performing step 4, call this function using the incoming request's connection:

AlexaRequestVerifier.verify_request(conn)

If verification fails, conn.private[:alexa_verify_error] will contain an error message.

We now join the original project's README (plus a couple updates to reflect the new version), already in progress...


... [Alexa Request Verifier] handles all of the certificate and request verification for Alexa Requests for certified skills. See the Alexa Skills Documentation for more information.

Specifically, it will:

  • Confirm the URL for the certificate is a valid Alexa URL
  • Validate the certificate is valid
  • Confirm the request is recent (to avoid playback attacks)
  • Validate the message signature

Alexa Request Verifier uses ConCache :ets to cache certificates once they have been verified.

Installation

  1. If available in Hex, the package can be installed by adding alexa_request_verifier to your list of dependencies in mix.exs:
def deps do
  [{:pylon_alexa_request_verifier, "~> 0.1.5"}]
end

2.You will need to add AlexaRequestVerifier as an application in the same mix.exs file.

applications: [..., :pylon_alexa_request_verifier]
  1. You will also need to modify your endpoint.ex file by changing the parser as follows:
parsers: [AlexaRequestVerifier.JSONRawBodyParser, :urlencoded, :multipart, :json],
  1. You will need to add the verifier plug to your pipeline in your router.ex file
pipeline :alexa_api do
    plug :accepts, ["json"]
    plug AlexaRequestVerifier
end

Kudos

A big thanks to the Elixir Forum for helping me navigate all of the semi-documented Erlang :public_key libraries. Forum thread.

The Hex documentation can be found at https://hexdocs.pm/pylon_alexa_request_verifier.

alexa_request_verifier's People

Contributors

grahac avatar space-pope avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.