pusher-http-haskell- Haskell client library for the Pusher HTTP API

Copyright(c) Will Sewell 2016
Safe HaskellNone



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 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 #


:: (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.

makeQS Source #


:: 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.