Copyright | (c) Will Sewell 2016 |
---|---|
License | MIT |
Maintainer | [email protected] |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Network.Pusher.Internal.Auth
Description
This module contains helper functions for authenticating HTTP requests, as well as publically facing functions for authentication private and presence channel users; these functions are re-exported in the main Pusher module.
- type AuthString = ByteString
- type AuthSignature = ByteString
- authenticatePresence :: ToJSON a => Credentials -> SocketID -> Channel -> a -> AuthSignature
- authenticatePresenceWithEncoder :: (a -> Text) -> Credentials -> SocketID -> Channel -> a -> AuthSignature
- authenticatePrivate :: Credentials -> SocketID -> Channel -> AuthSignature
- makeQS :: AppKey -> AppSecret -> Text -> Text -> RequestQueryString -> ByteString -> Int -> RequestQueryString
Documentation
type AuthString = ByteString Source #
The bytestring to sign with the app secret to create a signature from.
type AuthSignature = ByteString Source #
A Pusher auth signature.
authenticatePresence :: ToJSON a => Credentials -> SocketID -> Channel -> a -> AuthSignature Source #
Generate an auth signature of the form "app_key:auth_sig" for a user of a presence channel.
authenticatePresenceWithEncoder Source #
Arguments
:: (a -> Text) | The encoder of the user data. |
-> Credentials | |
-> SocketID | |
-> Channel | |
-> a | |
-> AuthSignature |
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 :: Credentials -> SocketID -> Channel -> AuthSignature Source #
Generate an auth signature of the form "app_key:auth_sig" for a user of a private channel.
Arguments
:: AppKey | |
-> AppSecret | |
-> Text | |
-> Text | |
-> RequestQueryString | Any additional parameters |
-> ByteString | |
-> Int | Current UNIX timestamp |
-> RequestQueryString |
Generate the required query string parameters required to send API requests to Pusher.