mreinstein / alexa-verifier

✓ Verify HTTP requests sent to an Alexa skill are sent from Amazon
MIT License
76 stars 23 forks source link

alexa-verifier

tests

Verify HTTP requests sent to an Alexa skill are sent from Amazon.

This module is framework-agnostic.

If you're using expressjs, you should check out alexa-verifier-middleware which is a lot easier to integrate.

motivation

Part of the certication process for alexa skills hosted on a generic web service (i.e., not AWS Lambda) is that your skill must validate requests are actually coming from Amazon. This is enforced by checking:

This module provides a function to handle this validation.

usage

arguments

You may include a callback function, in the standard node error argument-first format:

import verifier from 'alexa-verifier'

verifier(cert_url, signature, requestRawBody, function callbackFn (er) {
    // if er, something went wrong
})

Ommiting a callback function returns a promise:

const verifyPromise = verifier(cert_url, signature, requestRawBody)