Copyright | (c) Will Sewell 2016 |
---|---|
License | MIT |
Maintainer | me@willsewell.com |
Stability | stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module contains helper functions for authenticating HTTP requests, as well as publicly facing functions for authentication private and presence channel users; these functions are re-exported in the main Pusher module.
Synopsis
- authenticatePresence :: ToJSON a => Token -> Text -> Text -> a -> ByteString
- authenticatePresenceWithEncoder :: (a -> Text) -> Token -> Text -> Text -> a -> ByteString
- authenticatePrivate :: Token -> Text -> Text -> ByteString
- makeQS :: Token -> ByteString -> ByteString -> Query -> ByteString -> Word64 -> Query
Documentation
authenticatePresence :: ToJSON a => Token -> Text -> Text -> a -> ByteString Source #
Generate an auth signature of the form "app_key:auth_sig" for a user of a presence channel.
authenticatePresenceWithEncoder Source #
:: (a -> Text) | The encoder of the user data. |
-> Token | |
-> Text | |
-> Text | |
-> a | |
-> ByteString |
As above, but allows the encoder of the user data to be specified. This is useful for testing because the encoder can be mocked; aeson's encoder enodes JSON object fields in arbitrary orders, which makes it impossible to test.
authenticatePrivate :: Token -> Text -> Text -> ByteString Source #
Generate an auth signature of the form "app_key:auth_sig" for a user of a private channel.
:: Token | |
-> ByteString | |
-> ByteString | |
-> Query | Any additional parameters. |
-> ByteString | |
-> Word64 | |
-> Query |
Generate the required query string parameters required to send API requests to Pusher.