MessageValidator
in package
Uses openssl to verify SNS messages to ensure that they were sent by AWS.
Table of Contents
Constants
- SIGNATURE_VERSION_1 = '1'
- SIGNATURE_VERSION_2 = '2'
Methods
- __construct() : mixed
- Constructs the Message Validator object and ensures that openssl is installed.
- getStringToSign() : string
- Builds string-to-sign according to the SNS message spec.
- isValid() : bool
- Determines if a message is valid and that is was delivered by AWS. This method does not throw exceptions and returns a simple boolean value.
- validate() : mixed
- Validates a message from SNS to ensure that it was delivered by AWS.
Constants
SIGNATURE_VERSION_1
public
mixed
SIGNATURE_VERSION_1
= '1'
SIGNATURE_VERSION_2
public
mixed
SIGNATURE_VERSION_2
= '2'
Methods
__construct()
Constructs the Message Validator object and ensures that openssl is installed.
public
__construct([callable $certClient = null ][, string $hostNamePattern = '' ]) : mixed
Parameters
- $certClient : callable = null
-
Callable used to download the certificate. Should have the following function signature:
function (string $certUrl) : string|false $certContent
- $hostNamePattern : string = ''
getStringToSign()
Builds string-to-sign according to the SNS message spec.
public
getStringToSign(Message $message) : string
Parameters
- $message : Message
-
Message for which to build the string-to-sign.
Tags
Return values
stringisValid()
Determines if a message is valid and that is was delivered by AWS. This method does not throw exceptions and returns a simple boolean value.
public
isValid(Message $message) : bool
Parameters
- $message : Message
-
The message to validate
Return values
boolvalidate()
Validates a message from SNS to ensure that it was delivered by AWS.
public
validate(Message $message) : mixed
Parameters
- $message : Message
-
Message to validate.