Verifies a postback/chargeback JWT.

    Returns the trusted JSON data from the original request.
    When there's an error, an exception derived from
    :class:`mozpay.exc.InvalidJWT`
    will be raised.

    This is an all-in-one function that does all verification you'd
    need. There are some low-level functions you can use to just
    verify certain parts of a JWT.

    Arguments:

    **signed_request**
        JWT byte string.

    **expected_aud**
        The expected value for the aud (audience) of the JWT.
        See :func:`mozpay.verify.verify_audience`.

    **secret**
        A shared secret to validate the JWT with.
        See :func:`mozpay.verify.verify_sig`.

    **validators**
        A list of extra callables. Each one is passed a JSON Python dict
        representing the JWT after it has passed all other checks.

    **required_keys**
        A list of JWT keys to validate. See
        :func:`mozpay.verify.verify_keys`.

    **algorithms**
        A list of valid JWT algorithms to accept.
        By default this will only include HS256 because that's
        what the Firefox Marketplace uses.

def verify_jwt(signed_request, expected_aud, secret, validators=[],
               required_keys=('request.pricePoint',
                              'request.name',
                              'request.description',
                              'response.transactionID'),
               algorithms=None):
    """
    Verifies a postback/chargeback JWT.

    Returns the trusted JSON data from the original request.
    When there's an error, an exception derived from
    :class:`mozpay.exc.InvalidJWT`
    will be raised.

    This is an all-in-one function that does all verification you'd
    need. There are some low-level functions you can use to just
    verify certain parts of a JWT.

    Arguments:

    **signed_request**
        JWT byte string.

    **expected_aud**
        The expected value for the aud (audience) of the JWT.
        See :func:`mozpay.verify.verify_audience`.

    **secret**
        A shared secret to validate the JWT with.
        See :func:`mozpay.verify.verify_sig`.

    **validators**
        A list of extra callables. Each one is passed a JSON Python dict
        representing the JWT after it has passed all other checks.

    **required_keys**
        A list of JWT keys to validate. See
        :func:`mozpay.verify.verify_keys`.

    **algorithms**
        A list of valid JWT algorithms to accept.
        By default this will only include HS256 because that's
        what the Firefox Marketplace uses.
    """
    if not algorithms:
        algorithms = ['HS256']
    issuer = _get_issuer(signed_request=signed_request)
    app_req = verify_sig(signed_request, secret, issuer=issuer,
                         algorithms=algorithms, expected_aud=expected_aud)

    # I think this call can be removed after
    # https://github.com/jpadilla/pyjwt/issues/121
    verify_claims(app_req, issuer=issuer)

    verify_keys(app_req, required_keys, issuer=issuer)

    for vl in validators:
        vl(app_req)

    return app_req