View Source Plausible.HelpScout (Plausible v0.0.1)
HelpScout callback API logic.
Summary
Functions
Validates signature against secret key configured for the HelpScout application.
Types
@type signature_error() :: :bad_signature | :missing_signature
Functions
@spec validate_signature(Plug.Conn.t()) :: :ok | {:error, signature_error()}
Validates signature against secret key configured for the HelpScout application.
NOTE: HelpScout signature generation procedure at https://developer.helpscout.com/apps/guides/signature-validation/ fails to mention that it's implicitly dependent on request params order getting preserved. PHP arrays are ordered maps, so they provide this guarantee. Here, on the other hand, we have to determine the original order of the keys directly from the query string and serialize params to JSON using wrapper struct, informing Jason to put the values in the serialized object in this particular order matching query string.